Results 1 to 4 of 4

Thread: set Position

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Question set Position

    hi, I need to set the position of a myFancypopup object; it appear when I click a pushButton....but it position is always at the top-left corner...thanks.
    Qt Code:
    1. FancyPopup::FancyPopup( QWidget* parent, const char* name ):
    2. QLabel( parent, name, WType_Popup ){
    3. setFrameStyle( WinPanel|Raised );
    4. setAlignment( AlignCenter );
    5. resize(130,200);
    6. }
    7. void myMainForm::showPopup() {
    8. popup->mapFromParent(QPoint(150, 100));
    9. popup->show();
    10. }
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set Position

    QPoint QWidget::mapFromParent ( const QPoint & pos ) const
    Translates the parent widget coordinate pos to widget coordinates.
    Same as mapFromGlobal() if the widget has no parent.
    This method returns the translated point.

    Qt Code:
    1. void myMainForm::showPopup()
    2. {
    3. popup->move( mapToGlobal( QPoint( 150, 100 ) ) );
    4. popup->show();
    5. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: set Position

    Thanks, but I need put it onto a tabwidget3.Why this does not work?
    Qt Code:
    1. popup->move( mapToGlobal( QPoint(tabWidget3->x(), tabWidget3->y() )) );
    To copy to clipboard, switch view to plain text mode 
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set Position

    Quote Originally Posted by mickey
    Why this does not work?
    How it "does not work"? Most likely tabWidget3 is not a direct child of "this" widget. You might try:
    Qt Code:
    1. popup->move( tabWidget3->mapToGlobal( QPoint( 0, 0 ) ) );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 7
    Last Post: 17th July 2009, 09:40
  2. Draw QtCanvasElipse on mouse press event position
    By YuriyRusinov in forum Newbie
    Replies: 1
    Last Post: 31st May 2006, 11:57
  3. positioning a window at a specific screen position
    By nupul in forum Qt Programming
    Replies: 3
    Last Post: 29th March 2006, 20:21
  4. Qt4.1 Mouse Position & Scaling
    By Paul Drummond in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 19:02
  5. how change the QListBox item position by pixel
    By roy_skyx in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 01:34

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.