1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 #ifndef SMSCCOMBOBOX_H 8 #define SMSCCOMBOBOX_H 9 10 #include <QComboBox> 11 12 class SMScComboBox : public QComboBox 13 { 14 Q_OBJECT 15 public: 16 SMScComboBox(QWidget *parent); ~SMScComboBox()17 ~SMScComboBox() {}; 18 19 void setCurrentItem(int i); 20 void setCurrentItem(int i, bool isParentValue); 21 22 // Set the current index of a combobox according to the value 23 // stored into the data associated to items. Thus, allowing 24 // separation between presentation and data.Isn’t that cool? ;-) 25 void setCurrentItemByData(int i); 26 void setCurrentItemByData(int i, bool isParentValue); 27 void setCurrentItemByData(double d); 28 void setCurrentItemByData(double d, bool isParentValue); 29 30 int getItemIndexForData(int i); 31 int getItemIndexForData(double d); 32 33 void setParentItem(int i); 34 bool useParentValue(); 35 36 private: 37 bool m_hasParent = false; 38 bool m_useParentValue = false; 39 int m_pItem = 0; 40 41 void setFont(bool wantBold); 42 43 private slots: 44 void currentChanged(); 45 }; 46 47 #endif 48