Hi there,
thanks to a post of user d_stranz on another posting from me (https://www.qtcentre.org/threads/697...erences-Dialog) I found a solution for the problem described above too. Just like with my preferences dialog I implemented the slot method showEvent() for my sub-class of QWizard and now the wizard page shows up in proper size with no contents "squeezed" anymore.
But unfortunately this measure has a side effect. Now the wizard dialog gets placed in the upper left corner of the screen instead centered over the application's main window. I checked the position information calling the pos() method of QWidget in the body of the showEvent() method and it is really 0,0.
I wounder if there might be a way to avoid this wrong placement but if not, how could I compute the proper position (centered over the application's main window)? I assume that I could simply call move() with that position to fix the problem.
Found a code snippet that does the proper placement of my dialog centered over the application's main window:
QPoint dialogCenter
= mapToGlobal
(rect
().
center());
auto *parentWin(static_cast<QWidget*>(parent())->window());
QPoint parentWindowCenter
(parentWin
->mapToGlobal
(parentWin
->rect
().
center()));
move(parentWindowCenter - dialogCenter);
QPoint dialogCenter = mapToGlobal(rect().center());
auto *parentWin(static_cast<QWidget*>(parent())->window());
QPoint parentWindowCenter(parentWin->mapToGlobal(parentWin->rect().center()));
move(parentWindowCenter - dialogCenter);
To copy to clipboard, switch view to plain text mode
It is placed in the overridden showEvent() method in my QDialog sub-class to "repair" the wrong placement of my dialog which is the result of this code (placed in the showEvent() method too:
setMinimumSize(sizeHint());
setMinimumSize(sizeHint());
To copy to clipboard, switch view to plain text mode
So the only open question left over is: Why is that necessary at all?
Bookmarks