merry
22nd August 2011, 11:35
Hi all,
I am working on Qt4.6 on mac os, I am working on MultiDialog Application. All the windows are in the layout, When I click on the maximize button on the top of the mainwindow appaers to be maximized. When i move from MainWindow to the next Dialog I want if MainWiindow is maximised then nextDialog should also be maximized.For this I used
if(this->isMaximized())
{
nextDialog->showMaximized();
}
It works perfectly fine. But When I click on nextDialog maximize button to restore it to its orginalGeometry, then it resizes it to the original width and height but not the position, I appears on the bottom right, for this I am trying to get the center position in the resize event of the dialog but still no use.
For this I used:
void nextDialog::resizeEvent(QResizeEvent * event)
{
this->move(QApplication::desktop()->screen()->rect().center()- this->rect().center());
}
But It wont appear in the center
I also tried this but again fails:
void nextDialog::resizeEvent(QResizeEvent * event)
{
QDesktopWidget *d = QApplication::desktop();
int dW = d->width();
int dH = d->height();
int mw = this->width();
int mH = this->height();
int cw = dW/2-mw/2;
int ch = dH/2-mH/2;
move(cw,ch);
}
Pls Suggest what should i do.
I am working on Qt4.6 on mac os, I am working on MultiDialog Application. All the windows are in the layout, When I click on the maximize button on the top of the mainwindow appaers to be maximized. When i move from MainWindow to the next Dialog I want if MainWiindow is maximised then nextDialog should also be maximized.For this I used
if(this->isMaximized())
{
nextDialog->showMaximized();
}
It works perfectly fine. But When I click on nextDialog maximize button to restore it to its orginalGeometry, then it resizes it to the original width and height but not the position, I appears on the bottom right, for this I am trying to get the center position in the resize event of the dialog but still no use.
For this I used:
void nextDialog::resizeEvent(QResizeEvent * event)
{
this->move(QApplication::desktop()->screen()->rect().center()- this->rect().center());
}
But It wont appear in the center
I also tried this but again fails:
void nextDialog::resizeEvent(QResizeEvent * event)
{
QDesktopWidget *d = QApplication::desktop();
int dW = d->width();
int dH = d->height();
int mw = this->width();
int mH = this->height();
int cw = dW/2-mw/2;
int ch = dH/2-mH/2;
move(cw,ch);
}
Pls Suggest what should i do.