--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -69,11 +69,18 @@
 #include "qwindow.h"
 
 #include "private/qdialog_p.h"
+#include "private/qstylehelper_p.h"
 
 #include <algorithm>
 
 QT_BEGIN_NAMESPACE
 
+static bool flyInTabletMode()
+{
+    static const QStyle::StyleHint Fly_SH_Tablet = static_cast<QStyle::StyleHint>(QStyle::SH_CustomBase + 1);
+    return QApplication::style()->styleHint(Fly_SH_Tablet);
+}
+
 namespace {
 class QColorLuminancePicker;
 class QColorPicker;
@@ -244,12 +251,15 @@
     virtual void paintCell(QPainter *, int row, int col, const QRect&);
     virtual void paintCellContents(QPainter *, int row, int col, const QRect&);
 
+    void updateCellSizes();
+
     void mousePressEvent(QMouseEvent*) override;
     void mouseReleaseEvent(QMouseEvent*) override;
     void keyPressEvent(QKeyEvent*) override;
     void focusInEvent(QFocusEvent*) override;
     void focusOutEvent(QFocusEvent*) override;
     void paintEvent(QPaintEvent *) override;
+    void changeEvent(QEvent *) override;
 
 private:
     Q_DISABLE_COPY(QWellArray)
@@ -316,18 +326,38 @@
         ,nrows(rows), ncols(cols)
 {
     setFocusPolicy(Qt::StrongFocus);
-    cellw = 28;
-    cellh = 24;
+
+    updateCellSizes();
+
     curCol = 0;
     curRow = 0;
     selCol = -1;
     selRow = -1;
 }
 
+void QWellArray::updateCellSizes()
+{
+    const int cellDistance = 6;
+    const int buttonIconSize = style()->pixelMetric(QStyle::PM_ButtonIconSize);
+    const int diff = buttonIconSize / 8;
+    const int dfw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+
+    cellw = buttonIconSize + diff + 2*dfw + cellDistance;
+    cellh = buttonIconSize - diff + 2*dfw + cellDistance;;
+}
+
+void QWellArray::changeEvent(QEvent *e)
+{
+    if (e->type() == QEvent::StyleChange)
+        updateCellSizes();
+
+    QWidget::changeEvent(e);
+}
+
 QSize QWellArray::sizeHint() const
 {
     ensurePolished();
-    return gridSize().boundedTo(QSize(640, 480));
+    return gridSize();
 }
 
 
@@ -738,6 +768,8 @@
     QColorLuminancePicker(QWidget* parent=0);
     ~QColorLuminancePicker();
 
+    QSize sizeHint() const;
+
 public slots:
     void setCol(int h, int s, int v);
     void setCol(int h, int s);
@@ -751,7 +783,7 @@
     void mousePressEvent(QMouseEvent *) override;
 
 private:
-    enum { foff = 3, coff = 4 }; //frame and contents offset
+    int foff, coff; //frame and contents offset
     int val;
     int hue;
     int sat;
@@ -763,6 +795,29 @@
     QPixmap *pix;
 };
 
