Results 1 to 4 of 4

Thread: QMenu, addSeparator() and setText()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QMenu, addSeparator() and setText()

    In my project I have a QMainwindow with some QMenu's.

    Between some QAction's in these menu's, I added some separators with text:

    Qt Code:
    1. menu->addSeparator()->setText("Some text");
    To copy to clipboard, switch view to plain text mode 

    The strange thing here is that in Linux there is the separator WITH text
    but in Windows XP there is the separator WITHOUT text.

    The code is the same.

    Any ideas how to get the text in the separators in Windows?

    This phenomena happens with Qt 4.3.3 and the Qt 4.4.0 beta1 release.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QMenu, addSeparator() and setText()

    That's because on Windows separators don't have text. You must force a different style for the menu to make them appear. Windows style(s) won't draw them.
    J-P Nurmi

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

    Teuniz (3rd March 2008)

  4. #3
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu, addSeparator() and setText()

    Quote Originally Posted by jpn View Post
    That's because on Windows separators don't have text. You must force a different style for the menu to make them appear. Windows style(s) won't draw them.
    Thanks for your answer.

    It's a pitty because I like this option.

    Regards.

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QMenu, addSeparator() and setText()

    Quote Originally Posted by Teuniz View Post
    It's a pitty because I like this option.
    Well, as I said, you can always use the same style on Windows.
    J-P Nurmi

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.