From 8f65a4440c0078f82f311b56200aec081a6fdd85 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 13 Jun 2012 17:28:00 -0700 Subject: [PATCH] qmlscene: add --transparent argument The option makes qmlscene request a format with alpha for the QQuickView. Change-Id: I6490e606dd0af534147de95783f3a2ddfa8c52c8 Reviewed-by: Gunnar Sletta --- tools/qmlscene/main.cpp | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 06b3c37..54713fc 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -144,6 +144,7 @@ struct Options , originalQmlRaster(false) , maximized(false) , fullscreen(false) + , transparent(false) , clip(false) , versionDetection(true) , slowAnimations(false) @@ -157,6 +158,7 @@ struct Options bool originalQmlRaster; bool maximized; bool fullscreen; + bool transparent; bool scenegraphOnGraphicsview; bool clip; bool versionDetection; @@ -336,6 +338,7 @@ static void usage() qWarning(" options:"); qWarning(" --maximized ............................... run maximized"); qWarning(" --fullscreen .............................. run fullscreen"); + qWarning(" --transparent ............................. Make the window transparent"); qWarning(" --no-multisample .......................... Disable multisampling (anti-aliasing)"); qWarning(" --no-version-detection .................... Do not try to detect the version of the .qml file"); qWarning(" --slow-animations ......................... Run all animations in slow motion"); @@ -363,6 +366,8 @@ int main(int argc, char ** argv) options.maximized = true; else if (lowerArgument == QLatin1String("--fullscreen")) options.fullscreen = true; + else if (lowerArgument == QLatin1String("--transparent")) + options.transparent = true; else if (lowerArgument == QLatin1String("--clip")) options.clip = true; else if (lowerArgument == QLatin1String("--no-version-detection")) @@ -432,6 +437,15 @@ int main(int argc, char ** argv) else qxView->setResizeMode(QQuickView::SizeRootObjectToView); + if (options.transparent) { + QSurfaceFormat surfaceFormat; + surfaceFormat.setAlphaBufferSize(8); + qxView->setFormat(surfaceFormat); + qxView->setClearBeforeRendering(true); + qxView->setClearColor(QColor(Qt::transparent)); + qxView->setWindowFlags(Qt::FramelessWindowHint); + } + window->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); if (options.fullscreen) window->showFullScreen(); -- 1.7.2.5