+QSize QColorLuminancePicker::sizeHint() const
+{
+    int pickerWidth = -1;
+
+#if defined(QT_SMALL_COLORDIALOG)
+#  ifdef Q_WS_S60
+    const bool nonTouchUI = !S60->hasTouchscreen;
+#  elif defined Q_WS_MAEMO_5
+    const bool nonTouchUI = false;
+#  endif
+
+    QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
+    const int minDimension = qMin(screenSize.height(), screenSize.width());
+    //set picker to be finger-usable
+    pickerWidth = !nonTouchUI ? minDimension/9 : minDimension/12;
+#else
+    const int buttonIconSize = style()->pixelMetric(QStyle::PM_ButtonIconSize);
+    const int handleWidth = int(QStyleHelper::dpiScaled(5.)) + 1;
+    pickerWidth = buttonIconSize - 2 + handleWidth;
+#endif
+
+    return QSize(pickerWidth, -1);
+}
 
 int QColorLuminancePicker::y2val(int y)
 {
@@ -779,6 +834,8 @@
 QColorLuminancePicker::QColorLuminancePicker(QWidget* parent)
     :QWidget(parent)
 {
+    coff = int(QStyleHelper::dpiScaled(5.)) - 1;
+    foff = coff - 1;
     hue = 100; val = 100; sat = 100;
     pix = 0;
     //    setAttribute(WA_NoErase, true);
@@ -817,7 +874,8 @@
 
 void QColorLuminancePicker::paintEvent(QPaintEvent *)
 {
-    int w = width() - 5;
+    const int hh = QStyleHelper::dpiScaled(5.);
+    int w = width() - hh;
 
     QRect r(0, foff, w, height() - 2*foff);
     int wi = r.width() - 2;
@@ -842,8 +900,8 @@
     p.setBrush(g.foreground());
     QPolygon a;
     int y = val2y(val);
-    a.setPoints(3, w, y, w+5, y+5, w+5, y-5);
-    p.eraseRect(w, 0, 5, height());
+    a.setPoints(3, w, y, w+hh, y+hh, w+hh, y-hh);
+    p.eraseRect(w,  0, hh, height());
     p.drawPolygon(a);
 }
 
@@ -1017,6 +1075,9 @@
     void newCol(QRgb rgb);
     void currentColorChanged(const QColor &color);
 
+protected:
+    void changeEvent(QEvent *e);
+
 private slots:
     void rgbEd();
     void hsvEd();
@@ -1052,6 +1113,16 @@
     friend class QT_PREPEND_NAMESPACE(QColorDialogPrivate);
 };
 
+void QColorShower::changeEvent(QEvent *e)
+{
+    if (e->type() == QEvent::StyleChange) {
+        bool tablet = flyInTabletMode();
+        lblHtml->setVisible(!tablet);
+        htEd->setVisible(!tablet);
+    }
+    QWidget::changeEvent(e);
+}
+
 class QColorShowLabel : public QFrame
 {
     Q_OBJECT
@@ -1299,6 +1370,11 @@
     lblHtml->setBuddy(htEd);
 #endif
 
+    if (flyInTabletMode()) {
+        lblHtml->hide();
+        htEd->hide();
+    }
+
 #if QT_CONFIG(regularexpression)
     QRegularExpression regExp(QStringLiteral("#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})"));
     QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this);
@@ -1683,6 +1759,12 @@
     q->setCurrentColor(initial);
 }
 
+static void recalcBasePickerSize(QLayout *lay)
+{
+    pHeight = lay->minimumSize().height();
+    pWidth = pHeight + pHeight / 10;
+}
+
 void QColorDialogPrivate::initWidgets()
 {
     Q_Q(QColorDialog);
@@ -1722,12 +1804,20 @@
         // The screen color picker button
         screenColorPickerButton = new QPushButton();
         leftLay->addWidget(screenColorPickerButton);
+
+        recalcBasePickerSize(leftLay);
+
+        QVBoxLayout *leftLay2 = new QVBoxLayout;
+        leftLay->addLayout(leftLay2);
+
         lblScreenColorInfo = new QLabel(QLatin1String("\n"));
-        leftLay->addWidget(lblScreenColorInfo);
+        if (flyInTabletMode())
+            lblScreenColorInfo->hide();
+        leftLay2->addWidget(lblScreenColorInfo);
         q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor()));
 #endif
 
-        leftLay->addStretch();
+        leftLay2->addStretch();
 
         custom = new QColorWell(q, customColorRows, colorColumns, QColorDialogOptions::customColors());
         custom->setAcceptDrops(true);
@@ -1745,12 +1835,12 @@
 #ifndef QT_NO_SHORTCUT
         lblCustomColors->setBuddy(custom);
 #endif
-        leftLay->addWidget(lblCustomColors);
-        leftLay->addWidget(custom);
+        leftLay2->addWidget(lblCustomColors);
+        leftLay2->addWidget(custom);
 
         addCusBt = new QPushButton(q);
         QObject::connect(addCusBt, SIGNAL(clicked()), q, SLOT(_q_addCustom()));
-        leftLay->addWidget(addCusBt);
+        leftLay2->addWidget(addCusBt);
     } else {
         // better color picker size for small displays
 #if defined(QT_SMALL_COLORDIALOG)
@@ -1788,10 +1878,10 @@
     cLay->addSpacing(lumSpace);
 
     lp = new QColorLuminancePicker(q);
+    lp->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
 #if defined(QT_SMALL_COLORDIALOG)
     lp->hide();
 #else
-    lp->setFixedWidth(20);
     pickLay->addSpacing(10);
     pickLay->addWidget(lp);
     pickLay->addStretch();
@@ -2203,6 +2293,8 @@
     Q_D(QColorDialog);
     if (e->type() == QEvent::LanguageChange)
         d->retranslateStrings();
+    else if (e->type() == QEvent::StyleChange)
+        d->lblScreenColorInfo->setVisible(!flyInTabletMode());
     QDialog::changeEvent(e);
 }
 
