|
|
|
@ -15,16 +15,15 @@ void CSVWorld::ColorPickerDelegate::paint(QPainter *painter,
|
|
|
|
|
const QStyleOptionViewItem &option,
|
|
|
|
|
const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
QRect coloredRect = getColoredRect(option);
|
|
|
|
|
QRect coloredRect(qRound(option.rect.x() + option.rect.width() / 4.0),
|
|
|
|
|
qRound(option.rect.y() + option.rect.height() / 4.0),
|
|
|
|
|
qRound(option.rect.width() / 2.0),
|
|
|
|
|
qRound(option.rect.height() / 2.0));
|
|
|
|
|
painter->save();
|
|
|
|
|
painter->fillRect(coloredRect, index.data().value<QColor>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QRect CSVWorld::ColorPickerDelegate::getColoredRect(const QStyleOptionViewItem &option) const
|
|
|
|
|
{
|
|
|
|
|
return QRect(qRound(option.rect.x() + option.rect.width() / 4.0),
|
|
|
|
|
qRound(option.rect.y() + option.rect.height() / 4.0),
|
|
|
|
|
qRound(option.rect.width() / 2.0),
|
|
|
|
|
qRound(option.rect.height() / 2.0));
|
|
|
|
|
painter->setPen(Qt::black);
|
|
|
|
|
painter->drawRect(coloredRect);
|
|
|
|
|
painter->restore();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWorld::CommandDelegate *CSVWorld::ColorPickerDelegateFactory::makeDelegate(CSMWorld::CommandDispatcher *dispatcher,
|
|
|
|
|