Results 1 to 2 of 2

Thread: Qt widget issue.

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Wink Qt widget issue.

    Hey trolltechs,

    Here is a piece of code

    Qt Code:
    1. QPoint point = mClientView->.mapToGlobal(QPoint(0,0));
    2.  
    3. mNewAccountView.move(point.x() - mNewAccountView.width() - 18, point.y());
    4.  
    5. mNewAccountView.setFixedWidth(200);
    6.  
    7. mNewAccountView.setWidget(mNewMasterWidget);
    8.  
    9. mNewAccountView.show();
    10.  
    11. mNewAccountView.update();
    To copy to clipboard, switch view to plain text mode 



    As you can see I'm moving a widget and then setting it visible.

    Even after show and update call, the window won't move to the new location, just as if it wasn't repaint.


    Is there an instant move function method ?



    Thanks.

    Mr AreNow.

  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: Qt widget issue.

    OK. First of all the code you posted is out of context.
    I can only assume what are the types involved: mNewAccountView is a QScrollArea and mNewMasterWidget is ....????.

    Anyway, your code should work fine as long as there is no layout managing the position of mNewAccountView.
    If you have a layout set in the parent of mNewAccountView calling move won't have any effect, at best.

    So, maybe you could explain better what you want to achieve.
    If you only want to manually layout widgets then:
    1) Create your own layout manager(QLayout) that only positions the widget at it's local coordinates( you will have to set these at instantiation time ). Of course, you can make it smarter - if you don't pass the position or if it overlaps with an existing widget, then it will find an optimal position.

    2)Do not set a layout to the parent and do what you do now: use move.

    Regards

Similar Threads

  1. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  2. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  3. Replies: 4
    Last Post: 10th March 2007, 18:01
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.