Color property drawing has been changed

This commit is contained in:
Arin Alexander 2018-03-29 23:18:15 +03:00
parent b65292dea8
commit 891622e2b3
2 changed files with 12 additions and 9 deletions

View File

@ -100,11 +100,12 @@ void ColorIndicator::paintEvent(QPaintEvent* event)
QPainter painter(this); QPainter painter(this);
painter.save(); painter.save();
painter.setBrush(m_color); painter.setBrush(m_color);
painter.setPen(Qt::gray); painter.setPen(Qt::transparent);
QRect rect = event->rect().adjusted(3,3,-4,-4); QRect rect = event->rect().adjusted(3,3,-4,-4);
rect.setWidth(rect.height()); rect.setWidth(rect.height());
painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::Antialiasing);
painter.drawEllipse(rect); // painter.drawEllipse(rect);
painter.drawRoundedRect(rect,2,2);
painter.restore(); painter.restore();
} }

View File

@ -60,20 +60,22 @@ bool ColorPropItem::paint(QPainter *painter, const StyleOptionViewItem &option,
painter->save(); painter->save();
QPen pen; QPen pen;
if (option.state & QStyle::State_Selected){ // if (option.state & QStyle::State_Selected){
pen.setWidth(2); // pen.setWidth(1);
pen.setColor(option.palette.brightText().color()); // pen.setColor(option.palette.brightText().color());
}else { // }else {
pen.setColor(Qt::gray); // pen.setColor(Qt::darkGray);
} // }
pen.setColor(Qt::transparent);
painter->setPen(pen); painter->setPen(pen);
painter->setBrush(propertyValue().value<QColor>()); painter->setBrush(propertyValue().value<QColor>());
QRect rect = option.rect.adjusted(4,4,-4,-6); QRect rect = option.rect.adjusted(4,4,-4,-6);
rect.setWidth(rect.height()); rect.setWidth(rect.height());
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
painter->drawEllipse(rect); painter->drawRoundedRect(rect,2,2);
// painter->drawEllipse(rect);
painter->restore(); painter->restore();
return true; return true;
} else return false; } else return false;