Results 1 to 7 of 7

Thread: Two independent QColorDialogs

  1. #1
    Join Date
    Feb 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Two independent QColorDialogs

    Hello, I'm a little confused on a program I'm writing
    I created a widget that has a QColorDialog pointer, when the widget starts the QColorDialog is initiated, then it is controlled by simply using the show() and hide() functions to make it appear and desappear as the user needs it, it is modaless . The problem is when I have 2 instances of that widget, when one instance opens it's QColorDialog then the other opens it's QColorDialog, it makes the first one disappear, it is as if they were both controlling the same dialog, I have read the documentation for QColorDialog and searched for this issue with no results.
    Any help appreciated, thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Two independent QColorDialogs

    This works just fine for me:

    Qt Code:
    1. #include <QtWidgets>
    2.  
    3. int main(int argc, char **argv) {
    4. QApplication app(argc, argv);
    5. d1->show();
    6. d1->move(0,0);
    7. d2->show();
    8. d2->move(d1->width(), 0);
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Two independent QColorDialogs

    This code only gives me one color dialog

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Two independent QColorDialogs

    Which version of Qt and which platform are you using? Also did you try dragging the dialog around the screen?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Two independent QColorDialogs

    Quote Originally Posted by wysota View Post
    Which version of Qt and which platform are you using? Also did you try dragging the dialog around the screen?
    I'm using Qt 5.2 on a macOSX (10.9.2) and yes I tried dragging.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Two independent QColorDialogs

    I don't have OSX so I can't try it myself but it works for me on Linux with both Qt4 and Qt5. Maybe you should try setting the option to not use the native color dialog?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Feb 2014
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Two independent QColorDialogs

    I tried to set the QColorDialog flag DontUseNativeDialog, then I opened the first dialog and clicked the close button, it closes,
    then I opened again which was a good sign, but it didn't work the third time...and there is no flag or bool I have setter to control
    this behavior, is all based in the isVisible() method.
    Then I setted an old PC I have to test it on linux... Guess what?
    It worked just fine, exactly as it was suppose to in the beginning...I also found this bug report:
    https://bugreports.qt-project.org/br...ream-issue-tab

    So I was left with a few options on how to proceed:

    1 - if the program is to run on linux and maybe windows, it is fine the way I described in the thread
    2 - on the mac the color dialog will probably be modal until I find another way

    Thanks a lot for your atention and support

Similar Threads

  1. How to make a resolution independent Ui
    By shivendra46d in forum Newbie
    Replies: 2
    Last Post: 24th September 2013, 21:08
  2. DLL independent development?
    By Sia in forum Qt Programming
    Replies: 4
    Last Post: 5th December 2011, 11:57
  3. QRegExp independent subexpressions
    By Nik8768 in forum Newbie
    Replies: 9
    Last Post: 18th April 2010, 23:28
  4. Scale independent QGraphicsItem
    By Twoslick in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2010, 05:59
  5. Platform independent GUI
    By bnilsson in forum Qt Programming
    Replies: 39
    Last Post: 28th November 2009, 11:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.