Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PyQt5 - How to get title bar height?
Qt 6.11 is out! See what's new in the release blog

PyQt5 - How to get title bar height?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 2.9k 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.
  • PatitotectiveP Offline
    PatitotectiveP Offline
    Patitotective
    wrote on last edited by
    #1

    I'm trying to store the geometry of the window when you close it. But on different operating systems or different settings the title bar height it's different, so it will slowly go down if you close and open the window many times.
    So my question is if there is a way to get title bar height?

    I tried this answer https://forum.qt.io/topic/99528/window-titlebar-height-example/3 but it didn't work (on Ubuntu).

    jsulmJ 1 Reply Last reply
    0
    • PatitotectiveP Patitotective

      I'm trying to store the geometry of the window when you close it. But on different operating systems or different settings the title bar height it's different, so it will slowly go down if you close and open the window many times.
      So my question is if there is a way to get title bar height?

      I tried this answer https://forum.qt.io/topic/99528/window-titlebar-height-example/3 but it didn't work (on Ubuntu).

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Patitotective said in PyQt5 - How to get title bar height?:

      But on different operating systems or different settings the title bar height it's different

      But it should be the same on same system?
      Also you shouldn't actually care about the title bar. Only store and restore the geometry of the main window like shown here: https://doc.qt.io/qt-5/restoring-geometry.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      PatitotectiveP 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Patitotective said in PyQt5 - How to get title bar height?:

        But on different operating systems or different settings the title bar height it's different

        But it should be the same on same system?
        Also you shouldn't actually care about the title bar. Only store and restore the geometry of the main window like shown here: https://doc.qt.io/qt-5/restoring-geometry.html

        PatitotectiveP Offline
        PatitotectiveP Offline
        Patitotective
        wrote on last edited by
        #3

        @jsulm Seems to have the same problem as restoring the window geometry for my own.

        jsulmJ 1 Reply Last reply
        0
        • PatitotectiveP Patitotective

          @jsulm Seems to have the same problem as restoring the window geometry for my own.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Patitotective said in PyQt5 - How to get title bar height?:

          Seems to have the same problem as restoring the window geometry for my own

          Not sure what you mean?
          Do you mean the approach I posted? If so can you show your code?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          PatitotectiveP 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Patitotective said in PyQt5 - How to get title bar height?:

            Seems to have the same problem as restoring the window geometry for my own

            Not sure what you mean?
            Do you mean the approach I posted? If so can you show your code?

            PatitotectiveP Offline
            PatitotectiveP Offline
            Patitotective
            wrote on last edited by
            #5

            @jsulm When I was writing the example the bug disappeared, so for now it's solved.

            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