37 #include <QStringListModel>
38 #include <QHeaderView>
40 #include <QApplication>
42 #include <QToolButton>
47 std::string iTextToDelete) :
49 iparent, iTextToDelete)
66 std::list< ItemColorComboboxData > iDataFromList)
80 std::list< ItemColorComboboxData > iDataFromList)
83 if ( !iDataFromList.empty() )
85 std::list< ItemColorComboboxData >::iterator iter =
86 iDataFromList.begin();
87 while ( iter != iDataFromList.end() )
106 bool SelectTheAddedItem)
111 if ( iNewItemData.second.isValid() )
125 this->
addItem(Icon, iNewItemData.first.c_str(), iNewItemData.second);
129 this->
insertItem(Index, Icon, iNewItemData.first.c_str(), iNewItemData.second);
132 if ( SelectTheAddedItem )
std::string toStdString() const
void SetItemsFromListWithColor(std::list< ItemColorComboboxData > iDataFromList)
clear the items already in the combobox,displayed the one in the iDataFromList and the items to add/d...
void AddItemWithColor(ItemColorComboboxData iNewItemData, bool SelectTheAddedItem=true)
add an item with color at the end of the list befor the "add new..." if they have already been added ...
QString itemText(int index) const
std::pair< std::string, QColor > ItemColorComboboxData
void insertItem(int index, const QString &text, const QVariant &userData)
void addItem(const QString &text, const QVariant &userData)
QGoColorComboBox(std::string iTextToAddANewOne, QWidget *iparent=0, std::string iTextToDelete="")
void drawRect(const QRectF &rectangle)
void setPen(const QColor &color)
void SetAddText()
add the "add new one" item at the end of the list
void setBrush(const QBrush &brush)
virtual void ActionWhenNewOneRequested()=0
slot linked to the signal AddANewOneActivated()
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
QVariant itemData(int index, int role) const
virtual ~QGoColorComboBox()
void AddANewOneActivated()
int m_NumberOfItemsAfterList
inherits from Qt QCombobox but add a the end of the list of items, 1 or 2 items: the first one to add...
void AddItemsEndOfList()
Add the "Add a new one..." and "Delete..." text items at the end of the items list.
void ItemSelected(ItemColorComboboxData)
void InitializeTheListWithColor(std::list< ItemColorComboboxData > iDataFromList)
call the method setItemsWithColorFromList and send a signal with the current index.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
ItemColorComboboxData GetTheItemColorComboBoxData(int iIndex)
get the name and the QColor of the item located at the index iIndex
virtual void EmitActivatedItem(int iIndexActivatedItem)