PDA

View Full Version : qt3 to qt4 - uic issue



hvengel
25th February 2007, 02:09
I am just starting to port my app from qt3 to qt4. I have set up the project file to use the qt3 compatibility libraries as an initial step to get the port up and running. Then I intend to convert the ui files. I am running into a problem with the qmake generated make file only running uic3 against the main dialog ui file and no ohers. That is I only get the header file for one of my ui files and none of the others are processed.

I think the problem might be related to how I have the directories structured since I have each dialog in it own directory (each of these directories has the ui file along with the .h and .cpp files for the derived classes). All of these are explicitly listed in the project file and the resulting qmake generated make file worked as expected with qt3 (it would uic and moc all of the files that needed this). In addition the the project file has the correct locations for the local include path to pick up all of the header files but the qmake generated make file is missing this information and I had to add this by hand to get far enough to find this issue. What do I need to do to my project file to get qmake to generate a working make file?

Normally I have been using scons as my build system and I use the qt project file as part of my localization process and I periodically test it to make sure it is in sync with the current project image. But migrating the scons build scripts is another porting issue that I want to hold off on until I get the QT port working. Again I tested qmake generated make file before making any modification for the port and before running qt3to4 against the project.

Here is my project file:


TEMPLATE = app
LANGUAGE = C++

CONFIG += qt warn_on debug

LIBS += -llcms -ltiff -L/usr/lib -lqassistantclient -lvigraimpex

INCLUDEPATH += src/liblprof src/argyll/h src/argyll/numlib src/argyll/rspl src/libqtlcmswidgets src/wwfloatspinbox

QT+=qt3support

HEADERS += src/liblprof/lcmsprf.h \
src/lprofqt/lprofmain.h \
src/monqt/monitorvalues.h \
src/checkerqt/profilechecker.h \
src/IDqt/profileid.h \
src/parmsqt/profileparms.h \
src/gammaqt/setgamma.h \
src/reference_inst_qt/installreffile.h \
src/argyll/h/sort.h \
src/argyll/numlib/dhsx.h \
src/argyll/numlib/dnsq.h \
src/argyll/numlib/ludecomp.h \
src/argyll/numlib/numlib.h \
src/argyll/numlib/numsup.h \
src/argyll/numlib/powell.h \
src/argyll/numlib/rand.h \
src/argyll/numlib/sobol.h \
src/argyll/numlib/svd.h \
src/argyll/numlib/zbrent.h \
src/argyll/rspl/rev.h \
src/argyll/rspl/rspl.h \
src/argyll/rspl/rspl_imp.h \
src/libqtlcmswidgets/qtlcmswidgets.h \
src/wwfloatspinbox/wwfloatspinbox.h

SOURCES += src/liblprof/cmshull.c \
src/liblprof/cmslm.c \
src/liblprof/cmslnr.c \
src/liblprof/cmsmatn.c \
src/liblprof/cmsmkmsh.c \
src/liblprof/cmsmntr.c \
src/liblprof/cmsoutl.c \
src/liblprof/cmspcoll.c \
src/liblprof/cmsprf.c \
src/liblprof/cmsreg.c \
src/liblprof/cmsscn.c \
src/liblprof/cmssheet.c \
src/libqtlcmswidgets/qtlcmswidgets.cpp \
src/lprofqt/lprofmain.cpp \
src/lprofqt/main.cpp \
src/monqt/monitorvalues.cpp \
src/checkerqt/profilechecker.cpp \
src/IDqt/profileid.cpp \
src/parmsqt/profileparms.cpp \
src/checkerqt/qtcietonge.cpp \
src/checkerqt/qtdrawcurve.cpp \
src/gammaqt/setgamma.cpp \
src/reference_inst_qt/installreffile.cpp \
src/argyll/numlib/dhsx.c \
src/argyll/numlib/dnsq.c \
src/argyll/numlib/ludecomp.c \
src/argyll/numlib/numsup.c \
src/argyll/numlib/powell.c \
src/argyll/numlib/rand.c \
src/argyll/numlib/sobol.c \
src/argyll/numlib/svd.c \
src/argyll/numlib/zbrent.c \
src/argyll/rspl/opt.c \
src/argyll/rspl/rev.c \
src/argyll/rspl/rspl.c \
src/argyll/rspl/scat.c \
src/argyll/rspl/spline.c \
src/wwfloatspinbox/wwfloatspinbox.cpp

