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. QFrame: official shape/shadow to not fill background ?
Forum Updated to NodeBB v4.3 + New Features

QFrame: official shape/shadow to not fill background ?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 340 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.
  • D Offline
    D Offline
    dextermagnific
    wrote last edited by
    #1

    Hi all,
    I'm the author of QSvgStyle, and I would like to know if QFrame is just about drawing a frame without background ?
    Currently I'm using the color of the frame's backgroundRole() to fill it with color. But I see other style engines like fusion do not fill it.
    Is there a way to tell through shape/shadow whether we want the frame to be filled ?
    I know about autoFillBackground() but this is managed by qt itself by filling the background with Window palette, regardless of the backgroundRole set to the frame.

    Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dextermagnific
      wrote last edited by
      #6

      Thanks. Do you know how the officiel Qt Fusion style handles frame fills ? Maybe I should follow it since it's made by Qt itself.

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

        Hi,

        To the best of my knowledge, I would say no. QFrame is a base widget for anything that requires a frame but it does not mean it needs to be transparent.

        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
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote last edited by
          #3

          You could use QMetaObject to figure out whether a frame is a plain QFrame (in which case you could fill it) or inherits from it (in which case you might rather leave it untouched).

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dextermagnific
            wrote last edited by
            #4

            So in which case of shape/shadow should I fill the frame with its background color ?

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

              I am not maintaining QSvgStyle.
              Without knowing it's principles: I'd probably add a flag to the style itself, to toggle whether frame background will be applied only to QFrame or to everything that inherits from it. Then I'd evaluate Qt::WA_NoSystemBackground and paint the background if the widget attribute is unset.

              Software Engineer
              The Qt Company, Oslo

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dextermagnific
                wrote last edited by
                #6

                Thanks. Do you know how the officiel Qt Fusion style handles frame fills ? Maybe I should follow it since it's made by Qt itself.

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

                  QFusionStyle::drawPrimitive() doesn't explicitly draw a background for PE_Frame. It draws backgrounds only for classes inheriting from it to the extent needed. Drawing that frame without explicit background, however, draws it on the default window background. If you have a frame as a top level widget, it looks as if its background had been explicitly drawn.

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  1
                  • D Offline
                    D Offline
                    dextermagnific
                    wrote last edited by
                    #8

                    Thank you, I'll have a look at its code to mimic its behavior.

                    1 Reply Last reply
                    0
                    • D dextermagnific has marked this topic as solved

                    • Login

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