LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   .ui.h / kdevelop question (https://www.linuxquestions.org/questions/programming-9/ui-h-kdevelop-question-395714/)

graemef 01-10-2006 03:13 PM

Hi,

Okay you have just reminded me that QT was not free on Windows prior to release 4. However you can use QT4 on Kdevelop, I think what you need to do is to change the QPATH variable in you bash_profile file. I think that's what I did for Fedora but I'm working on windows today so I can't check :( ...

graeme.

Mara 01-10-2006 03:36 PM

Quote:

Originally Posted by eantoranz
As I found no QT3 for windows, I guess I'll have to move up development on linux to QT4. Fortunately this is just a test and I can tweek as much as needed till I "figure it out".

In fact there is Free QT3 for Windows. It was distributes with Qt book, I don't know how the licence looks now, however (the book is now downloadable).

Quote:

How can I force kdevelop to use qt4? (it's a ubuntu breezy box).
Tricks... If you change PATH in configuration to point first to new executables, you have it done. Also, note that Qt4 has Qt3 compatibility classes (haven't tried them, through).

eantoranz 01-11-2006 07:52 AM

Here's my path:

Code:

$ echo $PATH
/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/home/antoranz/bin

What should it say instead?

and the other possibility: QPATH. That variable is not set in my environment. What should it be?

graemef 01-11-2006 08:20 AM

Okay I didn't quite get it right, the environment variable is QTDIR...

It's set on my system as:

Quote:

$ echo $QTDIR
/usr/local/Trolltech/Qt-4.1.0
$ echo $PATH
/usr/local/Trolltech/Qt-4.1.0/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/phing/bin:/home/graeme/bin
Obviously I've QT version 4.1 installed and this is the default path from a standard configure: make: make install.

hope that helps

graeme.

eantoranz 01-11-2006 08:25 AM

Good! But it's not set in my environment either. :-)

eantoranz 01-11-2006 08:26 AM

Perhaps this can help you help me:

Code:

$ dpkg -l qt'*'
Desired=Unknown/Install/Remove/Purge/Hold
| Estado=No/Instalado/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: mayúsc.=malo)
||/ Nombre                  Versión                Descripción
+++-========================-========================-================================================================
un  qt-designer              <ninguna>                (no hay ninguna descripción disponible)
un  qt-designer-doc          <ninguna>                (no hay ninguna descripción disponible)
un  qt-doc                  <ninguna>                (no hay ninguna descripción disponible)
un  qt3-assistant            <ninguna>                (no hay ninguna descripción disponible)
ii  qt3-designer            3.3.4-8ubuntu5          Qt3 Designer
ii  qt3-dev-tools            3.3.4-8ubuntu5          Qt3 development tools
ii  qt3-doc                  3.3.4-8ubuntu5          Qt3 API documentation
un  qt3-linguist            <ninguna>                (no hay ninguna descripción disponible)
un  qt3-qtconfig            <ninguna>                (no hay ninguna descripción disponible)
un  qt3-tools                <ninguna>                (no hay ninguna descripción disponible)
ii  qt4-dev-tools            4.0.0-3ubuntu1          Qt 4 development tools
ii  qt4-doc                  4.0.0-3ubuntu1          Qt 4 API documentation


graemef 01-11-2006 08:59 AM

I don't know where the package will put qt but try a slocate

Code:

$ slocate include/QtCore/QString
hopefully that will help.

graeme.

eantoranz 01-11-2006 12:36 PM

I have /usr/include/qt[34]

inside /usr/include/qt4/ there's QtCore and QtCore/QString

so
Code:

QDIR=/usr/include/qt4/
PATH=$QDIR/bin:$PATH

should do the trick? :-)

eantoranz 01-11-2006 12:43 PM

and about the other problem: I finally made the "String" show up:

Code:

QString("Hay ").append(QString::number(consulta.size())).append(" registros en la consulta. Desea verlos?")
Is there a more elegant way to make it? Or that's the way to go? I'm willing to learn the QT style guide, so to speak. ;-)

eantoranz 01-11-2006 12:58 PM

and bad news (for me, of course). I don't have a bin inside qt4:

Code:

/usr/include/qt4$ find ./ -iname bin'*'
/usr/include/qt4$

That's gonna be a problem, right? :scratch:

I digged a little further:
Code:

$ dpkg -L qt4-dev-tools
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/qt4-dev-tools
/usr/share/doc/qt4-dev-tools/README
/usr/share/doc/qt4-dev-tools/copyright
/usr/share/doc/qt4-dev-tools/changelog.Debian.gz
/usr/share/menu
/usr/share/menu/qt4-dev-tools
/usr/share/qt4
/usr/share/qt4/phrasebooks
/usr/share/qt4/phrasebooks/danish.qph
/usr/share/qt4/phrasebooks/dutch.qph
/usr/share/qt4/phrasebooks/finnish.qph
/usr/share/qt4/phrasebooks/french.qph
/usr/share/qt4/phrasebooks/german.qph
/usr/share/qt4/phrasebooks/italian.qph
/usr/share/qt4/phrasebooks/norwegian.qph
/usr/share/qt4/phrasebooks/russian.qph
/usr/share/qt4/phrasebooks/spanish.qph
/usr/share/qt4/phrasebooks/swedish.qph
/usr/bin
/usr/bin/assistant-qt4
/usr/bin/designer-qt4
/usr/bin/linguist-qt4

If I use update-alternatives I can make assitant-qt4, designer-qt4 and linguist-qt4 the "prefered" qt applications. You think that will be enough to use QT4 by default when using kdevelop? :scratch:

Mara 01-11-2006 04:14 PM

The set is quite short. What you really need (apart from assistant and designer): uic, moc, qmake.

eantoranz 01-12-2006 08:25 AM

after a little 'update-alternatives', I have this:

Code:

$ qmake -v
QMake version: 2.00a
Using Qt version 4.0.0 in /usr/lib
$ moc -v
Qt Meta Object Compiler version 58 (Qt 4.0.0)
$ uic -v
Qt user interface compiler 4.0.0.

What's next? simply call kdevelop3? or there's more tweeking to do?

PS
I just ran kdevelop, my old project, and asked to compile and it says:
QDIR=/usr/share/qt3
and it compiled successfully. I expected it to fail big time. :scratch:

eantoranz 01-12-2006 01:36 PM

qt3 to qt4
 
I thought it was gonna be an easy thing to change from qt3 to qt4, but it seems it isn't just a matter or running the new verion of qmake. I'll have to remake my very first project to see how qt4 works, cause there are many changes.

Will keep you posted. :-) Thanks for your help so far.

PS I'll be working without kdevelop till I figure the whole thing out.

eantoranz 01-13-2006 09:08 AM

some progress on QT4
 
I'm starting to make some progress on QT4, though not working on kdevelop, but kate, designer, konsole and so on. :'(

I have noticed two problems:

When I try to make my project, it doesn't do the uic of the form I'm working on, though I included it in the src.pro file.

Code:

SOURCES += main.cpp
FORMS += formas/principal/principalbase_qt4.ui
TEMPLATE = app
CONFIG += release \
warn_on \
thread \
qt
TARGET = ../bin/squidcalc

Code:

$ qmake src.pro; qmake; make
g++ -c -pipe -O2 -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp:25:51: error: formas/principal/ui_principalbase_qt4.h: No existe el fichero o el directorio
main.cpp: In function ‘int main(int, char**)’:
main.cpp:35: error: invalid use of undefined type ‘struct QDialog’
/usr/include/qt4/QtGui/qwindowdefs.h:39: error: forward declaration of ‘struct QDialog’
main.cpp:36: error: ‘Ui’ no se puede declarar
main.cpp:36: error: ‘PrincipalBase’ no se declaró en este ámbito
main.cpp:36: error: expected `;' before ‘ui’
main.cpp:37: error: ‘ui’ no se declaró en este ámbito
main.cpp:38: error: invalid use of undefined type ‘struct QDialog’
/usr/include/qt4/QtGui/qwindowdefs.h:39: error: forward declaration of ‘struct QDialog’
make: *** [main.o] Error 1

(by the way, when do I have to run "qmake .profile" or "qmake standalone" or both? :scratch:)

If I uic it myself, going to that directory, then it works:
Code:

$ cd formas/principal/
$ uic principalbase_qt4.ui -o ui_principalbase_qt4.h
$ cd -
$ make
g++ -c -pipe -O2 -D_REENTRANT -Wall -W -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I. -o main.o main.cpp
g++  -o ../bin/squidcalc main.o  -L/usr/lib -L/build/buildd/qt4-x11-4.0.0/lib -lQtGui -L/usr/X11R6/lib -laudio -lXt -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lXext -lX11 -lm -lQtCore -lfontconfig -lz -ldl -lpthread
$

then I can run the application.

Finally, the second problem: when I run the application, it fails to stop when I close the main form. I have to ctrl+c it.

Here's the main code:
Code:

        QApplication a( argc, argv );
        QDialog *window = new QDialog;
        Ui::PrincipalBase ui;
        ui.setupUi(window);
        window->show();
        a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
        return a.exec();

I added the a.connect() as an attempt to make the application close, but it failed too. What am I missing? :scratch:

graemef 01-13-2006 09:16 AM

There is a conversion program from QT3 to QT4. Not certain how accurate it is but worth running your program through that first.

graeme.


All times are GMT -5. The time now is 07:27 PM.