PDA

View Full Version : QMenu, addSeparator() and setText()



Teuniz
3rd March 2008, 16:25
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:


menu->addSeparator()->setText("Some text");

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.

jpn
3rd March 2008, 16:43
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.

Teuniz
3rd March 2008, 16:47
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.

jpn
3rd March 2008, 17:16
It's a pitty because I like this option.
Well, as I said, you can always use the same style on Windows. :)