From 66a8be268142d4f3272f54093299087289f530b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 20 Dec 2014 23:04:58 +0000 Subject: 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 --- src/widgets/dialogs/qcolordialog.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3