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

View File

@ -1,10 +1,11 @@
#ifndef VOUTLINE_H
#define VOUTLINE_H
#include <QTreeWidget>
#include <QVector>
#include <QMap>
#include <QChar>
#include "vtreewidget.h"
#include "vtableofcontent.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
// jump to that header.
class VOutline : public QTreeWidget, public VNavigationMode
class VOutline : public VTreeWidget, public VNavigationMode
{
Q_OBJECT
public:

View File

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