How QWidget::geometry work? I'm really confuse.
-
QMainWindow // base
-->QWidget // central widget (myWidget)
---->QTextEdit // child of myWidget (myTextEdit)
------> QDialog // child of myTextEdit (myDialog)Now I want to move myDialog to center of myTextEdit by using QWidget::geometry
but geometry of myTextEdit never return a current geometry.ex.
myTextEdit has 400 x 200, when call geometry.center it's always return 200 x 100. What?
I want current geometry not a current size. I try to myTextEdit.updateGeometry
before calling myTextEdit.geometry.center but still does not work.
How to properly update myTextEdit's geometry?(I'm not using the Designer, all layout and widgets create in constructor of QMainWindow)
-
Well everything is correct. When you call myTextEdit.geometry.center you got center coordinates inside myTextEdit. You can map coordinates and then use it "mapToGlobal":http://qt-project.org/doc/qt-4.8/qwidget.html#mapToGlobal