#The following line was changed from FORMS to FORMS3 by qt3to4
FORMS3 = src/lprofqt/lprofmainbase.ui \
src/monqt/monitorvaluesbase.ui \
src/checkerqt/profilecheckerbase.ui \
src/IDqt/profileidbase.ui \
src/parmsqt/profileparmsbase.ui \
src/reference_inst_qt/installreffilebase.ui \
src/gammaqt/setgammabase.ui

IMAGES = src/images/Norman_Koren-small.png \
src/images/lcms.png \
src/images/blue-grad.png \
src/images/green-grad.png \
src/images/orange-grad.png \
src/images/yellow-grad.png \
src/images/Norman_Koren-big.png

unix {
UI_DIR = .ui
MOC_DIR = .moc
OBJECTS_DIR = .obj
}


#The following line was inserted by qt3to4
QT += assistant
#The following line was inserted by qt3to4
CONFIG += uic3


As you can see the FORUMS3 section lists 7 ui files. Only the first one on the list is being processed. I double checked to make sure that I was using the correct qmake (IE. from qt4).

The next post will have the qmake generated make file:

jacek
25th February 2007, 02:43
The next post will have the qmake generated make file:
Please, post it again, but this time as an attachment.

hvengel
25th February 2007, 02:57
Here it is:

hvengel
25th February 2007, 02:59
Also I figured out what I needed to do to get qmake to generate the right include list in the Makefile. So what I need to figure out is how to get it to generate a Makefile that will uic3 all of the ui files.

jacek
25th February 2007, 03:09
So what I need to figure out is how to get it to generate a Makefile that will uic3 all of the ui files.
It looks like all of the rules are already there, but they aren't triggered for some reason. Try cleaning .moc, .obj and .ui directories.

hvengel
25th February 2007, 23:33
Cleaning those directories did not help. It only generates the header file for the first dialog and then the build fails because it can't find the other header files that uic3 should have generated. So it appears to me that even though all the rules are in the make file they are for some reason not correctly formed to result in the correct files being generated..

When I try to run uic3 against one of the ui files I get:

uic3 src/parmsqt/profileparmsbase.ui -o .ui/profileparmsbase.h
uic3: property `lineWidth' for widget `smoothnessButtonGroup' of type `Q3ButtonGroup' is not supported. Line: 336 Column: 45
uic3: property `paletteBackgroundColor' for widget `textLabel14' of type `QLabel' is not supported. Line: 496 Column: 39

After running this the header file is created and looking at it it does appear to be OK. Running uic3 -impl ... results in an error message about not being able to parse the fist line of the header file and an empty implementation file. But looking that the qt4 docs I am not sure that I have to run uic3 -impl ... since it appears that everything needed is created inline in the header file.

Even after creating the header file for the first file that the build is issuing a "no such file..." error for it still issues the same error. So for some reason the build is not looking in .ui even though the make file has -I.ui in the include path. I discovered that if I copy the uic3 generated header to the the same directory as the base .ui file that then the build finds it. I then ran uic3 by hand to generate the headers in a location where the build would find them. At that point I start seeing all kinds of compiler errors. Which is something I would expect on my code. So where this is happening with my as yet un-ported code I don't have an issue. But I am also seeing this in the uic3 generated header files which is something that I would not expect. Here is an example:

./profilecheckerbase.h: In member function 'void Ui_ProfileCheckerBase::setupUi(QDialog*)':
./profilecheckerbase.h:289: error: 'class Q3Table' has no member named 'setAutoMask'

