Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

Blokkal::Ui::SemiEditableComboBox Class Reference

A combo box that is editable if the item with index 0 is selected and not editable otherwise. More...

#include <semieditablecombobox.h>

Inheritance diagram for Blokkal::Ui::SemiEditableComboBox:

Blokkal::Ui::MediaInfoComboBox

List of all members.


Public Member Functions

 SemiEditableComboBox (QWidget *parent=0)
virtual void setCurrentIndex (int index)
virtual void setCurrentText (const QString &itemText)
void setItems (QStringList items)
virtual ~SemiEditableComboBox (void)

Protected Slots

virtual void setCustomInfo (const QString &text)
virtual void updateEditableState (int index=-1)

Protected Member Functions

virtual void showEvent (QShowEvent *event)

Detailed Description

A combo box that is editable if the item with index 0 is selected and not editable otherwise.

A combo box that is editable if the item with index 0 is selected and not editable otherwise.

This class is used as a base for Blokkal::Ui::MediaInfoComboBox but can be used for other applications as well.

Author:
Martin Mueller <orvio@orvio.de>

Definition at line 43 of file semieditablecombobox.h.


Constructor & Destructor Documentation

Blokkal::Ui::SemiEditableComboBox::SemiEditableComboBox ( QWidget *  parent = 0  ) 

Creates a new SemiEditableComboBox.

Parameters:
parent parent widget

Definition at line 34 of file semieditablecombobox.cpp.

Blokkal::Ui::SemiEditableComboBox::~SemiEditableComboBox ( void   )  [virtual]

Destrcutor

Definition at line 46 of file semieditablecombobox.cpp.


Member Function Documentation

void Blokkal::Ui::SemiEditableComboBox::setCurrentIndex ( int  index  )  [virtual]

Sets the current item to be the item with index index.

Parameters:
index the index of the item to select

Definition at line 60 of file semieditablecombobox.cpp.

void Blokkal::Ui::SemiEditableComboBox::setCurrentText ( const QString &  itemText  )  [virtual]

Unlike KComboBox::setCurrentText() this method will search for itemText in the combobox items. If it does find it, the appropriate item will be selected. If such an item cannot be found the item with index 0 is set to itemText and is selected.

Definition at line 66 of file semieditablecombobox.cpp.

void Blokkal::Ui::SemiEditableComboBox::setCustomInfo ( const QString &  text  )  [protected, virtual, slot]

This slot is connected to the editTextChanged() signal. If item 0 is selected it will have it's text replaced with text

Parameters:
text text of the custom media info

Definition at line 110 of file semieditablecombobox.cpp.

void Blokkal::Ui::SemiEditableComboBox::setItems ( QStringList  items  ) 

Clears any previous content and sets the items in the combo box to those in items. Additionally an empty item is inserted at index 0. If an item was selected before this method was called, item 0 will be set to the value of the previously selected item if it does not exist in items. If it does it will be selected.

Parameters:
items the items for the combo box

Definition at line 51 of file semieditablecombobox.cpp.

void Blokkal::Ui::SemiEditableComboBox::showEvent ( QShowEvent *  event  )  [protected, virtual]

Reeimplemented to make sure the editable state is correct for the currently selected item.

Parameters:
event the show event

Definition at line 87 of file semieditablecombobox.cpp.

void Blokkal::Ui::SemiEditableComboBox::updateEditableState ( int  index = -1  )  [protected, virtual, slot]

Sets the editable state of the combobox as appropriate for the currently selected item if index < 0 or for the item with index index otherwise. This slot is called whenever the user selects a new item.

Definition at line 94 of file semieditablecombobox.cpp.


The documentation for this class was generated from the following files: