15 #include <QAbstractItemModel>
17 #include <QModelIndex>
18 #include <QMouseEvent>
24 #include "../backend/bookshelfmodel/btbookshelfmodel.h"
25 #include "../util/btconnect.h"
31 setHeaderHidden(
true);
42 [
this](QModelIndex
const & index) {
43 if (
auto *
const module =
getModule(index))
47 [
this](QModelIndex
const & index)
52 void *
const module = model()->data(index,
58 switch (event->key()) {
60 scrollTo(currentIndex());
63 QRect itemRect(visualRect(currentIndex()));
64 QPoint p(viewport()->mapToGlobal(itemRect.bottomLeft()));
76 QModelIndex i(currentIndex());
82 setExpanded(i, !isExpanded(i));
88 QTreeView::keyPressEvent(event);
94 if (event->buttons() == Qt::RightButton) {
95 QModelIndex clickedItemIndex(indexAt(event->pos()));
96 if (clickedItemIndex.isValid()) {
97 setCurrentIndex(clickedItemIndex);
109 QTreeView::mousePressEvent(event);
void moduleHovered(CSwordModuleInfo *item)
void moduleActivated(CSwordModuleInfo *item)
void mousePressEvent(QMouseEvent *event) override
void contextMenuActivated(QPoint pos)
void moduleContextMenuActivated(CSwordModuleInfo *item, QPoint pos)
void keyPressEvent(QKeyEvent *event) override
CSwordModuleInfo * getModule(const QModelIndex &index) const
BtBookshelfView(QWidget *parent=nullptr)