[Qt-interest] Menu bar on QtCreator created GUI

OSProg osprog at gmail.com
Tue Jul 13 21:55:18 CEST 2010


>> I've created a GUI with the Qt Creator and I've put some items under
>> the Menu Bar. On the QtCreator Designer window it looks OK,
>
> What do you mean by "it looks OK"? Does something happen (besides that the 
> menu disappears, as I ASSUME)?
>
I mean that I can add actions and menus and all is as expected.
>> but when
>> I run the application the items are not click-able. They are not
>> disabled (grayed out), but when I click on them nothing happened.
>
> Well, what do you EXPECT to happen?  Why do you expect something to happen 
> at all (again, I ASSUME the menu disappears once you click an item)? 
> Simply adding menu items in the GUI editor (the embedded "Qt Designer, to 
> be specific) does not associate them with any behaviour. Or did you 
> connect some signal/slots in the Qt Designer, too?
>
Well, normally when I have a menu I expect to see all the items when I click 
on it. I cannot click on an item because they doesn't appear when I click on 
the menu. The signal/slots are connected from the source code (from a class) 
not in the designer.
>> Do I have to set something in order to make them working?
>
> Off course, you have to actually connect the QActions (the "menu items") 
> to some slot, either by following some naming convention (fragile when 
> renaming/refactoring!) like
>
>  on_fooAction_triggered() {.... // here goes your actual "what should 
> happen" logic ...}
>
> and the like or you explicitly connect the corresponding QActions in your 
> code.
>
> (Unfortunatelly Qt does not yet implement the 
> "DoWhatIMeanAndDoItAutomagically"-technology - this is planned in an 
> upcoming Qt release, but no promises made for Qt 5.0!)
I'm not familiar with this technology I don't think I need it at the moment. 
However, it will be a good feature...
>
>
> You might want to read about Qt signal/slots first: 
> http://doc.trolltech.com/4.6/signalsandslots.html
>

BTW, when I construct menu with actions from the source code it works fine. 
When I create the same from the designer it doesn't.

> Cheers, Oliver
> -- 
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>

Regards,
Nik




More information about the Qt-interest-old mailing list