PDA

View Full Version : qt4 uic uses qt5 function



ravas
15th April 2016, 22:01
I recently unchecked 'translatable' for the currentText property of a combobox in the ui designer.
Someone else noted that Qt 4.8.6 for Ubuntu decided to to create a ui_ file that has setCurrentText, which is not in Qt4;
therefore, it fails to build.

Is this a Qt problem, Ubuntu package issue or am I missing something?

The only solution I can think of is to manually remove the currentText property from the .ui file.

https://github.com/LibreCAD/LibreCAD/issues/697

d_stranz
16th April 2016, 22:25
It is possible that the version of Qt Designer / Qt Creator that is being used to create the UI file is a Qt5 version. Look in the install directory to see if it contains Qt5 libraries. If you have both Qt4 and Qt5 versions installed, make sure that the Qt4 version of Qt Designer is the one being used for the Qt4 UI editing.

ravas
16th April 2016, 22:40
I'm using Qt 5.6.0

The person reporting the problem is simply trying to build using Qt 4.8.6

I also thought that they might be using the Qt5 uic somehow... but they don't think so.

Added after 9 minutes:

I would expect the Qt4 uic to ignore the currentText property.
Why would the Qt4 uic create ui_ files that use a Qt5 function (setCurrentText)?
This seems like a Qt bug, unless the reporter's Ubuntu package is using the Qt5 uic.

anda_skoa
17th April 2016, 11:41
My guess would be that UIC doesn't necessarily know the classes, i.e. it has to be able to deal with custom widgets, or widgets derived from standard widgets ("promote widget" functionality in designer).

So when it encounters a property value assignment, it might simply assume that the setter for the property is set + property name as this is true for all of Qt's built-in properties.

So in this case the problem is that the developer used a Qt5 based designer and set a property value for something that is not a settable property in Qt4.
The fix is to not do that.

To avoid that in the future, using the Qt4 based designer would be recommendable.

Cheers,
_