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. Getting titlebar height of a QMdiSubWindow
Qt 6.11 is out! See what's new in the release blog

Getting titlebar height of a QMdiSubWindow

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 5.4k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    I've got a (custom-developed) Plot object within a QMdiSubWindow. The Plot object is not derived from QWidget. It draws a QFrame, and plots some X/Y data within that.

    Now I want to resize the QMdiSubwindow according to the size of the QFrame, and I do this as follows:
    @
    QRect rf = mFrame->frameRect();
    myMdiSubWindow->resize(rf.width(), rf.height());
    @
    However, now the QMdiSubWindow is too small and it's obvious that I should add the MdiSubWindow its titlebar height.

    From which property can I get the titlebar height of an MdiSubWindow?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Found it... for the interested:

      @
      QStyle * wStyle = myMdiSubWindow->style();
      QStyleOptionTitleBar so;
      so.titleBarState = 1; // kThemeStateActive
      so.titleBarFlags = Qt::Window;
      int titleBarHeight = wStyle->pixelMetric(QStyle::PM_TitleBarHeight, &so, this);
      @

      Continuing my search on how to find the thickness of the QMdiSubWindow decoration...

      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