Center decoration in 'Show In Menu' column of Manage Profiles dialog. I'm sure there must be an easier way.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=708382
This commit is contained in:
Robert Knight
2007-09-04 17:59:52 +00:00
parent 6db288b385
commit b9ddeaa238
2 changed files with 18 additions and 0 deletions

View File

@@ -296,6 +296,19 @@ ProfileItemDelegate::ProfileItemDelegate(QObject* parent)
: QItemDelegate(parent)
{
}
// Is there a simpler way of centering the decoration than re-implementing
// drawDecoration?
void ProfileItemDelegate::drawDecoration(QPainter* painter,
const QStyleOptionViewItem& option,
const QRect& rect,const QPixmap& pixmap) const
{
QStyleOptionViewItem centeredOption(option);
centeredOption.decorationAlignment = Qt::AlignCenter;
QItemDelegate::drawDecoration(painter,
centeredOption,
QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,rect.size(),option.rect),
pixmap);
}
bool ProfileItemDelegate::editorEvent(QEvent* event,QAbstractItemModel*,
const QStyleOptionViewItem&,const QModelIndex& index)
{