* draw the separator as a menu separator

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23475 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-03-05 12:02:00 +00:00
parent 2280e16db4
commit 1247839690

View File

@ -262,7 +262,11 @@ public:
painter->eraseRect(option.rect);
combo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, combo->view());
painter->restore();
// don't draw string for separator
if (opt.menuItemType == QStyleOptionMenuItem::Separator)
return;
// Draw the rich text.
painter->save();
QColor col = opt.palette.text().color();
@ -334,14 +338,18 @@ private:
menuOption.state |= QStyle::State_Selected;
menuOption.checkType = QStyleOptionMenuItem::NonExclusive;
menuOption.checked = combo->currentIndex() == index.row();
menuOption.menuItemType = QStyleOptionMenuItem::Normal;
menuOption.text = index.model()->data(index, Qt::DisplayRole).toString()
.replace(QLatin1Char('&'), QLatin1String("&&"));
if (menuOption.text.left(2) == "--")
menuOption.menuItemType = QStyleOptionMenuItem::Separator;
else
menuOption.menuItemType = QStyleOptionMenuItem::Normal;
menuOption.tabWidth = 0;
menuOption.menuRect = option.rect;
menuOption.rect = option.rect;
menuOption.font = combo->font();
menuOption.fontMetrics = QFontMetrics(menuOption.font);
return menuOption;
}
};