Results 1 to 3 of 3

Thread: Setting widget alignment

  1. #1
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Setting widget alignment

    How do i align the widget with respect to its parent?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Setting widget alignment

    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?

  3. #3
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Angry Re: Setting widget alignment

    There is the code.

    Qt Code:
    1. QMessageBox *message = new QMessageBox(this);
    2. message->show();
    3. message->setFocus();
    4. message->setWindowTitle(tr( "Title" ));
    5. message->setText( tr( "Message Text" ));
    6. message->setFocus();
    7. message->setIcon(QMessageBox::Warning);
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by marcel; 18th June 2008 at 08:13. Reason: missing [code] tags

Similar Threads

  1. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. qwtscalewidget: setting scale to the widget..
    By halberdier83 in forum Qwt
    Replies: 3
    Last Post: 4th December 2007, 08:08
  4. Widget alignment.
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2007, 19:09
  5. setting widget as modal, disables button
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2006, 09:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.