本文整理汇总了C++中QWidget::depth方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::depth方法的具体用法?C++ QWidget::depth怎么用?C++ QWidget::depth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidget
的用法示例。
在下文中一共展示了QWidget::depth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postConfigure
void Colors::postConfigure()
{
if (!Colors::noAdapt){
QWidget w;
if (w.depth() < 16){
Colors::useEightBitPalette = true;
Colors::adapted = true;
if (Colors::verbose)
qDebug() << "- Adapt: Color depth less than 16 bit. Using 8 bit palette";
}
if (!Colors::xRenderPresent){
Colors::setLowSettings();
Colors::adapted = true;
if (Colors::verbose)
qDebug() << "- Adapt: X renderer not present. Using low settings";
}
}
if (!Colors::openGlRendering && !Colors::softwareRendering){
// The user has not decided rendering system. So we do it instead:
if (Colors::openGlAvailable)
Colors::openGlRendering = true;
else
Colors::softwareRendering = true;
}
}
示例2: screenDepthPerComponent
int screenDepthPerComponent(Widget* w)
{
#if HAVE(QT5)
int depth = QGuiApplication::primaryScreen()->depth();
// FIXME: Use widget's screen
Q_UNUSED(w);
#else
int depth = QApplication::desktop()->screen(0)->depth();
if (w) {
QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
if (client) {
QWidget* view = client->ownerWidget();
if (view)
depth = view->depth();
}
}
#endif
// An interface to establish the actual number of bits per color
// doesn't exist in Qt, or probably at all, so use common-sense
// values for each screen depth and assume RGB/RGBA where appropriate.
// Per http://www.w3.org/TR/css3-mediaqueries/#color, 'If different color
// components are represented by different number of bits, the smallest
// number is used.'
switch (depth) {
case 8:
return 2;
case 32:
return 8;
default:
return depth / 3;
}
}
示例3: screenDepth
int screenDepth(const Page* page)
{
QWidget* qw = qwidgetForPage(page);
if (!qw)
return 32;
return qw->depth();
}
示例4: screenDepthPerComponent
int screenDepthPerComponent(Widget* w)
{
if (w) {
QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
if (client) {
QWidget* view = client->ownerWidget();
if (view)
return view->depth();
}
}
return QApplication::desktop()->screen(0)->depth();
}
示例5: detectSystemResources
void Colors::detectSystemResources()
{
#ifndef QT_NO_OPENGL
if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)
Colors::glVersion = "2.0 or higher";
else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_5)
Colors::glVersion = "1.5";
else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_4)
Colors::glVersion = "1.4";
else if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_3)
Colors::glVersion = "1.3 or lower";
if (Colors::verbose)
qDebug() << "- OpenGL version:" << Colors::glVersion;
QGLWidget glw;
if (!QGLFormat::hasOpenGL()
|| !glw.format().directRendering()
|| !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_5)
|| glw.depth() < 24
)
#else
if (Colors::verbose)
qDebug() << "- OpenGL not supported by current build of Qt";
#endif
{
Colors::openGlAwailable = false;
if (Colors::verbose)
qDebug("- OpenGL not recommended on this system");
}
#if defined(Q_WS_WIN)
Colors::direct3dAwailable = false; // for now.
#endif
#if defined(Q_WS_X11)
// check if X render is present:
QPixmap tmp(1, 1);
if (!tmp.x11PictureHandle() && tmp.paintEngine()->type() == QPaintEngine::X11){
Colors::xRenderPresent = false;
if (Colors::verbose)
qDebug("- X render not present");
}
#endif
QWidget w;
if (Colors::verbose)
qDebug() << "- Color depth: " << QString::number(w.depth());
}
示例6: keyPressEvent
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape){
this->loop = false;
QApplication::quit();
}
else if (event->key() == Qt::Key_F1){
QString s("");
s += "Rendering system: ";
if (Colors::openGlRendering)
s += "OpenGL";
else
s += "software";
s += "\nAdapt: ";
s += Colors::noAdapt ? "off" : "on";
s += "\nAdaption occurred: ";
s += Colors::adapted ? "yes" : "no";
s += "\nOpenGL version: ";
s += Colors::glVersion;
QWidget w;
s += "\nColor bit depth: ";
s += QString::number(w.depth());
s += "\nWanted FPS: ";
s += QString::number(Colors::fps);
s += "\nBenchmarked FPS: ";
s += Colors::benchmarkFps != -1 ? QString::number(Colors::benchmarkFps) : "not calculated";
s += "\nAnimations: ";
s += Colors::noAnimations ? "off" : "on";
s += "\nBlending: ";
s += Colors::useEightBitPalette ? "off" : "on";
s += "\nTicker: ";
s += Colors::noTicker ? "off" : "on";
s += "\nPixmaps: ";
s += Colors::usePixmaps ? "on" : "off";
s += "\nRescale images on resize: ";
s += Colors::noRescale ? "off" : "on";
s += "\nTimer based updates: ";
s += Colors::noTimerUpdate ? "off" : "on";
s += "\nSeparate loop: ";
s += Colors::useLoop ? "yes" : "no";
s += "\nScreen sync: ";
s += Colors::noScreenSync ? "no" : "yes";
QMessageBox::information(0, QString("Current configuration"), s);
}
QGraphicsView::keyPressEvent(event);
}
示例7: postConfigure
void Colors::postConfigure()
{
if (!Colors::noAdapt){
QWidget w;
if (w.depth() < 16){
Colors::useEightBitPalette = true;
Colors::adapted = true;
if (Colors::verbose)
qDebug() << "- Adapt: Color depth less than 16 bit. Using 8 bit palette";
}
if (!Colors::xRenderPresent){
Colors::setLowSettings();
Colors::adapted = true;
if (Colors::verbose)
qDebug() << "- Adapt: X renderer not present. Using low settings";
}
}
#if !defined(Q_WS_WIN)
if (Colors::direct3dRendering){
Colors::direct3dRendering = false;
qDebug() << "- WARNING: Direct3D specified, but not supported on this platform";
}
#endif
if (!Colors::openGlRendering && !Colors::direct3dRendering && !Colors::softwareRendering){
// The user has not decided rendering system. So we do it instead:
#if defined(Q_WS_WIN)
if (Colors::direct3dAwailable)
Colors::direct3dRendering = true;
else
#endif
if (Colors::openGlAwailable)
Colors::openGlRendering = true;
else
Colors::softwareRendering = true;
}
}