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. Request border size

Request border size

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 514 Views
  • 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.
  • N Offline
    N Offline
    NicolasS
    wrote on last edited by
    #1

    Hi,
    We have a global stylesheet set on the app with a lot of rules.
    For a specific widget, I'd like to know what is the border width (border top, left, etc.) that is applied.
    Those rules are applied in cascad so parsing the stylesheet string seems to be complex.

    I've check the QStyle documentation but found nothing usefull.
    Any idea ?
    Thanks

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

      Hi,

      Stylesheet are applied through a custom QStyle subclass you currently don't have access to.

      What would you like to do with that information ?

      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
      1
      • N Offline
        N Offline
        NicolasS
        wrote on last edited by
        #3

        I would like to make a screenshot of the widget without considering its border.
        auto pixmap = myWidget->grab(); works well but the border is included.
        The idea would be to set a custom size to the grab() method by taking the widget geometry and removing the border dimensions.

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

          What widget is that ?

          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
          1
          • N Offline
            N Offline
            NicolasS
            wrote on last edited by
            #5

            In my case, it's a dock widget. Why does it matter ?

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

              Because depending on the widget you might be able to render it's content rather than the widget itself.

              For example, in a dock widget, you usually set a widget in it, so if your render that widget, you won't have the QDockWidget itself in the rendered part.

              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
              • N Offline
                N Offline
                NicolasS
                wrote on last edited by
                #7

                I need also the title widget...
                The solution I've found (which is not optimal) is to take the widget rect and remove the layout content margins.
                It works pretty well.

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

                  That was a suggestion I thought I already made :)

                  Good that you have found a solution and thanks for sharing.

                  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

                  • Login

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