PDA

View Full Version : Some menubar items can not be clicked



richardander
11th January 2009, 20:24
Hello everyone,

I upgrade an application from Qt3.3 to Qt4.4. Somehow, the first three items (File, Tools, Help) on menubar(see attached image file MenuQt4.4.jpg ) have no response after being clicked. Usually, they should be highlighted and submenu pops up. Now, they are not highlighted at all.

However, the last item (test) works as normal. And, if I click the forth item (test) first, the other three menu items function as normal when I move my mouse to any one of them.

I used the preview in Designer, it works very well and did not find anything to block the first three menu items in anybar.

I recompile the ui file and still the same problem happen.

Previously, in qt3.3, the menu item looks like attached image MenuQt3.3. There is always a gray bar showing right below the first three menu items. I don't know what it is and why it appears. But it doesn't affect the menu items. When mouse is over the three menu items, they all functioned well. After upgrading, the gray bar disappears, but first three menu items can't be clicked.

I got this set of code from my previous colleague, I doubt if there is any additional code in the implementation (not in UI file) to create the gray bar in Qt3.3. After I upgraded to Qt4.4, it expanded by qt4.4 gui libarary and block the first three menu items?

If any can give me some suggestion how to track the creation of the gray bar or give me some ideas, suggestions, or keywords to search, it is really highly appreciated!

Thank you for any help !

Richard

jpn
11th January 2009, 20:34
Here's the problem:


#include <QtGui>

class MainWindow : public QMainWindow
{
public:
MainWindow(QWidget* parent = 0) : QMainWindow(parent)
{
menuBar()->addMenu("File");
menuBar()->addMenu("Edit");
menuBar()->addMenu("Tools");
menuBar()->addMenu("Help");

QWidget* widget = new QWidget(this);
// change the color just to be able to see the widget
widget->setStyleSheet("background: rgba(255,0,0,128)");
// uncomment the following line and see the difference
// setCentralWidget(widget);
}
};

int main(int argc, char* argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}

richardander
11th January 2009, 21:13
Thank you so much for the prompt help!

I did it and same problem exists. Attached is the screenshot.

BTW, in the existing code , the mainwindow and menu were designed in designer and compiled with UIC. But I tried the in your way by using addMenu of menubar. The same probelms happend only to the first three menu items. After the first three, everything is OK.

Can you guess what the gray bar in the Qt3.3 implementation is? Or give me some clue what are the ways to create it so that I can search the code.

Thank you again!

richardander
12th January 2009, 07:10
Does anyone have any thoughts about this issue?

For the gray bar in Menu_qt3.3, what are the possible object or function will be used to create it?

thank you!

richardander
11th March 2009, 00:26
I am still struggling with the problem...

Can anyone help?

Thank you!