20 #ifndef ModuleBase_ListView_H_
21 #define ModuleBase_ListView_H_
23 #include "ModuleBase.h"
25 #include <QModelIndex>
27 #include <QListWidget>
54 int aHeight = 2 * QFontMetrics(font()).height();
55 QSize aSize = QListWidget::sizeHint();
56 return QSize(aSize.width(), aHeight);
62 int aHeight = 4 * QFontMetrics(font()).height();
63 QSize aSize = QListWidget::minimumSizeHint();
64 return QSize(aSize.width(), aHeight);
71 virtual void mouseReleaseEvent(QMouseEvent* e) {
72 QListWidget::mouseReleaseEvent(e);
80 void resizeEvent(QResizeEvent* theEvent)
82 QListWidget::resizeEvent(theEvent);
83 QTimer::singleShot(5, viewport(), SLOT(repaint()));
100 const QString& theToolTip = QString());
111 void addItem(
const QString& theTextValue,
const int theIndex);
115 bool hasItem(
const QString& theTextValue)
const;
119 void getSelectedIndices(std::set<int>& theIndices);
123 void selectIndices(
const std::set<int>& theIndices);
126 void removeSelectedItems();
130 void removeItems(std::set<int>& theIndices);
134 void restoreSelection(
const QModelIndexList& theIndices);
144 void onListSelection();
151 void listActivated();
An extension of QListWidget to provide Undo/Redo functionality.
Definition: ModuleBase_ListView.h:94
void deleteActionClicked()
Signal about delete action click.
QListWidget * myListControl
List control.
Definition: ModuleBase_ListView.h:154
virtual ~ModuleBase_ListView()
Destructor.
Definition: ModuleBase_ListView.h:102
QListWidget * getControl() const
Returns current control.
Definition: ModuleBase_ListView.h:106
QAction * myDeleteAction
A delete action for pop-up menu in a list control.
Definition: ModuleBase_ListView.h:157
void updateActionsStatus()
Update enable/disable state of context menu actions.
QAction * myCopyAction
A copy action for pop-up menu in a list control.
Definition: ModuleBase_ListView.h:156