16 #include <QApplication>
17 #include <QHBoxLayout>
23 #include <QModelIndex>
24 #include <QToolButton>
26 #include <QVBoxLayout>
28 #include "../backend/bookshelfmodel/btbookshelffiltermodel.h"
29 #include "../backend/bookshelfmodel/btbookshelftreemodel.h"
30 #include "../backend/config/btconfig.h"
31 #include "../util/btassert.h"
32 #include "../util/btconnect.h"
33 #include "../util/cresmgr.h"
43 , m_treeModel(nullptr)
44 , m_leftCornerWidget(nullptr)
45 , m_rightCornerWidget(nullptr)
72 static_cast<void *
>(module)));
125 m_treeView->setRootIsDecorated(!grouping.isEmpty());
138 QVBoxLayout *layout(
new QVBoxLayout);
139 layout->setContentsMargins(0, 8, 0, 0);
142 m_toolBar->setContentsMargins(3, 0, 0, 0);
172 m_groupingButton->setToolTip(tr(
"Change the grouping of items in the bookshelf."));
179 if (event->type() == QEvent::KeyPress) {
180 QKeyEvent *e =
static_cast<QKeyEvent*
>(event);
196 const QModelIndex& index,
198 QStringList * expandedPaths) {
199 QString path = index.data(Qt::DisplayRole).toString();
201 if (! prefix.isEmpty())
202 path = QStringLiteral(
"%1/%2").arg(prefix, path);
203 expandedPaths->append(path);
206 for (
int row = 0; row < rows; ++row) {
213 if (nodeList.isEmpty())
215 QString firstNode = nodeList.first();
216 QStringList remainingNodes = nodeList;
217 remainingNodes.removeFirst();
219 for (
int row = 0; row < rows; ++row) {
221 QString text = childIndex.data(Qt::DisplayRole).toString();
222 if (firstNode == text) {
233 QStringLiteral(
"GUI/MainWindow/Docks/Bookshelf/expandPaths"));
235 for (
auto const & path : paths) {
236 QStringList nodeList = path.split(
'/');
247 QStringLiteral(
"GUI/MainWindow/Docks/Bookshelf/expandPaths"),
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
void setShowHidden(bool show)
void setNameFilterFixedString(QString const &nameFilter)
void setGroupingOrder(const BtBookshelfTreeModel::Grouping &groupingOrder, bool emitSignal=true)
void setSourceModel(std::shared_ptr< QAbstractItemModel > sourceModel)
void contextMenuActivated(QPoint pos)
void moduleContextMenuActivated(CSwordModuleInfo *item, QPoint pos)
T value(QString const &key, T const &defaultValue=T()) const
Returns the settings value for the given global key.
void setValue(QString const &key, T const &value)
Sets a value for a key.