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
Forum Updated to NodeBB v4.3 + New Features

Qt6 platform rendering issues on Ubuntu 22.04

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 4 Posters 4.1k 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by
    #2

    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

    SGaistS JonBJ 2 Replies 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

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #3

      Hi,

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

      By the way, which desktop environment are you using ?

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

      R 2 Replies Last reply
      0
      • 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
        #4

        @SGaist Thanks for looking at this. I am basically running a default desktop which Ubuntu 22.04 has configured. I don't really know what I am doing here, since I never changed anything. But I saw somewhere references to environment variables beginning with XDG_..., so here are the results of a few of those:

        bob@bobs-laptop:~$ echo $XDG_SESSION_TYPE 
        wayland
        bob@bobs-laptop:~$ echo $XDG_SESSION_DESKTOP 
        ubuntu
        bob@bobs-laptop:~$ echo $XDG_CURRENT_DESKTOP 
        ubuntu:GNOME
        

        If I give this option on the command line: -patform xcb as mentioned above, are there any options I can add after that? I looked all over but could not find any documentation about what the allowed options are, except for -platform windows which has a lot of extra options.

        As to fusion, I get a fatal error when I put ? -platform fusion` on the command line:

        This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
        
        Available platform plugins are: xcb, offscreen, minimal, vkkhrdisplay, eglfs, vnc, linuxfb, wayland, minimalegl, wayland-egl.
        

        What do I need to do in order to get fusion to work?

        1 Reply Last reply
        0
        • 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

                                          • Login

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