15#include "TreeViewContent.h"
16#include "TreeViewHeader.h"
17#include "AbstractTreeModel.h"
26 m_content =
new TreeViewContent(
this);
27 m_header =
new TreeViewHeader(m_content,
this);
28 connect(m_header, SIGNAL(activated()),
this, SIGNAL(activated()));
29 connect(m_content, SIGNAL(treeSelectionChanged()),
30 this, SIGNAL(selectionChanged()));
33 QVBoxLayout *layout =
new QVBoxLayout;
34 layout->addWidget(m_header);
35 layout->addWidget(m_content);
36 layout->setContentsMargins(0, 0, 0, 0);
37 layout->setSpacing(0);
43 TreeView::~TreeView() {
47 QSize TreeView::sizeHint()
const {
49 return QSize(parentWidget()->width() / 4, parentWidget()->height() / 2);
55 QFont TreeView::getContentFont()
const {
56 return m_content->font();
60 void TreeView::setModel(AbstractTreeModel *someModel) {
61 m_content->setModel(someModel);
63 connect(someModel, SIGNAL(filterProgressChanged(
int)),
64 m_header, SLOT(updateFilterProgress(
int)));
65 connect(someModel, SIGNAL(filterProgressRangeChanged(
int,
int)),
66 m_header, SLOT(updateFilterProgressRange(
int,
int)));
67 connect(someModel, SIGNAL(rebuildProgressChanged(
int)),
68 m_header, SLOT(updateRebuildProgress(
int)));
69 connect(someModel, SIGNAL(rebuildProgressRangeChanged(
int,
int)),
70 m_header, SLOT(updateRebuildProgressRange(
int,
int)));
71 connect(someModel, SIGNAL(filterCountsChanged(
int,
int)),
72 m_header, SLOT(handleFilterCountsChanged(
int,
int)));
74 connect(someModel, SIGNAL(modelModified()),
75 this, SIGNAL(selectionChanged()));
79 AbstractTreeModel *TreeView::getModel()
const {
80 return m_content->getModel();
84 bool TreeView::isActive()
const {
89 QString TreeView::getTitle()
const {
90 return m_header->getText();
94 void TreeView::setTitle(QString someTitle) {
95 m_header->setText(someTitle);
99 void TreeView::deactivate() {
103 m_header->setActive(
false);
108 void TreeView::activate() {
112 m_header->setActive(
true);
117 void TreeView::handleModelSelectionChanged() {
118 m_content->refresh();
122 void TreeView::nullify() {
This is free and unencumbered software released into the public domain.