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. Ugly white borders around QGraphicsProxyWidgets

Ugly white borders around QGraphicsProxyWidgets

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

    Hello everyone,

    Is there a way to get rid of the white frames/borders around QGraphicsProxyWidget objects in a QGraphicsScene?

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

      Hi,

      You should add which OS/Qt versions you are using and what kind of widget you are putting on your scene.

      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
      • D Offline
        D Offline
        delt
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • D Offline
          D Offline
          delt
          wrote on last edited by delt
          #4

          Oh, sorry. I completely forgot this rather important info :D

          Running on linux mint 17.2, but i'm looking to target also at least osx and windows. Qt version i'm using is 5.2.1, because ubuntu and derivatives based on 14.04 are using that.

          The widgets i'm adding to the scene are a few push buttons, a text browser, and a line edit. It's most noticeable on the push buttons and the line edit, there's 1 pixel of extra white frame around the widgets that have opacity over the GL content.

          Here's a quick screenshot that illustrates these white borders around proxy widgets:
          http://www.deimos.ca/miscjunk/proxywidgets.png

          Thanks for any help!

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

            Is your Play button directly put in a QGraphicsProxyWidget ?

            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
            • D Offline
              D Offline
              delt
              wrote on last edited by delt
              #6

              Yes, in my QGraphicsScene subclass constructor i do:

              Qt::WindowFlags flags = Qt::Widget;
              
              /* [ ... ] */
              play_button = new QPushButton (_("PLAY")); /* yeah i use gettext in this project */
              proxywidget_play_button = addWidget (play_button, flags);
              /* ... same for other widgets */
              

              ... a CSS property might do the trick maybe?

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

                I don't remember a trick to do it directly for the button but is you put it in a layout in a QWidget you can setup the content margins of the widget to be close enough to the button has to not have that space.

                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
                • D Offline
                  D Offline
                  delt
                  wrote on last edited by
                  #8

                  Seems like a good solution. Can you provide a quick example?

                  Thanks!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MajidKamali
                    wrote on last edited by
                    #9

                    play_button->setAttribute(Qt::WA_TranslucentBackground) may do what you want

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

                      widget->setContentsMargins(-W, -X, -Y, -Z)

                      But @MajidKamali's proposition is also good. However, you'll have to check whether it also fits your need for the more complex widgets.

                      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
                      • D Offline
                        D Offline
                        delt
                        wrote on last edited by
                        #11

                        Thanks very much for the information guys! Qt::WA_TranslucentBackground does the trick :D

                        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