本文整理汇总了C++中QScreen::colorCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QScreen::colorCount方法的具体用法?C++ QScreen::colorCount怎么用?C++ QScreen::colorCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScreen
的用法示例。
在下文中一共展示了QScreen::colorCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metric
int QWidget::metric(PaintDeviceMetric m) const
{
Q_D(const QWidget);
int val;
if (m == PdmWidth) {
val = data->crect.width();
} else if (m == PdmWidthMM) {
const QScreen *screen = d->getScreen();
val = data->crect.width() * screen->physicalWidth() / screen->width();
} else if (m == PdmHeight) {
val = data->crect.height();
} else if (m == PdmHeightMM) {
const QScreen *screen = d->getScreen();
val = data->crect.height() * screen->physicalHeight() / screen->height();
} else if (m == PdmDepth) {
return qwsDisplay()->depth();
} else if (m == PdmDpiX || m == PdmPhysicalDpiX) {
if (d->extra && d->extra->customDpiX)
return d->extra->customDpiX;
else if (d->parent)
return static_cast<QWidget *>(d->parent)->metric(m);
const QScreen *screen = d->getScreen();
return qRound(screen->width() / double(screen->physicalWidth() / 25.4));
} else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
if (d->extra && d->extra->customDpiY)
return d->extra->customDpiY;
else if (d->parent)
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
}
return val;
}