Results 1 to 4 of 4

Thread: QMenu and setTearOffEnabled(bool)

  1. #1
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QMenu and setTearOffEnabled(bool)

    I'm trying to make some menu's tearoff-able, and it doesn't seem to work on OS X, I haven't tried any other OS yet, so I don't really know what's wrong. Here is some code I'm using:

    Qt Code:
    1. //in .hh file
    2. QMenu *editMenu;
    3.  
    4. //in .cc file
    5. editMenu = menuBar->addMenu(tr("&Edit"));
    6. editMenu->addAction(undoAct);
    7. editMenu->addAction(redoAct);
    8. editMenu->setTearOffEnabled(true);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. menuBar = new QMenuBar(0);
    2.  
    3. fileMenu = new QMenu(tr("&File"),this);
    4. fileMenu->setTearOffEnabled(true);
    5. menuBar->addMenu(fileMenu);
    6. fileMenu->addAction(openAct);
    7. fileMenu->addAction(saveAct);
    8. fileMenu->addAction(saveAsAct);
    9. fileMenu->addSeparator();
    10. fileMenu->addAction(exitAct);
    To copy to clipboard, switch view to plain text mode 

    any ideas? I'm clueless. It compiles and runs, but the tearoff strip doesn't show up anywhere...

  2. #2
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMenu and setTearOffEnabled(bool)

    Hello,

    I tried on a windows OS, and the only thing i had to change so it works is the parent object you give to the constructor:
    i would use
    Qt Code:
    1. new QMenuBar(this);
    To copy to clipboard, switch view to plain text mode 
    rather than
    Qt Code:
    1. new QMenuBar(0);
    To copy to clipboard, switch view to plain text mode 

    But maybe there is a subtility i didnt get
    Hope it helps ^^
    Pierre.

  3. #3
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMenu and setTearOffEnabled(bool)

    I tried that and it doesn't seem to work either. It must be an OS X thing. I'll try on windows later. Thanks for your help, if anyone else knows anything, let me know,
    Dave

  4. #4
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMenu and setTearOffEnabled(bool)

    found this link just now while searching on the trolltech support site:

    http://www.trolltech.com/developer/t...ntry&id=144056

    I hope they fix this soon...

Similar Threads

  1. Caption in QMenu
    By Lykurg in forum Newbie
    Replies: 4
    Last Post: 16th April 2014, 22:41
  2. Shortcut for QMenu
    By Ryhel in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2007, 11:57
  3. Qmenu Stable close on QTableWidget
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2006, 10:03
  4. QMenu in QHeaderView
    By munna in forum Qt Programming
    Replies: 9
    Last Post: 15th July 2006, 14:58
  5. Replies: 2
    Last Post: 23rd February 2006, 16:38

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
  •  
Qt is a trademark of The Qt Company.