forked from qt-creator/qt-creator
Reuse code for open documents and open help pages panes
Change-Id: I4924e72e732eb447d2e581d60f5e4426f5ff7cb2 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -30,28 +30,14 @@
|
||||
#ifndef OPENPAGESWIDGET_H
|
||||
#define OPENPAGESWIDGET_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeView>
|
||||
#include <coreplugin/opendocumentstreeview.h>
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
namespace Internal {
|
||||
|
||||
class OpenPagesModel;
|
||||
|
||||
class OpenPagesDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenPagesDelegate(QObject *parent = 0);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
mutable QModelIndex pressedIndex;
|
||||
};
|
||||
|
||||
class OpenPagesWidget : public QTreeView
|
||||
class OpenPagesWidget : public Core::OpenDocumentsTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -70,15 +56,12 @@ signals:
|
||||
|
||||
private slots:
|
||||
void contextMenuRequested(QPoint pos);
|
||||
void handlePressed(const QModelIndex &index);
|
||||
void handleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
void handleActivated(const QModelIndex &index);
|
||||
void handleCloseActivated(const QModelIndex &index);
|
||||
void updateCloseButtonVisibility();
|
||||
|
||||
private:
|
||||
bool m_allowContextMenu;
|
||||
OpenPagesDelegate *m_delegate;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user