summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-09-08 18:47:06 +0200
committerVolker Krause <[email protected]>2017-09-08 19:06:32 +0200
commitff3be446c3256a0717d1c4d2e1da7584e487b96d (patch)
tree56c54b673cc753c4776b1a2cb5a9f1943b733928
parenta5f17d6168eebd00158f676e01bccd97645545d5 (diff)
Properly sync row heights between calendar list and timeline view
-rw-r--r--src/timeline/timelineview.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/timeline/timelineview.cpp b/src/timeline/timelineview.cpp
index 7d69198..b08c018 100644
--- a/src/timeline/timelineview.cpp
+++ b/src/timeline/timelineview.cpp
@@ -231,6 +231,7 @@ TimelineView::TimelineView(QWidget *parent)
d->mLeftView->setHeaderLabel(i18n("Calendar"));
d->mLeftView->setRootIsDecorated(false);
d->mLeftView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ d->mLeftView->setUniformRowHeights(true);
d->mGantt = new KGantt::GraphicsView();
splitter->addWidget(d->mLeftView);
@@ -240,7 +241,11 @@ TimelineView::TimelineView(QWidget *parent)
QStandardItemModel *model = new QStandardItemModel(this);
d->mRowController = new RowController;
- d->mRowController->setRowHeight(fontMetrics().height()); //TODO: detect
+
+ QStyleOptionViewItem opt;
+ opt.initFrom(d->mLeftView);
+ const auto h = d->mLeftView->style()->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), d->mLeftView).height();
+ d->mRowController->setRowHeight(h);
d->mRowController->setModel(model);
d->mGantt->setRowController(d->mRowController);