[Qt-interest] Menu bar on QtCreator created GUI

Malyushytsky, Alex alex at wai.com
Wed Jul 14 22:04:31 CEST 2010


There is nothing wrong, I guess you are missing something else.
I think you can get such behavior if you specify wrong parent for example.
Make small example which demonstrate your problem.
Attach source code and post it.

Regards,
     Alex


-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of OS Prog
Sent: Wednesday, July 14, 2010 8:08 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Menu bar on QtCreator created GUI

On Wed, Jul 14, 2010 at 2:36 PM, OS Prog <osprog at gmail.com> wrote:
>>> > ...
>>> The problem is when I run this application. I can see "File" and
>>> "Tools" texts on the QMenuBar, but when I click on them nothing
>>> happens - like I'm not clicking on them. The menu doesn't appear
>>> (this drop-down menu that should appear when you click on them with
>>> all the actions on it..).
>>
>> Okay, now I understand the problem. But are you really sure that nothing at all is displayed? Not even a tiny empty rectangle (the actual menu with no items in it)? And I mean really small, like a few pixels in height... this would indicate that the changes you did in Qt Creator - adding the menu items - are not reflected in either the *.ui file (you did not save) or the generated files (they are not re-generated or compiled/linked).
>>
> Nothing is displayed. Absolutely nothing. Even a pixel.
> The changes are applied, I think, as I've added the QMenu and the
> QActions on it at the same time and then I've build the code - The
> menu text is there but didn't worked. So I assume that files are
> generated correctly and I'm using the right build.
>
>> Also, are you sure you are not mixing up your debug/release binaries? Maybe you are building in release mode, but are starting the (outdated) debug binary?
>>
> Yes, the release folder is empty and I'm working only on debug one...
>
>> Anyway, I still assume that after you did your changes in Qt Creator that the resulting files are not properly auto-generated. Are you using qmake? I strongly assume so (since you mentioned Qt Creator). Make sure that in your *.pro file the UI files are proplery declared:
>>
>> FORMS += YourMainWindow.ui
>>
> They are.
>
>> qmake then takes care of the necessary steps (uic'ing, moc'ing). Do a 'make clean' (or in Qt Creator: right-click on the project(s) and "Clean") and see if that makes a difference...
> I've done it. Even I've cleaned all remaining files after 'clean' step
> manually and I've rebuild it.
>
> BTW, I've noticed that for the first time in Qt4.5 (don't remember
> QtCreator version) few months ago, but I worked around doing the menu
> stuff in the code, rather on the designer. Now I'm using Qt4.7b1 and
> QtCreator 1.3.83.
>
> I've tried building it on few machines (XP and Vista) - it's the same.
>
> Regards
> Nik
>
I've payed a bit to find out more.
It happened if I create a QWidget in the MainWindows constructor.
You can reproduce it if you create a MainWindow GUI with the creator
and put some menubar items on it.
Then in the MainWindow constructor, just after the
ui->setupUi(this);
put:
QWidget *wdg = new QWidget(this);

So, the question is: What's wrong putting the QWidget on this place
with parent MainWindow?

Best regards,
Nik

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list