PDA

View Full Version : Qt updates and ui display on Ubuntu



fulin
30th December 2010, 10:13
Hello,

I'm using Qt on Ubuntu 10.04. Each time after updating Qt, I got some problem for the Qt Creator ui display.

* When I updated Qt to v4.6.1 and Creator to 1.3.1, the QGroupBox board in QCreator IDE disappeared. But when the UI is executed, the board is there.

* When I updated Qt to v4.7.0 and Creator to 2.0.1, the icon image in the QPushButton disappeared when the UI is executed, but it shows in the Creator IDE.

Any idea about what's wrong with my QT application and any suggestions?

Thank you!:D

wysota
30th December 2010, 13:22
Do you use your distro's package management facilities to upgrade Qt and Creator or did you download those components yourself in the source/binary form from Nokia's website and install them yourself?

fulin
30th December 2010, 13:32
I did both -- from Ubuntu Synaptic Package Manager and from Norkia's website.

wysota
31st December 2010, 12:25
Do you use a custom widget style? Are you running gnome or kde?

fulin
31st December 2010, 12:32
no custom widget style and running gnome.

wysota
31st December 2010, 12:53
Try running Creator (or any other app that behaves incorrectly) with "-style plastique" and see if it helps.

fulin
31st December 2010, 14:33
Running qtcreator -style plastique for both creator v1.3.1 and 2.01, the groupbox board is shown in IDE. But still the icon image was not loaded when the UI was executed. In IDE the icon was shown on the pushbutton. my icon image format is png.

Added after 43 minutes:

Hi

I think the problem may related to qt ui update. My ui application was started from a version that is older than Qt 4.6.1. Update to qt 4.6.1 no big problem, just this style issue for qgroupbox. But update to Qt 4.7, I just find, not only icon display problem but also the application ui is totally wrong.

* When I try to edit ui. it goes to Design mode.
* Add a pushButton, it shows on the ui in IDE. But cannot find it on the app.cpp file. for example ui-> no such button name.
* Build project and run the project, the ui was totally no change, even though I add a pushButton and also it is shown on the ui in IDE.

wysota
31st December 2010, 16:23
Clean the project completely (i.e. make distclean) and rebuild it again from scratch (qmake && make).

fulin
31st December 2010, 18:06
From scratch it works well even just with "make". But is there anyway to do the same thing in Creator IDE?

I tried many different combination of "clean project", "rebuild project" and "qmake" in the Build menu of Creator IDE, but no help. Icon image not show and changes on ui not added to the project. Is there a bug in the Creator v2.01? Or I must do every thing for the ui from scratch?

wysota
31st December 2010, 18:13
You probably have shadow build enabled and Creator builds your project in a different directory. You probably use relative paths to your images and if they are stored in the directory with the source code then the binary can't find them because it is executed from another directory. It's best to embed images directly in the executable using Qt's resource system.

fulin
31st December 2010, 19:41
Hello wysota,

You are right. I disabled the "shadow-build" in the project setting and now the Qt4.7 and Creator 2.0.1 work well for my application.

Thank you very much!:)

wysota
2nd January 2011, 00:15
Just remember that shadow build is not the real problem here. The problem is using relative paths to images. You will still have this problem if you run the application by clicking its icon in file explorer (at least some of them).