1
#ifndef __DOC_LIST_PLUGIN_PANEL_H__
2
#define __DOC_LIST_PLUGIN_PANEL_H__
4
#include <QContextMenuEvent>
10
#include <QTreeWidget>
12
static const int BtnSize = 24;
14
class FilterLineEdit : public QWidget {
16
FilterLineEdit(QWidget* parent = 0) : QWidget(parent) {
17
lineEd_ = new QLineEdit("", this);
18
clearBtn_ = new QPushButton(QIcon(":clear"), "", this);
19
clearBtn_->setFlat(true);
20
clearBtn_->setFocusPolicy(Qt::NoFocus);
21
clearBtn_->setCursor(Qt::ArrowCursor);
22
clearBtn_->setMaximumWidth(BtnSize);
24
QHBoxLayout* hBox = new QHBoxLayout(this);
27
hBox->addWidget(lineEd_);
28
#if QT_VERSION >= 0x040500
29
lineEd_->setTextMargins(0, 0, BtnSize, 0);
30
clearBtn_->setParent(lineEd_);
32
hBox->addWidget(clearBtn_);
36
#if QT_VERSION >= 0x040500
37
virtual void resizeEvent(QResizeEvent*) {
38
clearBtn_->setGeometry(lineEd_->width() - BtnSize, (lineEd_->height() - BtnSize) / 2, BtnSize, BtnSize);
43
QPushButton* clearBtn_;
46
class TreeWidget : public QTreeWidget {
48
TreeWidget() : QTreeWidget() {
49
contextMenu_ = new QMenu();
50
// contextMenu_->addAction(CommandStorage::instance()->action(Juff::FileSave));
51
// contextMenu_->addAction(CommandStorage::instance()->action(Juff::FileClose));
53
virtual ~TreeWidget() {
57
virtual void contextMenuEvent(QContextMenuEvent * event) {
58
contextMenu_->popup(event->globalPos());
66
class DocListPanel : public QWidget {
71
// Yes, it's an incapsulation violation but I'll better keep
72
// it this way (for now) than introduce either 5 additional
73
// methods to manage these members or two methods disclosing them
74
// completely (which has no difference between it and currently
75
// selected approach).
77
FilterLineEdit* filter_;
80
void filterItems(const QString& text);