|
Krita Source Code Documentation
|
The KisTagChooserWidget class is responsible for all the logic that the tags combobox has in various resource choosers. More...
#include <KisTagChooserWidget.h>
Inheritance diagram for KisTagChooserWidget:Public Slots | |
| void | addTag (const QString &tag) |
| tagToolCreateNewTag slot for the signal from KisTagToolButton that a new tag needs to be created | |
| void | addTag (const QString &tag, KoResourceSP resource) |
| void | addTag (KisTagSP tag, KoResourceSP resource) |
| void | tagChanged (int index) |
| tagChanged slot for the signal from the combobox that the index changed | |
Signals | |
| void | sigTagChosen (const KisTagSP tag) |
| sigTagChosen is emitted when the selected tag in the combobox changes due to user interaction or by other means | |
Public Member Functions | |
| int | currentIndex () const |
| currentIndex returns the current index in tags combobox | |
| KisTagSP | currentlySelectedTag () |
| currentlySelectedTag returns the current tag from combobox | |
| KisTagChooserWidget (KisTagModel *model, QString resourceType, QWidget *parent) | |
| bool | selectedTagIsReadOnly () |
| selectedTagIsReadOnly checks whether the tag is readonly (generated by Krita) | |
| void | setCurrentItem (const QString &tag) |
| setCurrentItem sets the tag from the param as the current tag in the combobox | |
| void | updateIcons () |
| update icon files on loading and theme change | |
| ~KisTagChooserWidget () override | |
Public Attributes | |
| QScopedPointer< KisTagModel > | allTagsModel |
| KisTagSP | cachedTag |
| QComboBox * | comboBox |
| KisTagModel * | model |
| QString | resourceType |
| KisTagToolButton * | tagToolButton |
Private Types | |
| enum | OverwriteDialogOptions { Replace , Undelete , Cancel } |
Private Slots | |
| void | cacheSelectedTag () |
| cacheSelectedTag slot that stores current tag selection. | |
| void | restoreTagFromCache () |
| restoreTagFromCache slot designed to restore a selected tag from previously cached selection. | |
| void | slotTagModelDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > roles) |
| void | tagToolContextMenuAboutToShow () |
| tagToolContextMenuAboutToShow slot for the signal from the KisTagToolButton that the popup will be shown soon | |
| void | tagToolDeleteCurrentTag () |
| tagToolDeleteCurrentTag slot for the signal from the KisTagToolButton that the current tag needs to be deleted | |
| void | tagToolRenameCurrentTag (const QString &tag) |
| tagToolRenameCurrentTag slot for the signal from KisTagToolButton that the current tag needs to be renamed | |
| void | tagToolUndeleteLastTag (KisTagSP tag) |
| tagToolUndeleteLastTag slot for the signal from the KisTagToolButton that the last deleted tag needs to be undeleted | |
Private Member Functions | |
| OverwriteDialogOptions | overwriteTagDialog (KisTagChooserWidget *parent, bool undelete) |
| void | setCurrentIndex (int index) |
| setCurrentIndex sets the current index in the combobox | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
The KisTagChooserWidget class is responsible for all the logic that the tags combobox has in various resource choosers.
It uses KisTagModel as a model for items in the combobox. It is also responsible for the popup for tag removal, renaming and creation that appears on the right side of the tag combobox (via KisTagToolButton) All the logic for adding and removing tags is done through KisTagModel.
Definition at line 33 of file KisTagChooserWidget.cpp.
|
private |
| Enumerator | |
|---|---|
| Replace | |
| Undelete | |
| Cancel | |
Definition at line 119 of file KisTagChooserWidget.h.
|
explicit |
Definition at line 44 of file KisTagChooserWidget.cpp.
References addTag(), cacheSelectedTag(), connect(), d, model, KisAllTagsModel::Name, resourceType, restoreTagFromCache(), KisTagModel::ShowAllTags, slotTagModelDataChanged(), tagChanged(), tagToolContextMenuAboutToShow(), tagToolDeleteCurrentTag(), tagToolRenameCurrentTag(), and tagToolUndeleteLastTag().
|
override |
|
slot |
tagToolCreateNewTag slot for the signal from KisTagToolButton that a new tag needs to be created
| tag | tag with the name to be created |
Definition at line 258 of file KisTagChooserWidget.cpp.
References addTag().
|
slot |
Definition at line 274 of file KisTagChooserWidget.cpp.
References Cancel, d, KisAllTagsModel::Name, overwriteTagDialog(), KisTagResourceModel::tagResources(), Undelete, KisAllTagsModel::urlAll(), and KisAllTagsModel::urlAllUntagged().
|
slot |
Definition at line 302 of file KisTagChooserWidget.cpp.
References Cancel, d, KisAllTagsModel::Name, overwriteTagDialog(), KisTagResourceModel::tagResources(), Undelete, KisAllTagsModel::urlAll(), and KisAllTagsModel::urlAllUntagged().
|
privateslot |
cacheSelectedTag slot that stores current tag selection.
Used to allow restoration of tag even after a model reset. Will store the tag just before model resets.
Definition at line 188 of file KisTagChooserWidget.cpp.
References currentlySelectedTag(), and d.
| int KisTagChooserWidget::currentIndex | ( | ) | const |
currentIndex returns the current index in tags combobox
Definition at line 242 of file KisTagChooserWidget.cpp.
References d.
| KisTagSP KisTagChooserWidget::currentlySelectedTag | ( | ) |
currentlySelectedTag returns the current tag from combobox
Definition at line 328 of file KisTagChooserWidget.cpp.
References d.
|
private |
Definition at line 263 of file KisTagChooserWidget.cpp.
|
privateslot |
restoreTagFromCache slot designed to restore a selected tag from previously cached selection.
Companion to cacheSelectedTag, this method restore the selection after model reset.
Definition at line 193 of file KisTagChooserWidget.cpp.
References d, and setCurrentIndex().
| bool KisTagChooserWidget::selectedTagIsReadOnly | ( | ) |
|
private |
setCurrentIndex sets the current index in the combobox
| index | index is the index of the tag in the combobox |
Definition at line 237 of file KisTagChooserWidget.cpp.
References d.
| void KisTagChooserWidget::setCurrentItem | ( | const QString & | tag | ) |
setCurrentItem sets the tag from the param as the current tag in the combobox
| tag | tag url to be set as current in the combobox |
Definition at line 247 of file KisTagChooserWidget.cpp.
References d, setCurrentIndex(), and KisAllTagsModel::Url.
sigTagChosen is emitted when the selected tag in the combobox changes due to user interaction or by other means
| tag | current tag |
|
privateslot |
Definition at line 202 of file KisTagChooserWidget.cpp.
References d.
|
slot |
tagChanged slot for the signal from the combobox that the index changed
| index | new index |
When the index in the combobox changes, for example because of user's interaction, combobox emits a signal; this method is called when it happens.
Definition at line 124 of file KisTagChooserWidget.cpp.
References currentlySelectedTag(), d, KisAllTagsModel::Name, setCurrentIndex(), and sigTagChosen().
|
privateslot |
tagToolContextMenuAboutToShow slot for the signal from the KisTagToolButton that the popup will be shown soon
Based on the current tag (if it's readonly or not), the popup looks different, so this function sets the correct mode on the KisTagToolButton popup.
Definition at line 345 of file KisTagChooserWidget.cpp.
References currentlySelectedTag(), and d.
|
privateslot |
tagToolDeleteCurrentTag slot for the signal from the KisTagToolButton that the current tag needs to be deleted
Note that tags are not deleted but just marked inactive in the database.
Definition at line 114 of file KisTagChooserWidget.cpp.
References currentlySelectedTag(), d, KisAllTagsModel::Name, and setCurrentIndex().
|
privateslot |
tagToolRenameCurrentTag slot for the signal from KisTagToolButton that the current tag needs to be renamed
| newName | new name for the tag |
Definition at line 138 of file KisTagChooserWidget.cpp.
References currentlySelectedTag(), d, KIS_SAFE_ASSERT_RECOVER_RETURN, setCurrentIndex(), KisAllTagsModel::urlAll(), and KisAllTagsModel::urlAllUntagged().
tagToolUndeleteLastTag slot for the signal from the KisTagToolButton that the last deleted tag needs to be undeleted
| tag | tag to be undeleted (marked active) |
Definition at line 176 of file KisTagChooserWidget.cpp.
References d, KisAllTagsModel::Name, setCurrentIndex(), and setCurrentItem().
| void KisTagChooserWidget::updateIcons | ( | ) |
update icon files on loading and theme change
Definition at line 340 of file KisTagChooserWidget.cpp.
References d.
| QScopedPointer<KisTagModel> KisTagChooserWidget::allTagsModel |
Definition at line 41 of file KisTagChooserWidget.cpp.
| KisTagSP KisTagChooserWidget::cachedTag |
Definition at line 39 of file KisTagChooserWidget.cpp.
| QComboBox* KisTagChooserWidget::comboBox |
Definition at line 36 of file KisTagChooserWidget.cpp.
|
private |
Definition at line 129 of file KisTagChooserWidget.h.
| KisTagModel* KisTagChooserWidget::model |
Definition at line 38 of file KisTagChooserWidget.cpp.
| QString KisTagChooserWidget::resourceType |
Definition at line 40 of file KisTagChooserWidget.cpp.
| KisTagToolButton* KisTagChooserWidget::tagToolButton |
Definition at line 37 of file KisTagChooserWidget.cpp.