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. Qt6 platform rendering issues on Ubuntu 22.04
Qt 6.11 is out! See what's new in the release blog

Qt6 platform rendering issues on Ubuntu 22.04

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 4 Posters 20.3k Views 2 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.
  • SGaistS SGaist

    Hi,

    Do you have the same issue if you use the fusion style ?

    By the way, which desktop environment are you using ?

    R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by
    #5

    @SGaist I found out how to set the "Fusion" style here in another forum thread.

    So I added this line to my main() function right after creating the instance of QApplication:

    qApp->setStyle(QStyleFactory::create("Fusion"));
    

    It doesn't have any effect, AFAICT.

    JoeCFDJ 1 Reply Last reply
    0
    • R Robert Hairgrove

      @SGaist I found out how to set the "Fusion" style here in another forum thread.

      So I added this line to my main() function right after creating the instance of QApplication:

      qApp->setStyle(QStyleFactory::create("Fusion"));
      

      It doesn't have any effect, AFAICT.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #6

      @Robert-Hairgrove I just wrote a small test program to confirm that qlabel is greyed out if it is disabled. Qt: 6.5.2 and OS: Ubuntu 22.04.

      R 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @Robert-Hairgrove I just wrote a small test program to confirm that qlabel is greyed out if it is disabled. Qt: 6.5.2 and OS: Ubuntu 22.04.

        R Offline
        R Offline
        Robert Hairgrove
        wrote on last edited by
        #7

        @JoeCFD Thanks ... would you mind sharing your code with us? :)

        JoeCFDJ 1 Reply Last reply
        0
        • R Robert Hairgrove

          @JoeCFD Thanks ... would you mind sharing your code with us? :)

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #8

          @Robert-Hairgrove
          main.cpp

          #include "helpwidget.h"
          
          #include <QApplication>
          
          int main( int argc, char *argv[] )
          {
              QApplication app(argc, argv);
          
              auto widget = new HelpWidget;
              widget->show();
          
              return app.exec();
          }
          

          helpwidget.h

          #ifndef HELPWIDGET_H
          #define HELPWIDGET_H
          
          #include <QWidget>
          
          //! [0]
          class HelpWidget : public QWidget
          {
              Q_OBJECT
          
          public:
              HelpWidget(QWidget *parent = nullptr);
          
          };
          //! [0]
          
          #endif // HelpWidget_H
          

          helpwidget.cpp

          #include <QVBoxLayout>
          #include <QLabel>
          #include <QPushButton>
          
          
          #include "helpwidget.h"
          
          HelpWidget::HelpWidget( QWidget * parent )
              : QWidget(parent) 
          {    
              auto layout = new QVBoxLayout( this );
              setMinimumSize( 400, 400 );
          
              auto label = new QLabel( "Dis/enabled test", this );
              auto button = new QPushButton( "Press", this );
          
              layout->addWidget( label );
              layout->addWidget( button );
          
              connect( button, &QPushButton::pressed,
                       [=](){  auto isEnabled = label->isEnabled();
                               label->setEnabled( !isEnabled ); } );
          }
          
          
          R 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @Robert-Hairgrove
            main.cpp

            #include "helpwidget.h"
            
            #include <QApplication>
            
            int main( int argc, char *argv[] )
            {
                QApplication app(argc, argv);
            
                auto widget = new HelpWidget;
                widget->show();
            
                return app.exec();
            }
            

            helpwidget.h

            #ifndef HELPWIDGET_H
            #define HELPWIDGET_H
            
            #include <QWidget>
            
            //! [0]
            class HelpWidget : public QWidget
            {
                Q_OBJECT
            
            public:
                HelpWidget(QWidget *parent = nullptr);
            
            };
            //! [0]
            
            #endif // HelpWidget_H
            

            helpwidget.cpp

            #include <QVBoxLayout>
            #include <QLabel>
            #include <QPushButton>
            
            
            #include "helpwidget.h"
            
            HelpWidget::HelpWidget( QWidget * parent )
                : QWidget(parent) 
            {    
                auto layout = new QVBoxLayout( this );
                setMinimumSize( 400, 400 );
            
                auto label = new QLabel( "Dis/enabled test", this );
                auto button = new QPushButton( "Press", this );
            
                layout->addWidget( label );
                layout->addWidget( button );
            
                connect( button, &QPushButton::pressed,
                         [=](){  auto isEnabled = label->isEnabled();
                                 label->setEnabled( !isEnabled ); } );
            }
            
            
            R Offline
            R Offline
            Robert Hairgrove
            wrote on last edited by
            #9

            @JoeCFD Thanks!

            Could you also please post the contents of the *.pro file (or CMake project file) that you used to build this?

            JoeCFDJ 1 Reply Last reply
            0
            • R Robert Hairgrove

              @JoeCFD Thanks!

              Could you also please post the contents of the *.pro file (or CMake project file) that you used to build this?

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #10

              @Robert-Hairgrove There you.
              testlabel.pro

              QT += widgets
              
              HEADERS += \
                      helpwidget.h 
              
              SOURCES += \
                      helpwidget.cpp \
                      main.cpp
              
              R 1 Reply Last reply
              0
              • JoeCFDJ JoeCFD

                @Robert-Hairgrove There you.
                testlabel.pro

                QT += widgets
                
                HEADERS += \
                        helpwidget.h 
                
                SOURCES += \
                        helpwidget.cpp \
                        main.cpp
                
                R Offline
                R Offline
                Robert Hairgrove
                wrote on last edited by
                #11

                @JoeCFD Your code builds and runs OK, but when I click on the "Press" button, the label does not change its appearance.

                Please post the results of the following commands run in a terminal:

                echo $XDG_SESSION_TYPE
                echo $XDG_SESSION_DESKTOP
                echo $XDG_CURRENT_DESKTOP
                

                Also:

                echo $QT_QPA_PLATFORM
                

                Thank you!

                JoeCFDJ 1 Reply Last reply
                0
                • R Robert Hairgrove

                  @JoeCFD Your code builds and runs OK, but when I click on the "Press" button, the label does not change its appearance.

                  Please post the results of the following commands run in a terminal:

                  echo $XDG_SESSION_TYPE
                  echo $XDG_SESSION_DESKTOP
                  echo $XDG_CURRENT_DESKTOP
                  

                  Also:

                  echo $QT_QPA_PLATFORM
                  

                  Thank you!

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by
                  #12

                  @Robert-Hairgrove
                  x11
                  Lubuntu
                  LXQt
                  empty

                  1 Reply Last reply
                  0
                  • R Robert Hairgrove

                    Here is a screenshot with an active database in the app built with Qt 5.15, showing the "To do" list with different stages enabled and disabled:
                    platform_qt5_active.png

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #13

                    @Robert-Hairgrove
                    @SGaist understands this much better than I do, but is your picture #2 (no borders and Qt6.5) somehow "wayland"? Which might not have/do the effects of x11/xcb?

                    R 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @Robert-Hairgrove
                      @SGaist understands this much better than I do, but is your picture #2 (no borders and Qt6.5) somehow "wayland"? Which might not have/do the effects of x11/xcb?

                      R Offline
                      R Offline
                      Robert Hairgrove
                      wrote on last edited by
                      #14

                      @JonB Yes, it is wayland if I do not set "-platform xcb" as a command line option.

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Robert Hairgrove
                        wrote on last edited by
                        #15

                        I forgot to add that the precise version of Qt I have is 6.5.3 which was installed automatically by the Qt Creator maintenance tool.

                        JoeCFDJ 1 Reply Last reply
                        0
                        • R Robert Hairgrove

                          I forgot to add that the precise version of Qt I have is 6.5.3 which was installed automatically by the Qt Creator maintenance tool.

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by JoeCFD
                          #16

                          @Robert-Hairgrove I guess the problem should be gone if you switch to X11. Do you have to use Wayland? Wayland is the default setting in Ubuntu 22.04.

                          R 1 Reply Last reply
                          0
                          • JoeCFDJ JoeCFD

                            @Robert-Hairgrove I guess the problem should be gone if you switch to X11. Do you have to use Wayland? Wayland is the default setting in Ubuntu 22.04.

                            R Offline
                            R Offline
                            Robert Hairgrove
                            wrote on last edited by
                            #17

                            @JoeCFD "X11" is not listed as an available platform argument (see my reply to @SGaist above).

                            How would I do this, switch to X11?

                            JoeCFDJ 1 Reply Last reply
                            0
                            • R Robert Hairgrove

                              @JoeCFD "X11" is not listed as an available platform argument (see my reply to @SGaist above).

                              How would I do this, switch to X11?

                              JoeCFDJ Offline
                              JoeCFDJ Offline
                              JoeCFD
                              wrote on last edited by JoeCFD
                              #18

                              @Robert-Hairgrove logout your account. You can see a settings icon on the login screen and click the setting icon to select Xorg. Then log in and you will be good.

                              R 2 Replies Last reply
                              0
                              • JoeCFDJ JoeCFD

                                @Robert-Hairgrove logout your account. You can see a settings icon on the login screen and click the setting icon to select Xorg. Then log in and you will be good.

                                R Offline
                                R Offline
                                Robert Hairgrove
                                wrote on last edited by
                                #19

                                @JoeCFD Thanks.

                                I logged in again with XOrg, but unfortunately the problem persists.

                                JoeCFDJ 1 Reply Last reply
                                0
                                • JoeCFDJ JoeCFD

                                  @Robert-Hairgrove logout your account. You can see a settings icon on the login screen and click the setting icon to select Xorg. Then log in and you will be good.

                                  R Offline
                                  R Offline
                                  Robert Hairgrove
                                  wrote on last edited by
                                  #20

                                  @JoeCFD BTW, what is "LXQt"?

                                  JoeCFDJ 1 Reply Last reply
                                  0
                                  • R Robert Hairgrove

                                    @JoeCFD Thanks.

                                    I logged in again with XOrg, but unfortunately the problem persists.

                                    JoeCFDJ Offline
                                    JoeCFDJ Offline
                                    JoeCFD
                                    wrote on last edited by
                                    #21

                                    @Robert-Hairgrove did you do:
                                    make distclean
                                    qmake
                                    make
                                    run

                                    1 Reply Last reply
                                    0
                                    • R Robert Hairgrove

                                      @JoeCFD BTW, what is "LXQt"?

                                      JoeCFDJ Offline
                                      JoeCFDJ Offline
                                      JoeCFD
                                      wrote on last edited by
                                      #22

                                      @Robert-Hairgrove said in Qt6 platform rendering issues on Ubuntu 22.04:

                                      LXQt

                                      https://lxqt-project.org/

                                      1 Reply Last reply
                                      0
                                      • R Offline
                                        R Offline
                                        Robert Hairgrove
                                        wrote on last edited by
                                        #23

                                        OK, this must be a bug introduced in 6.5.

                                        I installed Qt versions 6.2.4, 6.3.2, 6.4.3 in addition to 6.5.3 and 6.6.0. Up to 6.4.3, the controls are displayed correctly (enabled=black text, disabled=gray).

                                        Beginning with 6.5.3 and also 6.6.0, the problem arises (everything displays as if enabled, regardless of state).

                                        Looks like I need to file a bug report, but I don't have time today to do it today.

                                        JonBJ SGaistS JoeCFDJ 3 Replies Last reply
                                        0
                                        • R Robert Hairgrove

                                          OK, this must be a bug introduced in 6.5.

                                          I installed Qt versions 6.2.4, 6.3.2, 6.4.3 in addition to 6.5.3 and 6.6.0. Up to 6.4.3, the controls are displayed correctly (enabled=black text, disabled=gray).

                                          Beginning with 6.5.3 and also 6.6.0, the problem arises (everything displays as if enabled, regardless of state).

                                          Looks like I need to file a bug report, but I don't have time today to do it today.

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on last edited by
                                          #24

                                          @Robert-Hairgrove
                                          As before, this is only a suggestion. I wonder whether Qt 6.5+ has introduced some change in default so that it is using Wayland over Xorg? And that might be the cause of the changed look? I came across e.g. Qt 6.5 Adding Wayland Native Interface

                                          and now set to come with Qt 6.5 is support for a Wayland native interface for application developers wanting to interact directly with Wayland object handles.

                                          Did Qt 6.5 become more preferentially Wayland-y than earlier?

                                          R 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