]> git.lyx.org Git - features.git/commitdiff
Re-organize and simplify now.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 16 Oct 2018 02:52:53 +0000 (22:52 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Fri, 19 Oct 2018 01:49:31 +0000 (21:49 -0400)
src/frontends/qt4/LayoutBox.cpp

index 992a4bf730b138d634043acf2b6cbb5edf973f70..66556d99e1e63cff190c0953c32d497f657c4eb8 100644 (file)
@@ -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<QSortFilterProxyModel const *>(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<QSortFilterProxyModel const *>(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;
 }