Window geometry
-
I've tried the following:
QWidget* pobjWidget = pobjParent->pobjGetWidget(); if ( pobjWidget != nullptr ) { QMainWindow* pobjMainWindow = static_cast<QMainWindow*>(pobjWidget); QWidget* pobjCentral = pobjMainWindow->centralWidget();
And single stepped using the debugger, it will not step over centralWidget() which leads me to believe that as I am defining my widget as QWindow that it cannot be cast to a QMainWindow.
-
I've tried the following:
QWidget* pobjWidget = pobjParent->pobjGetWidget(); if ( pobjWidget != nullptr ) { QMainWindow* pobjMainWindow = static_cast<QMainWindow*>(pobjWidget); QWidget* pobjCentral = pobjMainWindow->centralWidget();
And single stepped using the debugger, it will not step over centralWidget() which leads me to believe that as I am defining my widget as QWindow that it cannot be cast to a QMainWindow.
@SPlatten said in Window geometry:
as I am defining my widget as QWindow that it cannot be cast to a QMainWindow
Of course not
-
So my original question still stands how to get the geometry of the area inside the frame? I'm currently looking at frameMargins.
-
No, from the eventFilter:
bool clsXMLnode::eventFilter(QObject* pobjObject, QEvent* pobjEvent) { if ( pobjEvent->type() == QEvent::Resize ) { .... } return QObject::eventFilter(pobjObject, pobjEvent); }
@SPlatten https://doc.qt.io/qt-5/qwidget.html#resizeEvent
"When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize()." -
@SPlatten But how do you know that you get size including window frame?
Qt documentation clearly states that geometry() returns the size without window frame.
And what I wanted to say with my previous post: if you call geometry() in resize event you get new size, not old.