Results 1 to 2 of 2

Thread: Align two rects

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Align two rects

    Hello All,

    If i have 2 rects and i want to align them, so the center of rect2 will be the same as the center of rect1.

    is there a way to do this translation ?? the rect can translate its x,y. but how can i translate its center ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Align two rects

    Qt Code:
    1. rect2.moveCenter(rect1.center());
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    jesse_mark (14th June 2013)

Similar Threads

  1. QTabWidget align
    By AlexD in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2012, 13:19
  2. Align QDialog
    By sousadaniel7 in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2012, 18:39
  3. Question about align
    By Archa4 in forum Newbie
    Replies: 4
    Last Post: 14th March 2011, 08:36
  4. Replies: 1
    Last Post: 21st December 2010, 22:04
  5. QTextEdit align right.
    By bunjee in forum Qt Programming
    Replies: 6
    Last Post: 7th November 2009, 20:43

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.