useQt Code:
dialog->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, dialog->size(), qApp->desktop()->availableGeometry()));To copy to clipboard, switch view to plain text mode
useQt Code:
dialog->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, dialog->size(), qApp->desktop()->availableGeometry()));To copy to clipboard, switch view to plain text mode
substitute dialog->size() with any size (QSize) you want.
I did the following:
this->setGeometry(QStyle::alignedRect(Qt::LeftToRight , Qt::AlignCenter, 88, qApp->desktop()->availableGeometry()));
But he gave me the following error:
/Users/danielsousa/Qt/Interface-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release/../Interface2/criareditaralerta.cpp:15: error: no matching function for call to 'QStyle::alignedRect(Qt::LayoutDirection, Qt::AlignmentFlag, int, const QRect)'
yea well, 88 is an int, not a QSize. And there is no QSize implicit constructor with an single int as argument
The error message is quite explicit btw
consider this a minute.
In the previous version, you wrote
then, you want to change QDialog's size. So, as lykurg said, you replace dialog->size() by the QSize you want.Qt Code:
dialog->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, dialog->size(), qApp->desktop()->availableGeometry()));To copy to clipboard, switch view to plain text mode
now, what is the QSize you choose ?
88
88 is not a QSize
Q.E.D.
sousadaniel7 (6th May 2012)
Read the documentation about QSize (just click the link!). See which constructors are provided.
sousadaniel7 (6th May 2012)
Bookmarks