15 #include <QVBoxLayout>
17 #include "TreeViewContent.h"
18 #include "TreeViewHeader.h"
19 #include "AbstractTreeModel.h"
28 m_content =
new TreeViewContent(
this);
29 m_header =
new TreeViewHeader(m_content,
this);
30 connect(m_header, SIGNAL(activated()),
this, SIGNAL(activated()));
31 connect(m_content, SIGNAL(treeSelectionChanged()),
32 this, SIGNAL(selectionChanged()));
35 QVBoxLayout *layout =
new QVBoxLayout;
36 layout->addWidget(m_header);
37 layout->addWidget(m_content);
38 layout->setContentsMargins(0, 0, 0, 0);
39 layout->setSpacing(0);
45 TreeView::~TreeView() {
49 QSize TreeView::sizeHint()
const {
51 return QSize(parentWidget()->width() / 4, parentWidget()->height() / 2);
57 QFont TreeView::getContentFont()
const {
58 return m_content->font();
62 void TreeView::setModel(AbstractTreeModel *someModel) {
64 m_content->setModel(someModel);
66 connect(someModel, SIGNAL(filterProgressChanged(
int)),
67 m_header, SLOT(updateFilterProgress(
int)));
68 connect(someModel, SIGNAL(filterProgressRangeChanged(
int,
int)),
69 m_header, SLOT(updateFilterProgressRange(
int,
int)));
70 connect(someModel, SIGNAL(rebuildProgressChanged(
int)),
71 m_header, SLOT(updateRebuildProgress(
int)));
72 connect(someModel, SIGNAL(rebuildProgressRangeChanged(
int,
int)),
73 m_header, SLOT(updateRebuildProgressRange(
int,
int)));
74 connect(someModel, SIGNAL(filterCountsChanged(
int,
int)),
75 m_header, SLOT(handleFilterCountsChanged(
int,
int)));
77 connect(someModel, SIGNAL(modelModified()),
78 this, SIGNAL(selectionChanged()));
82 AbstractTreeModel *TreeView::getModel()
const {
83 return m_content->getModel();
87 bool TreeView::isActive()
const {
92 QString TreeView::getTitle()
const {
93 return m_header->getText();
97 void TreeView::setTitle(QString someTitle) {
98 m_header->setText(someTitle);
102 void TreeView::deactivate() {
107 m_header->setActive(
false);
112 void TreeView::activate() {
117 m_header->setActive(
true);
122 void TreeView::handleModelSelectionChanged() {
123 m_content->refresh();
127 void TreeView::nullify() {