Mantid
|
Delegate to show the icons Download and Upload. More...
Public Member Functions | |
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... | |
QIcon | getIcon (const QString &state) const |
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
Draws the column 1 (Status) of ScriptRepositoryView. More... | |
RepoDelegate (QObject *parent=nullptr) | |
QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override |
Provides the ideal size for this column. More... | |
Delegate to show the icons Download and Upload.
Definition at line 29 of file ScriptRepositoryView.h.
MantidQt::API::ScriptRepositoryView::RepoDelegate::RepoDelegate | ( | QObject * | parent = nullptr | ) |
Definition at line 278 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 pushbutton 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:
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 373 of file ScriptRepositoryView.cpp.
References MantidQt::API::RepoModel::data(), index, MantidQt::API::RepoModel::localChangedSt(), MantidQt::API::RepoModel::localOnlySt(), MantidQt::API::ScriptRepositoryView::model, MantidQt::API::RepoModel::setData(), MantidQt::API::RepoModel::updatedSt(), and value.
QIcon MantidQt::API::ScriptRepositoryView::RepoDelegate::getIcon | ( | const QString & | state | ) | const |
Definition at line 334 of file ScriptRepositoryView.cpp.
References MantidQt::API::RepoModel::bothChangedSt(), MantidQt::API::RepoModel::downloadSt(), MantidQt::API::RepoModel::localChangedSt(), MantidQt::API::RepoModel::localOnlySt(), MantidQt::API::RepoModel::remoteChangedSt(), MantidQt::API::RepoModel::remoteOnlySt(), MantidQt::API::RepoModel::updatedSt(), and MantidQt::API::RepoModel::uploadSt().
|
override |
Draws the column 1 (Status) of ScriptRepositoryView.
This function is called every time the ScriptRepository needs to draw the widget for the Status of the file/folder inside the ScriptRepository. Instead of displaying the status (REMOTE_ONLY, LOCAL_ONLY, and so on), it will draw an Icon 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 through the editorEvent.
When this method is called, it will get the index in order to retrieve the information about the status of the entry (folder/file).
It will them decide which icon better describes the current status of the entry, and will draw it using the option and the painter given.
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 303 of file ScriptRepositoryView.cpp.
References index.
|
override |
Provides the ideal size for this column.
Definition at line 393 of file ScriptRepositoryView.cpp.