Looking in the above header file I find that this is happening with an object named ResultsGrid. Opening the ui file in designer 3 and navigating to this object I can't find a property having a name that corresponds to this so I don't know how to change the ui file to get rid of the error. Does that mean that I need to hand edit the generated header file? If so this is a very ugly issue in that it means that using uic3 I can no longer make changes to the ui files without it tuning into a major operation that requires lots of hand steps to get the project to build. By the way commenting out the one line in the generated header file does allow the build to get farther.

At this point I would have to say that I am confused about how this should all work since much of it appears to be broken and none of the existing documentation seems to cover any of the issues I am seeing. My gut tells me that there must be something that I am doing wrong but I don't know what that is.

hvengel
26th February 2007, 02:12
A little follow up. I am to the point where I can get the app to build and run using the designer 3 ui files. There is lots of stuff that does not work the way it should. For example I have some custom widgets that are not fully functional and my qassistantclient based help system is not working. But most of the major functionality is working even though the ui looks ugly.

I am using a third party SpinBox for floats (wwfloatSpinBox) for qt3 and at this point I just made it a crude reimplementation of QDoubleSpinBox to get this initial port running so that I would not have to mess with the ui files at this stage. As a next step I am going to convert the ui files to QT 4 ui files and replace the wwfloatSpinBox stuff with QDoubleSpinBoxes and then work on my custom widgets. I suspect that migrating the ui files to designer 4 should help with the build issues I was having with uic3.

Is there a good source document that describes how to setup custom widgets in designer 4? I don't need anything fancy like setting up a plugin for the custom widgets but I would like to be able to see a (visible) place holder in designer when I am placing and sizing the widgets. By the way when I try to use uic3 -convert to convert a ui file from designer 3 to designer 4 all I get is an empty file. It appears that I can open the ui file in designer 4 and it will convert it.

jacek
26th February 2007, 20:07
Is there a good source document that describes how to setup custom widgets in designer 4?
You can try to promote a built-in widget to a custom widget.

http://doc.trolltech.com/4.2/designer-using-custom-widgets.html#promoting-widgets

hvengel
26th February 2007, 22:44
Well I already have a set of plugins for my custom widget set. I would like to figure out how to improve what I have to make the plugin simpler to build and install. There are other developers who work on this project and I want it to be simple to build and install the plugin(s). I have four related widgets that are all derived from the same base class (which is derived from a Qt class but with significant extensions). These widgets are highly specialized and are only useful for applications that do stuff related to creating ICC profiles.

These are all used in my app to do similar things but with different types of external resources (profiles and CGATS files) and with slightly different user presentations depending on the context. I would like to be able to create a single plugin library that has all four widgets in it. But so far I have not been able to get this to build as a single plugin that will also make all four widgets available. But there are some widget plugin libraries that come with Qt4 that have many widgets in a single library. One example is the Qt3 compatibility widget set. So I know it is possible to do but none of the examples I have found show how to do this (IE. they only export a single widget class).

I am sure that there is just something that I am not doing right but I do not know what that is. The basic problem is that it will not build if I have more than one Q_EXPORT_PLUGIN2 macro even if I separate the individual plugin implementations and header of the four widgets into individual files. This means that I can only have one custom widget per library file and that I must build and install each separately. What I would like is to have one project file that generates one Makefile that will correctly build and install all four widgets. Anyone have any ideas about how to do this?

By the way I have converted my ui files to designer 4 and I am still having the problem with the generated make file not running uic or moc.

jacek
27th February 2007, 23:45
I would like to be able to create a single plugin library that has all four widgets in it. But so far I have not been able to get this to build as a single plugin that will also make all four widgets available.
You need this: http://doc.trolltech.com/4.2/qdesignercustomwidgetcollectioninterface.html

hvengel
4th March 2007, 02:59
That was it thanks.