Hello! I am trying to make a scaled drawing on a main form. For this, I took the centralWidget width() and height() and compute the dimensions of the drawing. But I have a problem:
Say the initial size of central widget is 400x300. After I show the QMainWindow, the size is the same. But if I manually resize the QMainWindow with just 1 pixel, or just modify width, the height of the central widget automatically decreases by 21 (so it is now 400x279).
What am I doing wrong?
Edited to add more details: I am using a designer ui file, a QMainWindow descendant, with a menu implemented in the designer. When I get the geometry of the central widget, x is 0 and y is 2 (so it may be wrong the y? Because the menu bar has a height of about 20). After I manually resize the main form, y becomes 23 (and x stays 0). So, the geometry of the central widget before the manual resize seems wrong.
Also, if I write in code: main form resize(30,30) and resize(old x,old y), the geometry of the central widget is correct now (x=0, y=23).
Edited to add: of course I reimplemented the resizeEvent to update my resizable drawing (I draw a few lines, taking into account the available size of central widget).
Edited to add: I found this link: http://www.qtcentre.org/forum/f-qt-p...post86938.html
The person says it is a Qt bug, because the menu bar is reporting height = 2 incorrectly, but how can I find when it will be solved?
Edited to add: the bug is on: http://qt.nokia.com/developer/task-t...ntry&id=237451
Could you suggest a workaround?
Bookmarks