mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Re-organize and simplify now.
This commit is contained in:
parent
ae65fb2c98
commit
35fac4ab51
@ -237,19 +237,22 @@ void LayoutItemDelegate::drawDisplay(QPainter * painter, QStyleOptionViewItem co
|
|||||||
QSize LayoutItemDelegate::sizeHint(QStyleOptionViewItem const & opt,
|
QSize LayoutItemDelegate::sizeHint(QStyleOptionViewItem const & opt,
|
||||||
QModelIndex const & index) const
|
QModelIndex const & index) const
|
||||||
{
|
{
|
||||||
QSortFilterProxyModel const * model =
|
|
||||||
static_cast<QSortFilterProxyModel const *>(index.model());
|
|
||||||
QSize size = QItemDelegate::sizeHint(opt, index);
|
QSize size = QItemDelegate::sizeHint(opt, index);
|
||||||
|
if (!lyxrc.group_layouts)
|
||||||
|
return size;
|
||||||
|
|
||||||
// Add space for the category headers here?
|
// Add space for the category headers.
|
||||||
// Not for the standard layout though.
|
QSortFilterProxyModel const * const model =
|
||||||
QString stdCat = category(*model->sourceModel(), 0);
|
static_cast<QSortFilterProxyModel const *>(index.model());
|
||||||
QString cat = category(*index.model(), index.row());
|
QString const stdCat = category(*model->sourceModel(), 0);
|
||||||
if (lyxrc.group_layouts && stdCat != cat
|
QString const cat = category(*index.model(), index.row());
|
||||||
&& (index.row() == 0 || cat != category(*index.model(), index.row() - 1))) {
|
|
||||||
|
// 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));
|
size.setHeight(size.height() + headerHeight(opt));
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user