PDA

View Full Version : Setting widget alignment



kaushal_gaurav
18th June 2008, 08:15
How do i align the widget with respect to its parent?

marcel
18th June 2008, 08:27
You must set a layout for the parent widget and use spacers and size restrictions on the child widget to do that.
What exactly are you trying to achieve?

kaushal_gaurav
18th June 2008, 08:48
There is the code.


QMessageBox *message = new QMessageBox(this);
message->show();
message->setFocus();
message->setWindowTitle(tr( "Title" ));
message->setText( tr( "Message Text" ));
message->setFocus();
message->setIcon(QMessageBox::Warning);

Now the warning message appears to the right. The top left of message is aligned with center of parent widget. but i want centers of both wigets aligned.

Note : I can not use QMessageBox::warning() is this senario.