summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-12-20 23:04:58 +0000
committerSérgio Martins <sergio.martins@kdab.com>2014-12-22 15:46:47 +0100
commit66a8be268142d4f3272f54093299087289f530b9 (patch)
treeeeeb51c4d01f97a88ede6f1fcc5e072536d92381 /src
parentc0853825551ec34f4052e8a86f1c47be7fb5b1d7 (diff)
QColorDialog: Fix a few layouting issues.
Fixes combo-boxes being too big and some alignment issues that were not present in Qt4. See screenshot in JIRA task. Tested with QT_SMALL_COLORDIALOG too. Task-number: QTBUG-43501 Change-Id: I2aefb64be1c5f3c4894149d85e1a12c9c0cc3d62 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index ee3ece2d77..f04e5b9ea6 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -972,6 +972,7 @@ private:
QColorShowLabel *lab;
bool rgbOriginal;
QColorDialog *colorDialog;
+ QGridLayout *gl;
friend class QColorDialog;
friend class QColorDialogPrivate;
@@ -1099,7 +1100,7 @@ QColorShower::QColorShower(QColorDialog *parent)
curCol = qRgb(255, 255, 255);
curQColor = Qt::white;
- QGridLayout *gl = new QGridLayout(this);
+ gl = new QGridLayout(this);
gl->setMargin(gl->spacing());
lab = new QColorShowLabel(this);
@@ -1277,10 +1278,16 @@ QColorShower::QColorShower(QColorDialog *parent)
#else
htEd->setReadOnly(true);
#endif
+ htEd->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
lblHtml->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+#if defined(QT_SMALL_COLORDIALOG)
+ gl->addWidget(lblHtml, 5, 0);
+ gl->addWidget(htEd, 5, 1, 1, /*colspan=*/ 2);
+#else
gl->addWidget(lblHtml, 5, 1);
- gl->addWidget(htEd, 5, 2);
+ gl->addWidget(htEd, 5, 2, 1, /*colspan=*/ 3);
+#endif
connect(hEd, SIGNAL(valueChanged(int)), this, SLOT(hsvEd()));
connect(sEd, SIGNAL(valueChanged(int)), this, SLOT(hsvEd()));
@@ -1742,7 +1749,9 @@ void QColorDialogPrivate::initWidgets()
lp->hide();
#else
lp->setFixedWidth(20);
+ pickLay->addSpacing(10);
pickLay->addWidget(lp);
+ pickLay->addStretch();
#endif
QObject::connect(cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int)));
@@ -1751,6 +1760,7 @@ void QColorDialogPrivate::initWidgets()
rightLay->addStretch();
cs = new QColorShower(q);
+ pickLay->setMargin(cs->gl->margin());
QObject::connect(cs, SIGNAL(newCol(QRgb)), q, SLOT(_q_newColorTypedIn(QRgb)));
QObject::connect(cs, SIGNAL(currentColorChanged(QColor)),
q, SIGNAL(currentColorChanged(QColor)));
@@ -1760,6 +1770,7 @@ void QColorDialogPrivate::initWidgets()
topLay->addWidget(cs);
#else
rightLay->addWidget(cs);
+ leftLay->addSpacing(cs->gl->margin());
#endif
buttons = new QDialogButtonBox(q);