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. Ubuntu: Qt GUI components appear jumbled and cutoff with Intel GPU
Forum Updated to NodeBB v4.3 + New Features

Ubuntu: Qt GUI components appear jumbled and cutoff with Intel GPU

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 665 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.
  • A Offline
    A Offline
    anshah
    wrote on last edited by anshah
    #1

    I am a developer on GlobalProtect for Linux which was developed using the Qt framework. Experiencing an issue on Ubuntu 20.04/22.04 with a Dell Precision with Intel GPU the Qt GUI components appear jumbled and cutoff.

    VGA configuration for system with Qt GUI issue:

    $ lspci | grep VGA
    00:02.0 VGA compatible controller: Intel Corporation Device 46a6 (rev 0C)
    

    main-bad.png
    settings-bad.png

    Qt GUI components display with no issues when running on Ubuntu VM with following VGA configuration:

    $ lspci | grep VGA
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    

    main.png
    settings.png

    I followed Qt methodology when developing the GUI. Using QLayouts and other components to organize GUI components which were developed using components and containers provided by Qt and adhere to all the standards. This issue is only seen in this case with the Intel GPU.

    Added the following to main with no resolution:

    QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    
    JoeCFDJ C 2 Replies Last reply
    0
    • A anshah

      I am a developer on GlobalProtect for Linux which was developed using the Qt framework. Experiencing an issue on Ubuntu 20.04/22.04 with a Dell Precision with Intel GPU the Qt GUI components appear jumbled and cutoff.

      VGA configuration for system with Qt GUI issue:

      $ lspci | grep VGA
      00:02.0 VGA compatible controller: Intel Corporation Device 46a6 (rev 0C)
      

      main-bad.png
      settings-bad.png

      Qt GUI components display with no issues when running on Ubuntu VM with following VGA configuration:

      $ lspci | grep VGA
      00:0f.0 VGA compatible controller: VMware SVGA II Adapter
      

      main.png
      settings.png

      I followed Qt methodology when developing the GUI. Using QLayouts and other components to organize GUI components which were developed using components and containers provided by Qt and adhere to all the standards. This issue is only seen in this case with the Intel GPU.

      Added the following to main with no resolution:

      QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
      
      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      @anshah I do not think GPU has anything to do with the layout issue.

      A 1 Reply Last reply
      1
      • JoeCFDJ JoeCFD

        @anshah I do not think GPU has anything to do with the layout issue.

        A Offline
        A Offline
        anshah
        wrote on last edited by
        #3

        @JoeCFD This is being run on Dell Precision 5570 with Intel GPU which is a physical system. When running on VM we do not see it at all. I've tried on Ubuntu 18/20/22, RHEL 7,8,9 and do not see this issue.

        I followed Qt methodology when developing the GUI. I used QLayouts and other components to organize GUI components. This is the first time I've seen this issue.

        If you know what the issue could be please point in the right direction.

        JoeCFDJ 1 Reply Last reply
        0
        • A anshah

          @JoeCFD This is being run on Dell Precision 5570 with Intel GPU which is a physical system. When running on VM we do not see it at all. I've tried on Ubuntu 18/20/22, RHEL 7,8,9 and do not see this issue.

          I followed Qt methodology when developing the GUI. I used QLayouts and other components to organize GUI components. This is the first time I've seen this issue.

          If you know what the issue could be please point in the right direction.

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

          @anshah You may try to create some simple layout to see how they look like and add your components to it. Then you may be able to find out which parts cause issues.

          1 Reply Last reply
          0
          • A anshah

            I am a developer on GlobalProtect for Linux which was developed using the Qt framework. Experiencing an issue on Ubuntu 20.04/22.04 with a Dell Precision with Intel GPU the Qt GUI components appear jumbled and cutoff.

            VGA configuration for system with Qt GUI issue:

            $ lspci | grep VGA
            00:02.0 VGA compatible controller: Intel Corporation Device 46a6 (rev 0C)
            

            main-bad.png
            settings-bad.png

            Qt GUI components display with no issues when running on Ubuntu VM with following VGA configuration:

            $ lspci | grep VGA
            00:0f.0 VGA compatible controller: VMware SVGA II Adapter
            

            main.png
            settings.png

            I followed Qt methodology when developing the GUI. Using QLayouts and other components to organize GUI components which were developed using components and containers provided by Qt and adhere to all the standards. This issue is only seen in this case with the Intel GPU.

            Added the following to main with no resolution:

            QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
            
            C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            @anshah The physical machine does not have a High DPI display panel by any chance?

            A 1 Reply Last reply
            1
            • S Offline
              S Offline
              SamiV123
              wrote on last edited by SamiV123
              #6

              This is a style engine / layout issue.

              In your settings dialog you can see that the dialog has been shrunk to beyond what it should be thus squashing the text.

              • Try a different Qt style engine
              • Depending on what is your current style engine you can try changing the properties (such as font sizes) in some config tool

              It is possible that the widgets/windows use fixed positions/sizes and broken size policies. They might have looked ok when they were developed but then with a different style engine they break. Have seen this so many times...

              A 1 Reply Last reply
              0
              • C ChrisW67

                @anshah The physical machine does not have a High DPI display panel by any chance?

                A Offline
                A Offline
                anshah
                wrote on last edited by
                #7

                @ChrisW67 appreciate your response.

                I don't think the resolutions are the issue.
                Tried all the resolutions offered on Ubuntu and saw the same jumbled components. The size of both the main panel and the settings panel (attached) are squashed down thus cramping the components such as text, buttons, and tabs.

                1 Reply Last reply
                0
                • S SamiV123

                  This is a style engine / layout issue.

                  In your settings dialog you can see that the dialog has been shrunk to beyond what it should be thus squashing the text.

                  • Try a different Qt style engine
                  • Depending on what is your current style engine you can try changing the properties (such as font sizes) in some config tool

                  It is possible that the widgets/windows use fixed positions/sizes and broken size policies. They might have looked ok when they were developed but then with a different style engine they break. Have seen this so many times...

                  A Offline
                  A Offline
                  anshah
                  wrote on last edited by
                  #8

                  @SamiV123 thank you for your thorough and insightful response much appreciated.

                  In both the cases, I made the panel size fixed length. Here's an overview of my setup for each panel:

                  Main Panel: QMainWindow with a QVBoxLayout as the central widget. This layout contains embedded layouts and widgets to organize the content of the main panel.

                  Settings: This is a QDialog with tabs added. This is also fixed size.

                  Currently I have a primary and secondary rss file that covers mainly QButtons:

                  QPushButton {
                      background-color: #00557b;
                      color: white;
                  }
                  
                  QPushButton:hover {
                      background-color: #4d88a2;
                  }
                  
                  QPushButton:pressed {
                      background-color: #003b55;
                  }
                  
                  QPushButton:disabled {
                      background-color: #b1b5b7;
                  }
                  

                  The rest of the styles for components I do through code since they require some customization so for example for a Cancel Button:

                  #define STYLE_CANCEL_BUTTON  "color: black; border: none; outline: none;"
                  m_pCancelButton     = new QPushButton(tr("Cancel"),this);
                  m_pCancelButton->setStyleSheet(STYLE_CANCEL_BUTTON);
                  

                  That's the extent that I use the Qstyle. I'm open to suggestions to improve.
                  I'd appreciate any feedback.

                  S M 2 Replies Last reply
                  0
                  • A anshah

                    @SamiV123 thank you for your thorough and insightful response much appreciated.

                    In both the cases, I made the panel size fixed length. Here's an overview of my setup for each panel:

                    Main Panel: QMainWindow with a QVBoxLayout as the central widget. This layout contains embedded layouts and widgets to organize the content of the main panel.

                    Settings: This is a QDialog with tabs added. This is also fixed size.

                    Currently I have a primary and secondary rss file that covers mainly QButtons:

                    QPushButton {
                        background-color: #00557b;
                        color: white;
                    }
                    
                    QPushButton:hover {
                        background-color: #4d88a2;
                    }
                    
                    QPushButton:pressed {
                        background-color: #003b55;
                    }
                    
                    QPushButton:disabled {
                        background-color: #b1b5b7;
                    }
                    

                    The rest of the styles for components I do through code since they require some customization so for example for a Cancel Button:

                    #define STYLE_CANCEL_BUTTON  "color: black; border: none; outline: none;"
                    m_pCancelButton     = new QPushButton(tr("Cancel"),this);
                    m_pCancelButton->setStyleSheet(STYLE_CANCEL_BUTTON);
                    

                    That's the extent that I use the Qstyle. I'm open to suggestions to improve.
                    I'd appreciate any feedback.

                    S Offline
                    S Offline
                    SamiV123
                    wrote on last edited by SamiV123
                    #9

                    @anshah

                    This is not what I mean with a style engine.

                    A style engine is what implements widget drawing inside Qt. For example Qt built-in Fusion or popular Linux Advaita.

                    The style sheet is used to control the "palette" which defines a set of "Known colors" for various style keys. Not all style engines use the palettes consistently though.

                    Using fixed sizes is likely your problem. The sizes are not playing nice-nice with the sizes that the style engine would require for drawing the widgets correctly, hence they end up clipped

                    1 Reply Last reply
                    1
                    • A anshah

                      @SamiV123 thank you for your thorough and insightful response much appreciated.

                      In both the cases, I made the panel size fixed length. Here's an overview of my setup for each panel:

                      Main Panel: QMainWindow with a QVBoxLayout as the central widget. This layout contains embedded layouts and widgets to organize the content of the main panel.

                      Settings: This is a QDialog with tabs added. This is also fixed size.

                      Currently I have a primary and secondary rss file that covers mainly QButtons:

                      QPushButton {
                          background-color: #00557b;
                          color: white;
                      }
                      
                      QPushButton:hover {
                          background-color: #4d88a2;
                      }
                      
                      QPushButton:pressed {
                          background-color: #003b55;
                      }
                      
                      QPushButton:disabled {
                          background-color: #b1b5b7;
                      }
                      

                      The rest of the styles for components I do through code since they require some customization so for example for a Cancel Button:

                      #define STYLE_CANCEL_BUTTON  "color: black; border: none; outline: none;"
                      m_pCancelButton     = new QPushButton(tr("Cancel"),this);
                      m_pCancelButton->setStyleSheet(STYLE_CANCEL_BUTTON);
                      

                      That's the extent that I use the Qstyle. I'm open to suggestions to improve.
                      I'd appreciate any feedback.

                      M Offline
                      M Offline
                      mpergand
                      wrote on last edited by
                      #10

                      @anshah
                      You can't rely on fixed sizes because the default font size can be different from one distro to another (or changed by users).

                      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