Results 1 to 5 of 5

Thread: where could QPopupMenu show besides QMenuBar !

  1. #1
    Join Date
    Sep 2006
    Location
    nanjing China
    Posts
    19
    Thanks
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default where could QPopupMenu show besides QMenuBar !

    hello everyone

    I have some problems with QPopupMenu :
    source code :
    QWidget * tabindex ;
    tabindex =new QWidget (this ,"tabindex ") ;
    QPopupMenu *home ;
    home =new QPopupMenu (tabindex,"home " );
    home ->insertItem ("hello world ",-1) ;


    but the menu item don't show in tabindex ,must the popupmenu add in QMenuBar

    another question :
    The QMenuBar class provides a horizontal menu bar,how I could show menu items like the left column in the menu of XP(double columns menu ) ?

    thanks
    It is the same old story of not being grateful for what we have until we lose it..........

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where could QPopupMenu show besides QMenuBar !

    Quote Originally Posted by bigbigmoon
    but the menu item don't show in tabindex ,must the popupmenu add in QMenuBar
    you will need to call QPopupMenu::exec() for your popup menu to be shown.

  3. #3
    Join Date
    Sep 2006
    Location
    nanjing China
    Posts
    19
    Thanks
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: where could QPopupMenu show besides QMenuBar !

    Thank you for your reply!
    I tried it ,
    add source code :
    home->exec();
    and
    home->exec(QPoint( 0,58 ) );(the position (0,58 )is relative to the top level widget )
    but the menu item is shown out of the geometry of tabindex .?

    if I add code as :
    KHistoryCombo *list ;
    list =new KHistoryCombo (tabindex ,"hello ") ;
    list ->addToHistory ("kcontrol ") ;

    the list will be shown in tabindex .
    It is the same old story of not being grateful for what we have until we lose it..........

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where could QPopupMenu show besides QMenuBar !

    try this

    Qt Code:
    1. home->exec(parentWidget.mapToGlobal(QPoint( 0,58 ) ));
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to munna for this useful post:

    bigbigmoon (17th April 2007)

  6. #5
    Join Date
    Sep 2006
    Location
    nanjing China
    Posts
    19
    Thanks
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: where could QPopupMenu show besides QMenuBar !

    Thank you for your reply again!
    I has used the ffollowing functions :
    QWidget::mapFrom ( QWidget * parent, const QPoint & pos ) const
    QWidget::mapFromGlobal ( const QPoint & pos ) const
    QWidget::mapFromParent ( const QPoint & pos ) const
    QWidget::mapTo ( QWidget * parent, const QPoint & pos ) const

    but the popupmenu remain showed out of it's parent widget
    It is the same old story of not being grateful for what we have until we lose it..........

Similar Threads

  1. How to show a "widget" immediately?
    By deweyjew in forum Newbie
    Replies: 2
    Last Post: 31st May 2006, 13:58
  2. WYSIWYG html, Window show png icon mac no!
    By patrik08 in forum Qt Programming
    Replies: 10
    Last Post: 25th May 2006, 13:01
  3. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 20:21

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.