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. QColorDialog window blank on Linux
Forum Updated to NodeBB v4.3 + New Features

QColorDialog window blank on Linux

Scheduled Pinned Locked Moved Solved General and Desktop
qcolordialogqt 5.9linuxubuntu 16.04
11 Posts 4 Posters 3.6k Views 4 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.
  • E Offline
    E Offline
    enmaniac
    wrote on last edited by
    #1

    Re: QColorDialog showing blank on linux [solved]

    Hello all,

    Have the similar problem to the linked one. Running Qt 5.9.0 on Ubuntu 16.04 (64 bit).
    Trick with QColorDialog::Don'tUseNativeDialog works for me as well but unfortunately I had to patch some third party code which I would prefer to leave as is.

    Any ideas why ?

    Cheers!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should try with 5.9.1 to see if it's still misbehaving otherwise please post a sample code that reproduces the error you get.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • E Offline
        E Offline
        enmaniac
        wrote on last edited by
        #3

        Hi,

        I will try once back from holidays as currently I do not have access to reliable Wifi.
        However, for the error part. I dont see any. I simply see no content in the color dialog, like it was never painted.

        Cheers!

        1 Reply Last reply
        0
        • E Offline
          E Offline
          enmaniac
          wrote on last edited by enmaniac
          #4

          Sorry for coming late.
          I have checked against Qt 5.9.1 and I could observe the same problem.

          The code used which leads to wrong result is like this (this is from QtPropertyBrowser):

          bool ok = false;
          ...
          QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);
          

          The code which works as expected:

          ...
          QColor newColor = QColorDialog::getColor(m_color, this, QString(), QColorDialog::DontUseNativeDialog);
          

          EDIT: hmmm...it seems that the problem occurs only for this particular case when called from QtPropertyBrowser...I'll try to investigate it further

          Cheers!

          1 Reply Last reply
          0
          • E Offline
            E Offline
            enmaniac
            wrote on last edited by
            #5

            Hi,

            So I have built Qt 5.9.1 from sources on my Ubuntu box to be able to debug Qt code. It seems the dialog is presented correctly when using my developers Qt :/
            However, the dialog shown is exactly the same as one with stock Qt and QColorDialog::DontUseNativeDialog option enabled.

            I wonder if it can have something to do with configuration of my Qt source build.

            Cheers!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Do you have the same behaviour with your distribution provided Qt ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Just as a note,
                QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);

                works as expected on Mint 18 64bit xfce , Qt5.9 downloaded.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  enmaniac
                  wrote on last edited by
                  #8

                  Hey all,

                  Ok I have found the cause of the problem. It seems that in this particular case, problem with rendering on QColorDialog was caused by my QOpenGLWidget based object where in its paintGL method I was calling update(). This somehow messed up the composition of QColorDialog which popped up on top of QOpenGLWidget.
                  I am not sure why the rendering problem does not occur when QColorDialog::DontUseNativeDialog is used though. Since depending on the flag presence, 2 completely different QColorDialogs can popup, I can only assume that one of them is somehow influenced by composition with OpenGL-enabled widget.

                  Cheers!

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Thanks for the feedback !

                    One is the native dialog of the system and the other one is Qt's own implementation of the dialog.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      enmaniac
                      wrote on last edited by enmaniac
                      #10

                      Indeed, it looks like that form the flag name. Apparently, in this case, native dialog has some 'feature' causing composition to fail. At least we know it now, though I suppose this is very OS based or even window manager based.

                      For future reference, I am using Unity.

                      Thanks again for all your time!

                      Cheers!

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        ChortleMortal
                        wrote on last edited by
                        #11

                        I am experiencing this problem on 5.11.2 running Linux Mint. So it is still there.

                        Using the following formulation:
                        QColorDialog dlg(colored->getColor());
                        dlg.setOption(QColorDialog::DontUseNativeDialog);
                        dlg.setOption(QColorDialog::ShowAlphaChannel);
                        dlg.open(this,SLOT(slot_colorChanged(QColor)));
                        dlg.exec();

                        First problem: the dialog initializes with color black, not the given color. When pressing OK, the slot is triggered
                        but the color is always color white, whatever is selected in the dialg. So essentially it does not work at all.

                        using the formulation
                        QColor newColor = QColorDialog::getColor(m_color, this, QString(), QColorDialog::DontUseNativeDialog);
                        does work as was mentioned before

                        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