From 0e0606a049891c1fbe5910d5bc2ca91810a949f9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 8 Jun 2017 12:36:57 +0200 Subject: qmlscene: add an option to request core profile contexts Helps for example to launch the qtgraphicaleffects testbed with a core profile context and thus exercise that path. Change-Id: Ief436ee5221e59d8a14ad74f27583b68e61eb056 Reviewed-by: Friedemann Kleint Reviewed-by: Joni Poikelin Reviewed-by: Shawn Rutledge Reviewed-by: Robin Burchell --- tools/qmlscene/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 6ce676456c..f411c6becc 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -156,6 +156,7 @@ struct Options , quitImmediately(false) , resizeViewToRootItem(false) , multisample(false) + , coreProfile(false) , verbose(false) , applicationType(DefaultQmlApplicationType) { @@ -176,6 +177,7 @@ struct Options bool quitImmediately; bool resizeViewToRootItem; bool multisample; + bool coreProfile; bool verbose; QVector applicationAttributes; QString translationFile; @@ -359,6 +361,7 @@ static void usage() puts(" --fullscreen ..................... Run fullscreen"); puts(" --transparent .................... Make the window transparent"); puts(" --multisample .................... Enable multisampling (OpenGL anti-aliasing)"); + puts(" --core-profile ................... Request a core profile OpenGL context"); puts(" --no-version-detection ........... Do not try to detect the version of the .qml file"); puts(" --slow-animations ................ Run all animations in slow motion"); puts(" --resize-to-root ................. Resize the window to the size of the root item"); @@ -523,6 +526,8 @@ int main(int argc, char ** argv) options.resizeViewToRootItem = true; else if (lowerArgument == QLatin1String("--multisample")) options.multisample = true; + else if (lowerArgument == QLatin1String("--core-profile")) + options.coreProfile = true; else if (lowerArgument == QLatin1String("--verbose")) options.verbose = true; else if (lowerArgument == QLatin1String("-i") && i + 1 < size) @@ -641,6 +646,10 @@ int main(int argc, char ** argv) window->setColor(QColor(Qt::transparent)); window->setFlags(Qt::FramelessWindowHint); } + if (options.coreProfile) { + surfaceFormat.setVersion(4, 1); + surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + } window->setFormat(surfaceFormat); if (window->flags() == Qt::Window) // Fix window flags unless set by QML. -- cgit v1.2.3