convert VOutline to VTreeWidget to support simple search

This commit is contained in:
Le Tan 2018-02-03 16:37:09 +08:00
parent 878a272777
commit 8158d22bb4
3 changed files with 5 additions and 6 deletions

View File

@ -11,14 +11,13 @@
extern VNote *g_vnote; extern VNote *g_vnote;
VOutline::VOutline(QWidget *parent) VOutline::VOutline(QWidget *parent)
: QTreeWidget(parent), : VTreeWidget(parent),
VNavigationMode(), VNavigationMode(),
m_muted(false) m_muted(false)
{ {
setColumnCount(1); setColumnCount(1);
setHeaderHidden(true); setHeaderHidden(true);
setSelectionMode(QAbstractItemView::SingleSelection); setSelectionMode(QAbstractItemView::SingleSelection);
setAttribute(Qt::WA_MacShowFocusRect, false);
// TODO: jump to the header when user click the same item twice. // TODO: jump to the header when user click the same item twice.
connect(this, &VOutline::currentItemChanged, connect(this, &VOutline::currentItemChanged,
@ -219,7 +218,7 @@ void VOutline::keyPressEvent(QKeyEvent *event)
break; break;
} }
QTreeWidget::keyPressEvent(event); VTreeWidget::keyPressEvent(event);
} }
void VOutline::showNavigation() void VOutline::showNavigation()

View File

@ -1,10 +1,11 @@
#ifndef VOUTLINE_H #ifndef VOUTLINE_H
#define VOUTLINE_H #define VOUTLINE_H
#include <QTreeWidget>
#include <QVector> #include <QVector>
#include <QMap> #include <QMap>
#include <QChar> #include <QChar>
#include "vtreewidget.h"
#include "vtableofcontent.h" #include "vtableofcontent.h"
#include "vnavigationmode.h" #include "vnavigationmode.h"
@ -12,7 +13,7 @@ class QLabel;
// Display table of content as a tree and enable user to click an item to // Display table of content as a tree and enable user to click an item to
// jump to that header. // jump to that header.
class VOutline : public QTreeWidget, public VNavigationMode class VOutline : public VTreeWidget, public VNavigationMode
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -5,7 +5,6 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QSet> #include <QSet>
#include <QScrollBar> #include <QScrollBar>
#include <QDebug>
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#include <QTimer> #include <QTimer>