From 35fac4ab51e9f612c5d2fe8a9a04b684249d20b6 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Mon, 15 Oct 2018 22:52:53 -0400 Subject: [PATCH] Re-organize and simplify now. --- src/frontends/qt4/LayoutBox.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp index 992a4bf730..66556d99e1 100644 --- a/src/frontends/qt4/LayoutBox.cpp +++ b/src/frontends/qt4/LayoutBox.cpp @@ -237,19 +237,22 @@ void LayoutItemDelegate::drawDisplay(QPainter * painter, QStyleOptionViewItem co QSize LayoutItemDelegate::sizeHint(QStyleOptionViewItem const & opt, QModelIndex const & index) const { - QSortFilterProxyModel const * model = - static_cast(index.model()); QSize size = QItemDelegate::sizeHint(opt, index); + if (!lyxrc.group_layouts) + return size; - // Add space for the category headers here? - // Not for the standard layout though. - QString stdCat = category(*model->sourceModel(), 0); - QString cat = category(*index.model(), index.row()); - if (lyxrc.group_layouts && stdCat != cat - && (index.row() == 0 || cat != category(*index.model(), index.row() - 1))) { - size.setHeight(size.height() + headerHeight(opt)); - } + // Add space for the category headers. + QSortFilterProxyModel const * const model = + static_cast(index.model()); + QString const stdCat = category(*model->sourceModel(), 0); + QString const cat = category(*index.model(), index.row()); + + // There is no header for the stuff at the top. + if (stdCat == cat) + return size; + if (index.row() == 0 || cat != category(*index.model(), index.row() - 1)) + size.setHeight(size.height() + headerHeight(opt)); return size; } -- 2.39.2