summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_qws.cpp
diff options
context:
space:
mode:
authorAnders Bakken <agbakken@gmail.com>2010-10-08 17:21:20 (GMT)
committerDonald Carr <donald.carr@nokia.com>2010-10-21 19:53:15 (GMT)
commitd59027e27767fde354113da26fce3f3ba279bb68 (patch)
tree773c1243b0ec75a295e78d4fa812d47727c84ff4 /src/gui/kernel/qwidget_qws.cpp
parent309ac87bb46b5db2bebba9daf6807494e60eee7a (diff)
downloadQt-d59027e27767fde354113da26fce3f3ba279bb68.zip
Qt-d59027e27767fde354113da26fce3f3ba279bb68.tar.gz
Qt-d59027e27767fde354113da26fce3f3ba279bb68.tar.bz2
Implement QWidget::metric PdmNumColors for QWS
This change is necessary for http://acid3.acidtests.org/#top to pass. Merge-request: 845 Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/gui/kernel/qwidget_qws.cpp')
-rw-r--r--src/gui/kernel/qwidget_qws.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp
index 3145136..c6cbbd0 100644
--- a/src/gui/kernel/qwidget_qws.cpp
+++ b/src/gui/kernel/qwidget_qws.cpp
@@ -1017,6 +1017,30 @@ int QWidget::metric(PaintDeviceMetric m) const
return static_cast<QWidget *>(d->parent)->metric(m);
const QScreen *screen = d->getScreen();
return qRound(screen->height() / double(screen->physicalHeight() / 25.4));
+ } else if (m == PdmNumColors) {
+ QScreen *screen = d->getScreen();
+ int ret = screen->colorCount();
+ if (!ret) {
+ const int depth = qwsDisplay()->depth();
+ switch (depth) {
+ case 1:
+ ret = 2;
+ break;
+ case 8:
+ ret = 256;
+ break;
+ case 16:
+ ret = 65536;
+ break;
+ case 24:
+ ret = 16777216;
+ break;
+ case 32:
+ ret = 2147483647;
+ break;
+ }
+ }
+ return ret;
} else {
val = QPaintDevice::metric(m);// XXX
}