Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MantidQt::API::ScriptRepositoryView::CheckBoxDelegate Class Reference

Delegate to show the checkbox for configuring the auto update. More...

Inheritance diagram for MantidQt::API::ScriptRepositoryView::CheckBoxDelegate:

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...
 

Detailed Description

Delegate to show the checkbox for configuring the auto update.

Definition at line 40 of file ScriptRepositoryView.h.

Constructor & Destructor Documentation

◆ CheckBoxDelegate()

MantidQt::API::ScriptRepositoryView::CheckBoxDelegate::CheckBoxDelegate ( QObject *  parent = nullptr)

Definition at line 402 of file ScriptRepositoryView.cpp.

Member Function Documentation

◆ editorEvent()

bool MantidQt::API::ScriptRepositoryView::CheckBoxDelegate::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.

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'.

Parameters
eventThe event given by the framework
modelPointer to the model needed to retrive the status of the entry
indexidentifies the entry (file/folder)
optionProvided by the framewor, and passed on to the base class.
Returns
true if it handles or false to ignore.

Definition at line 474 of file ScriptRepositoryView.cpp.

References MantidQt::API::RepoModel::data(), index, MantidQt::API::ScriptRepositoryView::model, MantidQt::API::RepoModel::setData(), and value.

◆ paint()

void MantidQt::API::ScriptRepositoryView::CheckBoxDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
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).

Parameters
painterRequired to draw the widget
optionProvided by the framework and has information displaying the widget.
indexIdentifies the entry inside the RepoModel (indirectly the file / folder).

Definition at line 424 of file ScriptRepositoryView.cpp.

References index.


The documentation for this class was generated from the following files: