PDA

View Full Version : Porting Qt3 linux app to windows qt4



Philip_Anselmo
11th May 2006, 18:02
I'm programming on linux fedora core 1 with qt 3.1.2 the program works fine on linux and I need now to try it on windows... I'm using a VMWARE with windows 98 and qt 4.1.2 with mingw 3.4.2 special. the one that cames with the qt installer...
I ported my app to qt4 as the doc sais
inserted line Qt += qt3support on the pro file
qt3to 4 the cpps and the pro
uic3 -convert the ui
then when doing the qmake -win32
It tells me..

QMAKESPEC has not been set, so configuration cannot be deduced.
Error procesing the.... my .pro file
so I know I have to configure it... but...

How? :confused:

jacek
11th May 2006, 18:05
QMAKESPEC has not been set, so configuration cannot be deduced.
There should be something like "Qt Command prompt" in the Start -> Applications -> Qt (or whatever it's called) menu --- it should set all required environment variables when it starts.

Philip_Anselmo
11th May 2006, 20:51
thanks JaCeK
the qmake passes, but now when comiling it shows me a lot of errors like invalid database connection and errors with the pointer typo of the qdatabase :confused:

I've compiled the sqltable example from qt 3.1.2 .. on a windows xp wich I haven't anymore :(

and were the same errors so I just changed from pointer to simple objects :o removing the * and changing the -> for . and then it worked.. but now on the 98 it keeps showing me errors

the code if you want to see it is on:
http://philipsoft.dajoob.com/downs/usr/pro1.zip

on linux it compiles without any errors or warnings but on windows it just won't compile...
:mad:

jpn
11th May 2006, 21:27
Steps I did to get it compile on WinXP + Qt 4.1.2:
- converted form.ui to qt4
- sql1.pro, added line "QT += qt3support sql"
- main.cpp, fixed include:


#include "ui_form.h" // note "ui_" prefix

- main.cpp, fixed ui loading (direct approach):


Q3MainWindow w;
Ui_Form ui;
ui.setupUi(&w);
w.show();

- conexion.cpp, fixed includes:


#include <q3datatable.h> // qt3support
#include <q3sqlcursor.h> // qt3support
#include "ui_form.h" // note "ui_" prefix
#include <qsqlerror.h> // added

- conexion.cpp, fixed defaultDB variable:
either:


QSqlDatabase defaultDB; // remove '*'
// and replace occurrences of "defaultDB->" to "defaultDB."


Edit: Not that it'd be fully working, but at least it compiles.

Philip_Anselmo
11th May 2006, 22:32
I didn't quit understood the ui changes

[QUOTE=jpn]
- main.cpp, fixed include:


#include "ui_form.h" // note "ui_" prefix

- main.cpp, fixed ui loading (direct approach):


Q3MainWindow w;
Ui_Form ui;
ui.setupUi(&w);
w.show();


I mean why? is that a change made on qt?
the ui_form.h is the new ui made by:

uic3 -convert form.ui > ui_form.ui?

:o

if isn't too much trouble would you explain that to me? please
:crying:

jpn
12th May 2006, 05:06
I mean why? is that a change made on qt?
the ui_form.h is the new ui made by:

uic3 -convert form.ui > ui_form.ui?
I saved the newly converted "form.ui" as the same name. (I actually just opened it in the Qt Designer which is able to convert the .ui file automatically. You may aswell convert it with uic3.)

The user interface compiler (uic) generates a header file of the form named in this way:

%.ui -> ui_%.h ("form.ui" -> "ui_form.h")
Which is the file we must include in order to be able to use the form.
There are basically 3 different ways of using a form designed in the designer. The direct approach is a quick and simple way to use forms, but is very inflexible. You surely want to use one of the 2 other ways. Read more about these by following the link below.

Further documentation: Using a component in Your Application (http://doc.trolltech.com/4.1/designer-using-a-component.html)

Philip_Anselmo
12th May 2006, 20:41
I tryied that too :( but no results
:confused:

it sais that Q3MainWindow is an undefined function and
';' expected before w :confused:

and some errors on qsqldatabase.h:208 and so on and so on..

I'm now installing a windows xp SP2 on a virtual machine to try to compile on that...

I hope it works:o

safknw
15th May 2006, 18:44
QMAKESPEC has not been set, so configuration cannot be deduced.

There is another way to solve this. You have to set environment variable.
Start command prompt, write
set QMAKESPEC=win32-g++
For mingw. You have 2 do this everytime when start a command prompt.

In win xp. u can set a new enviroment variable by Contrl panel->system-> Advance -> environment variable.
here define a new variable. QMAKESPEC and set its value as win32-g++