Getting titlebar height of a QMdiSubWindow

  • 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?

  • 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...

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.