Use a splitter between Group and Entry View.

This commit is contained in:
Felix Geyer 2010-08-24 23:06:35 +02:00
parent 621b367f45
commit 194a081bd7
3 changed files with 15 additions and 5 deletions

View File

@ -18,6 +18,7 @@
#include "DatabaseWidget.h"
#include <QtGui/QHBoxLayout>
#include <QtGui/QSplitter>
#include "EntryView.h"
#include "GroupView.h"
@ -25,13 +26,17 @@
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
: QWidget(parent)
{
m_groupView = new GroupView(db);
m_entryView = new EntryView();
QLayout* layout = new QHBoxLayout(this);
QSplitter* splitter = new QSplitter(this);
m_groupView = new GroupView(db, splitter);
m_entryView = new EntryView(splitter);
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(m_groupView);
layout->addWidget(m_entryView);
splitter->addWidget(m_groupView);
splitter->addWidget(m_entryView);
layout->addWidget(splitter);
setLayout(layout);
}

View File

@ -24,6 +24,9 @@ EntryView::EntryView(QWidget* parent)
{
m_model = new EntryModel(this);
QTreeView::setModel(m_model);
setUniformRowHeights(true);
setRootIsDecorated(false);
}
void EntryView::setGroup(Group* group)

View File

@ -29,6 +29,8 @@ GroupView::GroupView(Database* db, QWidget* parent) : QTreeView(parent)
setHeaderHidden(true);
connect(this, SIGNAL(clicked(const QModelIndex&)), SLOT(emitGroupChanged(const QModelIndex&)));
setUniformRowHeights(true);
}
void GroupView::expandedChanged(const QModelIndex& index)