Optimization line color combobox for Mac.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-01 17:13:57 +02:00
parent 49dc9f7700
commit 477a95798a
2 changed files with 15 additions and 3 deletions

View File

@ -75,12 +75,17 @@ QWidget *VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionVie
Q_UNUSED(options);
Q_UNUSED(delegate);
QComboBox* tmpEditor = new QComboBox(parent);
tmpEditor->clear();
int size = tmpEditor->iconSize().height();
// On Mac pixmap should be little bit smaller.
#if defined(Q_OS_MAC)
size -= 2; // Two pixels should be enough.
#endif //defined(Q_OS_MAC)
QMap<QString, QString>::const_iterator i = colors.constBegin();
while (i != colors.constEnd())
{
QPixmap pix(16, 16);
QPixmap pix(size, size);
pix.fill(QColor(i.key()));
tmpEditor->addItem(QIcon(pix), i.value(), QVariant(i.key()));
++i;

View File

@ -200,11 +200,18 @@ void DialogTool::FillComboBoxLineColors(QComboBox *box) const
{
SCASSERT(box != nullptr);
box->clear();
int size = box->iconSize().height();
// On Mac pixmap should be little bit smaller.
#if defined(Q_OS_MAC)
size -= 2; // Two pixels should be enough.
#endif //defined(Q_OS_MAC)
const QMap<QString, QString> map = VAbstractTool::ColorsList();
QMap<QString, QString>::const_iterator i = map.constBegin();
while (i != map.constEnd())
{
QPixmap pix(16, 16);
QPixmap pix(size, size);
pix.fill(QColor(i.key()));
box->addItem(QIcon(pix), i.value(), QVariant(i.key()));
++i;