|
Krita Source Code Documentation
|
#include <KisSqueezedComboBox.h>
Inheritance diagram for KisSqueezedComboBox:Public Member Functions | |
| void | addSqueezedItem (const QIcon &icon, const QString &newItem, QVariant userData=QVariant()) |
| void | addSqueezedItem (const QString &newItem, QVariant userData=QVariant()) |
| bool | contains (const QString &text) const |
| QString | currentUnsqueezedText () |
| qint32 | findOriginalText (const QString &text) const |
| void | insertSqueezedItem (const QIcon &icon, const QString &newItem, int index, QVariant userData=QVariant()) |
| void | insertSqueezedItem (const QString &newItem, int index, QVariant userData=QVariant()) |
| KisSqueezedComboBox (QWidget *parent=0, const char *name=0) | |
| QStringList | originalTexts () const |
| void | removeSqueezedItem (int index) |
| void | resetOriginalTexts (const QStringList &texts) |
| void | setCurrent (const QString &itemText) |
| QSize | sizeHint () const override |
| ~KisSqueezedComboBox () override | |
Static Public Member Functions | |
| static QString | squeezeText (const QString &original, const QWidget *widget) |
Private Slots | |
| void | slotTimeOut () |
Private Member Functions | |
| void | addItem (const QString &text) |
| void | insertItem (const QString &text) |
| void | insertItem (qint32 index, const QString &text) |
| void | resizeEvent (QResizeEvent *) override |
| void | setCurrentText (const QString &itemText) |
Private Attributes | |
| QMap< int, QString > | m_originalItems |
| QTimer * | m_timer |
This widget is a QComboBox, but then a little bit different. It only shows the right part of the items depending on de size of the widget. When it is not possible to show the complete item, it will be shortened and "..." will be prepended.
Definition at line 38 of file KisSqueezedComboBox.h.
| KisSqueezedComboBox::KisSqueezedComboBox | ( | QWidget * | parent = 0, |
| const char * | name = 0 ) |
Constructor
| parent | parent widget |
| name | name to give to the widget |
Definition at line 23 of file KisSqueezedComboBox.cpp.
References connect(), m_timer, and slotTimeOut().
|
override |
|
private |
| void KisSqueezedComboBox::addSqueezedItem | ( | const QIcon & | icon, |
| const QString & | newItem, | ||
| QVariant | userData = QVariant() ) |
Append an item.
| icon | the item icon |
| newItem | the original (long version) of the item which needs to be added to the combobox |
| userData | the user data |
Definition at line 112 of file KisSqueezedComboBox.cpp.
References insertSqueezedItem().
| void KisSqueezedComboBox::addSqueezedItem | ( | const QString & | newItem, |
| QVariant | userData = QVariant() ) |
Append an item.
| newItem | the original (long version) of the item which needs to be added to the combobox |
| userData | the user data. |
Definition at line 107 of file KisSqueezedComboBox.cpp.
References insertSqueezedItem().
| bool KisSqueezedComboBox::contains | ( | const QString & | text | ) | const |
Returns true if the combobox contains the original (not-squeezed) version of text.
| text | the original (not-squeezed) text to check for |
Definition at line 39 of file KisSqueezedComboBox.cpp.
References m_originalItems.
| QString KisSqueezedComboBox::currentUnsqueezedText | ( | ) |
This method returns the full text (not squeezed) of the currently highlighted item.
Definition at line 160 of file KisSqueezedComboBox.cpp.
References m_originalItems.
| qint32 KisSqueezedComboBox::findOriginalText | ( | const QString & | text | ) | const |
Returns index of a original text, -1 if the text isn't found
| text | the original (not-squeezed) text to search for |
Definition at line 53 of file KisSqueezedComboBox.cpp.
References m_originalItems.
|
private |
|
private |
| void KisSqueezedComboBox::insertSqueezedItem | ( | const QIcon & | icon, |
| const QString & | newItem, | ||
| int | index, | ||
| QVariant | userData = QVariant() ) |
Definition at line 100 of file KisSqueezedComboBox.cpp.
References m_originalItems, and squeezeText().
| void KisSqueezedComboBox::insertSqueezedItem | ( | const QString & | newItem, |
| int | index, | ||
| QVariant | userData = QVariant() ) |
This inserts a item to the list. See QComboBox::insertItem() for details. Please do not use QComboBox::insertItem() to this widget, as that will fail.
| newItem | the original (long version) of the item which needs to be added to the combobox |
| index | the position in the widget. |
| userData | the user data. |
Definition at line 93 of file KisSqueezedComboBox.cpp.
References m_originalItems, and squeezeText().
| QStringList KisSqueezedComboBox::originalTexts | ( | ) | const |
Return the list of original text items
Definition at line 63 of file KisSqueezedComboBox.cpp.
References m_originalItems.
| void KisSqueezedComboBox::removeSqueezedItem | ( | int | index | ) |
remove the squeezed item at index
Definition at line 166 of file KisSqueezedComboBox.cpp.
References m_originalItems.
| void KisSqueezedComboBox::resetOriginalTexts | ( | const QStringList & | texts | ) |
Reset the combo box and initialize it with the list of (original) text items
Definition at line 68 of file KisSqueezedComboBox.cpp.
References addSqueezedItem(), and m_originalItems.
|
overrideprivate |
Definition at line 125 of file KisSqueezedComboBox.cpp.
References m_timer.
| void KisSqueezedComboBox::setCurrent | ( | const QString & | itemText | ) |
Set the current item to the one matching the given text.
| itemText | the original (long version) of the item text |
Definition at line 117 of file KisSqueezedComboBox.cpp.
References findOriginalText().
|
private |
|
override |
Sets the sizeHint() of this widget.
Definition at line 80 of file KisSqueezedComboBox.cpp.
|
privateslot |
Definition at line 130 of file KisSqueezedComboBox.cpp.
References m_originalItems, and squeezeText().
|
static |
Definition at line 138 of file KisSqueezedComboBox.cpp.
|
private |
Definition at line 147 of file KisSqueezedComboBox.h.
|
private |
Definition at line 148 of file KisSqueezedComboBox.h.