Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Color dialog for QGuiApplication (Qt 5.1) [SOLVED]
Qt 6.11 is out! See what's new in the release blog

Color dialog for QGuiApplication (Qt 5.1) [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hlhl
    wrote on last edited by
    #1

    Hello,

    I'm coding a simple (in terms of UI) application for OpenGL rendering using QGuiApplication/QWindow. Human interaction is exclusively via keyboard and mouse (i.e. no UI elements). The problem is to open a color picker/dialog when a specific key is pressed (and of course receive a QColor). Previously, using QWidgets, I would simply use QColorDialog:

    QColor color = QColorDialog::getColor();

    If there's a similar one-line approach for QWindow apps, then stop reading and please let me know what this is.

    I'm aware of a similar QtQuick color dialog, but I'm unfamiliar with QtQuick and QML. Assuming that I use the QML code provided "here":http://qt-project.org/doc/qt-5.1/qtquickdialogs/qml-qtquick-dialogs1-colordialog.html is there a simple way (i.e. few lines of code) to use this in my application? Google and the qt documentation doesn't give me a straight answer here I'm afraid.

    Furthermore, using the QML code for the simple color dialog, I get the following error: unknown component (M300) at ColorDialog, line 4. I'm not sure what or where I need to include something to get rid of this.

    SOLVED: after some reading, it turns out QQuickView can be used to run the QML application within my c++ app. It's a bit more code than the previous QWidget solution, since the colour needs to be fetched from the quit signal in the colour dialog app, but not too complicated either.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved