Mantid
|
Delegate to show the checkbox for configuring the auto update. More...
Public Member Functions | |
CheckBoxDelegate (QObject *parent=nullptr) | |
bool | editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override |
Reacts to the iteraction with the user when he clicks on the buttons displayed at paint. More... | |
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
Draws the column 2 (AutoUpdate) of ScriptRepositoryView. More... | |
Delegate to show the checkbox for configuring the auto update.
Definition at line 40 of file ScriptRepositoryView.h.
MantidQt::API::ScriptRepositoryView::CheckBoxDelegate::CheckBoxDelegate | ( | QObject * | parent = nullptr | ) |
Definition at line 402 of file ScriptRepositoryView.cpp.
|
override |
Reacts to the iteraction with the user when he clicks on the buttons displayed at paint.
Given the state of an entry (folder/file) there is only on available action. So, it is enough to get the event that the user interact with the checkbox to decide what to do.
It will filter the event in order to get the Left-Click of mouse. If it gets the click of the mouse, it will trigger the action to toggle the state of the checkbox, which means, trigger the action 'setTrue' if the current state is 'false' of trigger the action 'setFalse' if the current state is 'true'.
event | The event given by the framework |
model | Pointer to the model needed to retrive the status of the entry |
index | identifies the entry (file/folder) |
option | Provided by the framewor, and passed on to the base class. |
Definition at line 474 of file ScriptRepositoryView.cpp.
References MantidQt::API::RepoModel::data(), index, MantidQt::API::ScriptRepositoryView::model, MantidQt::API::RepoModel::setData(), and value.
|
override |
Draws the column 2 (AutoUpdate) of ScriptRepositoryView.
This function is called every time the ScriptRepository needs to draw the widget for the AutoUpdate of the file/folder inside the ScriptRepository. Instead of displaying the strings 'true' and 'false' it will draw a checkbox that 'hoppefully' will better indicate to the user the condition of the entry as well as encourage him to act. The action will be dealt with at the editorEvent.
When this method is called, it will get the index in order to retrieve the information about the state of the entry (folder/file).
painter | Required to draw the widget |
option | Provided by the framework and has information displaying the widget. |
index | Identifies the entry inside the RepoModel (indirectly the file / folder). |
Definition at line 424 of file ScriptRepositoryView.cpp.
References index.