HAL
context_manager_widget.cpp
Go to the documentation of this file.
2 
3 #include "gui/gui_globals.h"
4 
7 //#include "gui/graph_widget/graph_widget.h"
8 
12 
13 //#include "hal_core/utilities/log.h"
14 #include "gui/gui_utils/graphics.h"
15 //#include "hal_core/netlist/gate.h"
16 //#include "hal_core/netlist/module.h"
17 //#include "hal_core/netlist/netlist.h"
18 #include "gui/toolbar/toolbar.h"
19 #include <QAction>
20 #include <QDebug>
21 //#include <QListWidgetItem>
22 #include <QMenu>
23 #include <QResizeEvent>
24 #include <QSize>
25 //#include <QStringList>
26 //#include <QStringListModel>
27 #include <QVBoxLayout>
28 #include <QHeaderView>
35 #include <QShortcut>
36 #include <QApplication>
37 #include <QInputDialog>
38 
39 namespace hal
40 {
42  : ContentWidget("Views", parent), mSearchbar(new Searchbar(this)), mNewDirectoryAction(new QAction(this)), mNewViewAction(new QAction(this)), mRenameAction(new QAction(this)), mDuplicateAction(new QAction(this)),
43  mDeleteAction(new QAction(this)), mOpenAction(new QAction(this))
44  {
45  //needed to load the properties
47  mTabView = tab_view;
48 
49  mOpenAction->setIcon(gui_utility::getStyledSvgIcon(mOpenIconStyle, mOpenIconPath));
50  mNewViewAction->setIcon(gui_utility::getStyledSvgIcon(mNewViewIconStyle, mNewViewIconPath));
51  mNewDirectoryAction->setIcon(gui_utility::getStyledSvgIcon(mNewViewIconStyle, mNewDirIconPath));
52  mRenameAction->setIcon(gui_utility::getStyledSvgIcon(mRenameIconStyle, mRenameIconPath));
53  mDuplicateAction->setIcon(gui_utility::getStyledSvgIcon(mDuplicateIconStyle, mDuplicateIconPath));
54  mDeleteAction->setIcon(gui_utility::getStyledSvgIcon(mDeleteIconStyle, mDeleteIconPath));
55  mSearchAction->setIcon(gui_utility::getStyledSvgIcon(mSearchIconStyle, mSearchIconPath));
56 
57  mOpenAction->setToolTip("Open");
58  mNewViewAction->setToolTip("New view");
59  mNewDirectoryAction->setToolTip("New directory");
60  mRenameAction->setToolTip("Rename");
61  mDuplicateAction->setToolTip("Duplicate");
62  mDeleteAction->setToolTip("Delete");
63  mSearchAction->setToolTip("Search");
64 
65  mOpenAction->setText("Open view");
66  mNewViewAction->setText("Create new view");
67  mNewDirectoryAction->setText("Create new directory");
68  mRenameAction->setText("Rename item");
69  mDuplicateAction->setText("Duplicate view");
70  mDeleteAction->setText("Delete item");
71  mSearchAction->setText("Search");
72 
73  //mOpenAction->setEnabled(false);
74  //mRenameAction->setEnabled(false);
75  //mDuplicateAction->setEnabled(false);
76  //mDeleteAction->setEnabled(false);
77 
78  mContextTreeModel = gGraphContextManager->getContextTreeModel();
79 
80  mContextTreeProxyModel = new ContextProxyModel(this);
81  mContextTreeProxyModel->setSourceModel(mContextTreeModel);
82  mContextTreeProxyModel->setSortRole(Qt::UserRole);
83 
84  mContextTreeView = new QTreeView(this);
85  mContextTreeView->setModel(mContextTreeProxyModel);
86  mContextTreeView->setSortingEnabled(true);
88  mContextTreeView->setSelectionMode(QAbstractItemView::SingleSelection); // ERROR ???
89  mContextTreeView->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
91 
92  mContextTreeView->setDragEnabled(true);
93  mContextTreeView->setAcceptDrops(true);
94  mContextTreeView->setDropIndicatorShown(true);
95 
96  mContextTreeView->header()->setSortIndicator(-1, Qt::AscendingOrder);
97  mContextTreeView->header()->setSortIndicatorShown(false);
98 
99  mContentLayout->addWidget(mContextTreeView);
100  mContentLayout->addWidget(mSearchbar);
101 
102  mSearchbar->hide();
103  mSearchbar->setColumnNames(mContextTreeProxyModel->getColumnNames());
104  enableSearchbar(mContextTreeProxyModel->rowCount() > 0);
105 
107  connect(mNewViewAction, &QAction::triggered, this, &ContextManagerWidget::handleCreateContextClicked);
108  connect(mNewDirectoryAction, &QAction::triggered, this, &ContextManagerWidget::handleCreateDirectoryClicked);
109  connect(mRenameAction, &QAction::triggered, this, &ContextManagerWidget::handleRenameClicked);
110  connect(mDuplicateAction, &QAction::triggered, this, &ContextManagerWidget::handleDuplicateContextClicked);
111  connect(mDeleteAction, &QAction::triggered, this, &ContextManagerWidget::handleDeleteClicked);
112  connect(mSearchAction, &QAction::triggered, this, &ContextManagerWidget::toggleSearchbar);
113 
114  connect(mContextTreeView, &QTreeView::customContextMenuRequested, this, &ContextManagerWidget::handleContextMenuRequest);
117  connect(mContextTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ContextManagerWidget::handleSelectionChanged);
118  connect(mContextTreeView->header(), &QHeaderView::sectionClicked, this, &ContextManagerWidget::handleHeaderSectionClicked);
121 
123  connect(mSearchbar, &Searchbar::triggerNewSearch, mContextTreeProxyModel, &ContextProxyModel::startSearch);
124 
125  mShortCutDeleteItem = new QShortcut(ContentManager::sSettingDeleteItem->value().toString(), this);
126  mShortCutDeleteItem->setEnabled(false);
127 
129  connect(mShortCutDeleteItem, &QShortcut::activated, this, &ContextManagerWidget::handleDeleteClicked);
130 
131  connect(qApp, &QApplication::focusChanged, this, &ContextManagerWidget::handleFocusChanged);
132 
135  }
136 
137  void ContextManagerWidget::handleHeaderSectionClicked(int column)
138  {
139  mContextTreeView->header()->setSortIndicatorShown(true);
140  }
141 
142  void ContextManagerWidget::handleCreateContextClicked()
143  {
144  UserActionCompound* act = new UserActionCompound;
145  act->setUseCreatedObject();
146  act->addAction(new ActionCreateObject(UserActionObjectType::ContextView,
148  act->addAction(new ActionAddItemsToObject({gNetlist->get_top_module()->get_id()}, {}));
149  act->exec();
150  }
151 
152  void ContextManagerWidget::handleRowsInserted(const QModelIndex &parent, int first, int last)
153  {
154  mContextTreeView->expand(mContextTreeProxyModel->mapFromSource(parent));
155  for (int irow = first; irow <= last; irow++)
156  {
157  mContextTreeView->expand(mContextTreeProxyModel->mapFromSource(mContextTreeModel->index(irow,0,parent)));
158  }
159  }
160 
161  void ContextManagerWidget::handleCreateDirectoryClicked()
162  {
163  bool confirm;
164  QString newName = QInputDialog::getText(this, "Directory name", "name:", QLineEdit::Normal, "", &confirm);
165 
166  if (confirm && !newName.isEmpty())
167  {
169  act->setUseCreatedObject();
171  act->addAction(new ActionAddItemsToObject({gNetlist->get_top_module()->get_id()}, {}));
172  act->exec(); }
173  }
174 
176  {
177  GraphContext* defaultContext = getCurrentContext();
178  if (!defaultContext) return;
179  mTabView->showContext(defaultContext);
180  }
181 
183  {
184  QModelIndex sourceIndex = mContextTreeProxyModel->mapToSource(proxyIndex);
185  ContextTreeItem* item = static_cast<ContextTreeItem*>(mContextTreeModel->getItemFromIndex(sourceIndex));
186 
187  mContextTreeModel->setCurrentDirectory(item);
188 
189  if (item->isContext()) {
190 
191  GraphContext* clickedContext = item->context();
192 
193  if (!clickedContext) return;
194 
195  mTabView->showContext(clickedContext);
196  }
197  }
198 
200  {
201  QModelIndex sourceIndex = mContextTreeProxyModel->mapToSource(proxyIndex);
202  ContextTreeItem* item = static_cast<ContextTreeItem*>(mContextTreeModel->getItemFromIndex(sourceIndex));
203 
204  mContextTreeModel->setCurrentDirectory(item);
205 
206  }
207 
208  void ContextManagerWidget::handleRenameClicked()
209  {
210  ContextTreeItem* clicked_item = getCurrentItem();
211 
212  if (clicked_item->isContext()) {
213  GraphContext* clicked_context = clicked_item->context();
214 
215  if (!clicked_context) return;
216 
217  QStringList used_context_names;
218  for (const auto& context : gGraphContextManager->getContexts())
219  used_context_names.append(context->name());
220 
221  UniqueStringValidator unique_validator(used_context_names);
222  EmptyStringValidator empty_validator;
223 
224  InputDialog ipd;
225  ipd.setWindowTitle("Rename View");
226  ipd.setInfoText("Please select a new unique name for the view.");
227  ipd.setInputText(clicked_context->name());
228  ipd.addValidator(&unique_validator);
229  ipd.addValidator(&empty_validator);
230 
231  if (ipd.exec() == QDialog::Accepted)
232  {
235  act->exec();
236  clicked_context->setExclusiveModuleId(0, false);
237  }
238  }
239  else if (clicked_item->isDirectory()){
240  ContextDirectory* clicked_directory = clicked_item->directory();
241 
242  if (!clicked_directory) return;
243 
244  InputDialog ipd;
245  ipd.setWindowTitle("Rename directory");
246  ipd.setInfoText("Please select a new name for the directory.");
247  ipd.setInputText(clicked_directory->name());
248 
249  if (ipd.exec() == QDialog::Accepted)
250  {
251  ActionRenameObject* act = new ActionRenameObject(ipd.textValue());
252  act->setObject(UserActionObject(clicked_directory->id(),UserActionObjectType::ContextDir));
253  act->exec();
254  }
255  }
256  }
257 
258  void ContextManagerWidget::handleDuplicateContextClicked()
259  {
260  GraphContext* clicked_context = getCurrentContext();
261 
262  if (!clicked_context) return;
263 
264  UserActionCompound* act = new UserActionCompound;
265  act->setUseCreatedObject();
266  act->addAction(new ActionCreateObject(UserActionObjectType::ContextView,clicked_context->name() + " (Copy)"));
267  act->addAction(new ActionAddItemsToObject(clicked_context->modules(),clicked_context->gates()));
268  act->exec();
269  }
270 
271  void ContextManagerWidget::handleDeleteClicked()
272  {
273  QModelIndex currentIndex = mContextTreeView->currentIndex();
274  if (!currentIndex.isValid()) return;
275 
276  ContextTreeItem* currentItem = getCurrentItem();
277 
278  if (currentItem->isContext()) {
279  GraphContext* clicked_context = currentItem->context();
280 
281  if (!clicked_context) return;
282 
283  ActionDeleteObject* act = new ActionDeleteObject;
284  act->setObject(UserActionObject(clicked_context->id(),UserActionObjectType::ContextView));
285  act->exec();
286  }
287  else if (currentItem->isDirectory()) {
288  if (currentItem->getChildCount())
289  {
290  if (QMessageBox::Ok !=
291  QMessageBox::information(this, "Directory not empty", "You are about to delete a directory which is not empty.\nThis action cannot be undone",
293  return;
294  }
295 
296  ContextDirectory* clicked_directory = currentItem->directory();
297 
298  if (!clicked_directory) return;
299 
300  ActionDeleteObject* act = new ActionDeleteObject;
301  act->setObject(UserActionObject(clicked_directory->id(),UserActionObjectType::ContextDir));
302  act->exec();
303  }
304 
305 
306  }
307 
308  void ContextManagerWidget::handleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
309  {
310  Q_UNUSED(deselected);
311 
312  if(selected.indexes().isEmpty())
313  setToolbarButtonsEnabled(false);
314  else
315  setToolbarButtonsEnabled(true);
316  }
317 
318  void ContextManagerWidget::handleContextMenuRequest(const QPoint& point)
319  {
320  const QModelIndex clicked_index = mContextTreeView->indexAt(point);
321 
322  QModelIndex sourceIndex = mContextTreeProxyModel->mapToSource(clicked_index);
323  ContextTreeItem* item = static_cast<ContextTreeItem*>(mContextTreeModel->getItemFromIndex(sourceIndex));
324  if (item)
325  mContextTreeModel->setCurrentDirectory(item);
326 
327  QMenu context_menu;
328 
329  context_menu.addAction(mNewViewAction);
330  context_menu.addAction(mNewDirectoryAction);
331 
332  GraphContext* clicked_context = getCurrentContext();
333  ContextDirectory* clicked_directory = getCurrentItem()->directory();
334 
335  if (!clicked_context && !clicked_directory) {
336  context_menu.exec(mContextTreeView->viewport()->mapToGlobal(point));
337  return;
338  }
339 
340  if (clicked_index.isValid() && clicked_context)
341  {
342  context_menu.addAction(mOpenAction);
343  context_menu.addAction(mDuplicateAction);
344  context_menu.addAction(mRenameAction);
345  context_menu.addAction(mDeleteAction);
346  }
347 
348  if (clicked_index.isValid() && clicked_directory)
349  {
350  context_menu.addAction(mDeleteAction);
351  context_menu.addAction(mRenameAction);
352  }
353 
354  context_menu.exec(mContextTreeView->viewport()->mapToGlobal(point));
355  }
356 
358  {
359  enableSearchbar(mContextTreeProxyModel->rowCount() > 0);
360  }
361 
363  {
364  if (mSearchbar->filterApplied() && mSearchbar->isVisible())
365  mSearchAction->setIcon(gui_utility::getStyledSvgIcon(mSearchActiveIconStyle, mSearchIconPath));
366  else
367  mSearchAction->setIcon(gui_utility::getStyledSvgIcon(mSearchIconStyle, mSearchIconPath));
368  }
369 
371  {
372  const QModelIndex source_model_index = mContextTreeModel->getIndexFromItem(static_cast<BaseTreeItem*>(item));
373  const QModelIndex proxy_model_index = mContextTreeProxyModel->mapFromSource(source_model_index);
374 
375  if(proxy_model_index.isValid())
376  mContextTreeView->setCurrentIndex(proxy_model_index);
377  else
378  mContextTreeView->clearSelection();
379  }
380 
382  {
383  const QModelIndex source_model_index = mContextTreeModel->getIndexFromContext(context);
384  const QModelIndex proxy_model_index = mContextTreeProxyModel->mapFromSource(source_model_index);
385 
386  if(proxy_model_index.isValid())
387  mContextTreeView->setCurrentIndex(proxy_model_index);
388  else
389  mContextTreeView->clearSelection();
390  }
391 
393  {
394  QModelIndex proxy_model_index = mContextTreeView->currentIndex();
395  QModelIndex source_model_index = mContextTreeProxyModel->mapToSource(proxy_model_index);
396 
397  return mContextTreeModel->getContext(source_model_index);
398  }
399 
401  {
402  QModelIndex proxy_model_index = mContextTreeView->currentIndex();
403  QModelIndex source_model_index = mContextTreeProxyModel->mapToSource(proxy_model_index);
404 
405  BaseTreeItem* currentItem = mContextTreeModel->getItemFromIndex(source_model_index);
406  if (currentItem != mContextTreeModel->getRootItem())
407  return static_cast<ContextTreeItem*>(currentItem);
408 
409  return nullptr;
410  }
411 
413  {
414  toolbar->addAction(mNewDirectoryAction);
415  toolbar->addAction(mNewViewAction);
416  toolbar->addAction(mOpenAction);
417  toolbar->addAction(mDuplicateAction);
418  toolbar->addAction(mRenameAction);
419  toolbar->addAction(mDeleteAction);
420  toolbar->addAction(mSearchAction);
421  }
422 
424  {
425  QString iconStyle = enable ? mSearchIconStyle : mDisabledIconStyle;
427  if (!enable && mSearchbar->isVisible())
428  {
429  mSearchbar->hide();
430  setFocus();
431  }
433  }
434 
435  void ContextManagerWidget::setToolbarButtonsEnabled(bool enabled)
436  {
437  mOpenAction->setEnabled(enabled);
438  mRenameAction->setEnabled(enabled);
439  mDuplicateAction->setEnabled(enabled);
440  mDeleteAction->setEnabled(enabled);
441 
442  if(enabled)
443  {
444  mOpenAction->setIcon(gui_utility::getStyledSvgIcon(mOpenIconStyle, mOpenIconPath));
445  mRenameAction->setIcon(gui_utility::getStyledSvgIcon(mRenameIconStyle, mRenameIconPath));
446  mDuplicateAction->setIcon(gui_utility::getStyledSvgIcon(mDuplicateIconStyle, mDuplicateIconPath));
447  mDeleteAction->setIcon(gui_utility::getStyledSvgIcon(mDeleteIconStyle, mDeleteIconPath));
448  }
449  else
450  {
451  mOpenAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle, mOpenIconPath));
452  mRenameAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle, mRenameIconPath));
453  mDuplicateAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle, mDuplicateIconPath));
454  mDeleteAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle, mDeleteIconPath));
455  }
456  }
457 
458  QList<QShortcut*> ContextManagerWidget::createShortcuts()
459  {
462 
463  QList<QShortcut*> list;
464  list.append(mSearchShortcut);
465 
466  return list;
467  }
468 
469  void ContextManagerWidget::toggleSearchbar()
470  {
471  if (!mSearchAction->isEnabled())
472  return;
473 
474  if (mSearchbar->isHidden())
475  {
476  mSearchbar->show();
477  mSearchbar->setFocus();
478  }
479  else
480  {
481  mSearchbar->hide();
482  setFocus();
483  }
484  }
485 
487  {
488  return mDisabledIconStyle;
489  }
490 
492  {
493  return mNewViewIconPath;
494  }
495 
497  {
498  return mNewDirIconPath;
499  }
500 
502  {
503  return mNewViewIconStyle;
504  }
505 
507  {
508  return mRenameIconPath;
509  }
510 
512  {
513  return mRenameIconStyle;
514  }
515 
517  {
518  return mDuplicateIconPath;
519  }
520 
522  {
523  return mDuplicateIconStyle;
524  }
525 
527  {
528  return mDeleteIconPath;
529  }
530 
532  {
533  return mDeleteIconStyle;
534  }
535 
537  {
538  return mOpenIconPath;
539  }
540 
542  {
543  return mOpenIconStyle;
544  }
545 
547  {
548  return mSearchIconPath;
549  }
550 
552  {
553  return mSearchIconStyle;
554  }
555 
557  {
558  return mSearchActiveIconStyle;
559  }
560 
562  {
563  mDisabledIconStyle = style;
564  }
565 
567  {
568  mNewViewIconPath = path;
569  }
570 
572  {
573  mNewDirIconPath = path;
574  }
575 
577  {
578  mNewViewIconStyle = style;
579  }
580 
582  {
583  mRenameIconPath = path;
584  }
585 
587  {
588  mRenameIconStyle = style;
589  }
590 
592  {
593  mDuplicateIconPath = path;
594  }
595 
597  {
598  mDuplicateIconStyle = style;
599  }
600 
602  {
603  mDeleteIconPath = path;
604  }
605 
607  {
608  mDeleteIconStyle = style;
609  }
610 
612  {
613  mOpenIconPath = path;
614  }
615 
617  {
618  mOpenIconStyle = style;
619  }
620 
622  {
623  mSearchIconPath = path;
624  }
625 
627  {
628  mSearchIconStyle = style;
629  }
630 
632  {
633  mSearchActiveIconStyle = style;
634  }
635 
636  void ContextManagerWidget::handleFocusChanged(QWidget* oldWidget, QWidget* newWidget)
637  {
638  Q_UNUSED(oldWidget);
639  if(!newWidget) return;
640  if(newWidget->parent() == this)
641  {
642  mShortCutDeleteItem->setEnabled(true);
643  return;
644  }
645  else
646  {
647  mShortCutDeleteItem->setEnabled(false);
648  return;
649  }
650  }
651 }
Adds an item to a module or grouping.
(Future) Base class for all tree models related to the details widget.
QModelIndex getIndexFromItem(BaseTreeItem *item) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
BaseTreeItem * getRootItem() const
BaseTreeItem * getItemFromIndex(QModelIndex index) const
static SettingsItemKeybind * sSettingDeleteItem
Abstract class for Widgets within HAL's ContentArea.
QKeySequence mSearchKeysequence
QShortcut * mSearchShortcut
QVBoxLayout * mContentLayout
void setDuplicateIconStyle(const QString &style)
void selectViewContext(GraphContext *context)
void setSearchIconStyle(const QString &style)
void setRenameIconPath(const QString &path)
void setOpenIconPath(const QString &path)
void handleItemClicked(const QModelIndex &proxyIndex)
void setDeleteIconPath(const QString &path)
void handleItemDoubleClicked(const QModelIndex &proxyIndex)
ContextManagerWidget(GraphTabWidget *tab_view, QWidget *parent=nullptr)
void setDuplicateIconPath(const QString &path)
void setNewDirIconPath(const QString &path)
void setSearchActiveIconStyle(const QString &style)
void setRenameIconStyle(const QString &style)
void setDisabledIconStyle(const QString &path)
void setNewViewIconStyle(const QString &style)
void setOpenIconStyle(const QString &style)
void setNewViewIconPath(const QString &path)
void setSearchIconPath(const QString &path)
void setDeleteIconStyle(const QString &style)
virtual void setupToolbar(Toolbar *toolbar) override
void selectDirectory(ContextTreeItem *item)
void handleRowsInserted(const QModelIndex &parent, int first, int last)
A proxy model to filter the ContextTableModel by a given string.
void startSearch(QString text, int options) override
GraphContext * context() const
ContextDirectory * directory() const
void setCurrentDirectory(ContextTreeItem *currentItem)
void directoryCreatedSignal(ContextTreeItem *item)
QModelIndex getIndexFromContext(GraphContext *context) const
BaseTreeItem * getContext(u32 contextId) const
Checks if a given string is not empty.
Logical container for modules, gates, and nets.
Definition: graph_context.h:55
void setExclusiveModuleId(u32 id, bool emitSignal=true)
QString name() const
ContextTreeModel * getContextTreeModel() const
QVector< GraphContext * > getContexts() const
A ContentWidget that holds all GraphWidget objects (GraphView) as tabs of a QTabWidget.
void showContext(GraphContext *context)
Generic input dialog for user input.
Definition: input_dialog.h:51
void setInfoText(const QString &text)
void setInputText(const QString &text)
void addValidator(Validator *Validator)
QString textValue() const
std::string get_name() const
Definition: module.cpp:87
Module * get_top_module() const
Definition: netlist.cpp:608
virtual QList< QString > getColumnNames()
A QFrame with a QLineEdit that can be used to input a substring to search for.
Definition: searchbar.h:48
bool filterApplied()
Definition: searchbar.cpp:259
void setColumnNames(QList< QString > list)
Definition: searchbar.cpp:130
void triggerNewSearch(const QString &text, int searchOptions)
void keySequenceChanged(QKeySequence value)
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
Checks if a given string is unique compared to other given strings.
void addAction(UserAction *act)
virtual void setObject(const UserActionObject &obj)
Definition: user_action.cpp:32
The UserActionObject class represents a single object used in UserAction.
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
Definition: graphics.cpp:60
GraphContextManager * gGraphContextManager
Definition: plugin_gui.cpp:85
Netlist * gNetlist
Definition: plugin_gui.cpp:80
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
void clicked(const QModelIndex &index)
QModelIndex currentIndex() const const
void doubleClicked(const QModelIndex &index)
void setDragEnabled(bool enable)
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QItemSelectionModel * selectionModel() const const
void setCurrentIndex(const QModelIndex &index)
void setDropIndicatorShown(bool enable)
QWidget * viewport() const const
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
void setToolTip(const QString &tip)
void trigger()
void triggered(bool checked)
void focusChanged(QWidget *old, QWidget *now)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
virtual int exec()
void sectionClicked(int logicalIndex)
void setSortIndicator(int logicalIndex, Qt::SortOrder order)
void setSortIndicatorShown(bool show)
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
QModelIndexList indexes() const const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void append(const T &value)
QAction * addAction(const QString &text)
QAction * exec()
QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
bool isValid() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const const
void activated()
void setEnabled(bool enable)
void setKey(const QKeySequence &key)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const const override
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
virtual int rowCount(const QModelIndex &parent) const const override
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
void setSortRole(int role)
QString fromStdString(const std::string &str)
bool isEmpty() const const
UserRole
AscendingOrder
QAction * addAction(const QString &text)
void expand(const QModelIndex &index)
QHeaderView * header() const const
virtual QModelIndex indexAt(const QPoint &point) const const override
virtual void setModel(QAbstractItemModel *model) override
void setSortingEnabled(bool enable)
void setAcceptDrops(bool on)
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
void customContextMenuRequested(const QPoint &pos)
void ensurePolished() const const
void hide()
bool isHidden() const const
QPoint mapToGlobal(const QPoint &pos) const const
void setFocus()
void show()
void setSizePolicy(QSizePolicy)
QStyle * style() const const
bool isVisible() const const
void setWindowTitle(const QString &)