Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Visual differences in StyledPanel QFrames between flatpak and native build
Forum Updated to NodeBB v4.3 + New Features

Visual differences in StyledPanel QFrames between flatpak and native build

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
5 Posts 2 Posters 723 Views 3 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.
  • J Offline
    J Offline
    just_a_dev
    wrote on last edited by
    #1

    Hey everybody,
    i am developing a Qt application (currently using Qt 5.15) which i am planning to publish as a flatpak using version 5.15-23.08 of the org.kde.Platform runtime. I have noticed a few visual differences between the flatpak version and the native version. More specifically, derivatives of QFrame, such as QTableView, are not drawn correctly in the flatpak version when setting the frame shape to QFrame::StyledPanel. In most cases these widgets lack a proper frame border, but at least one such widget looks identical in both versions.

    This is the native build where everything looks as intended:
    native_0.png

    This is the flatpak build which has some visual differences. Please note that differences in the content of the tables are due to the flatpak sandbox and are intendeed. Arrow 1 shows a missing frame border around a QTableView, arrow 2 shows a missing frame border and wrong background color for a QFrame and arrow 3 shows a horizontal line that only exists in the flatpak version.
    flatpak_0.png

    Here is a different QTableView in the flatpak version that is drawn as intended with a border:
    flatpak_1.png

    As far as i understand, the visuals of these elements are determined by the style set for QApplication. Running

    qDebug() << QApplication::style()->objectName();
    

    outputs "breeze", which is the native style of the KDE Plasma desktop i am using, for both versions of the app . Changing this style in the system options correctly updates the look of both versions, so the flatpak version seems to be able to access system styles.

    As i am relatively new to both Qt and flatpak, i don't know of a good way to debug this issue. Has anybody here run into a similar issue or knows of a way to debug this?

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      The difference is the platform theme.
      If you launch your application in a KDE environment, the KDE platform theme is loaded. Within a flatpak, you have a GTK environment. So the GTK 3 platform theme is loaded. Both can have breeze as a base style. There is nothing missing, it’s just a different environment.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      2
      • J Offline
        J Offline
        just_a_dev
        wrote on last edited by
        #3

        Thank you.
        That explains most of my issues, but i still don't understand why only some of the QTableViews have borders drawn around them in the flatpak version. Is there a way to ensure that all QTableViews consistently have a border, as seen in the third screenshot?

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          I don’t know, which is the exact gnome environment in your flatpak and how this table view is created.
          The frame in screenshot 3 looks like a focus frame to me.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          0
          • J Offline
            J Offline
            just_a_dev
            wrote on last edited by
            #5

            I managed to fix the issue. The flatpak version only draws StyledPanal frame shadows when the parent widget is using a grid layout where at least one of the spacing values (horizontal or vertical) is not 0. Any other layout (VBox, HBox, Splitter or Dialog ) and the frame shadows are not drawn. So the fix in my case was to place each of my QTableViews inside of an otherwise empty QWidget that uses a grid layout with any non 0 spacing (negative values work as well).

            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