Commit b9ddeaa2 authored by Robert Knight's avatar Robert Knight
Browse files

Center decoration in 'Show In Menu' column of Manage Profiles dialog. I'm...

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
parent 6db288b3
......@@ -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)
{
......
......@@ -98,6 +98,11 @@ public:
virtual bool editorEvent(QEvent* event,QAbstractItemModel* model,
const QStyleOptionViewItem& option,const QModelIndex& index);
protected:
virtual void drawDecoration(QPainter*,const QStyleOptionViewItem&,const QRect&,
const QPixmap&) const;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment