Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: Basic Qt4 tutorial needed

  1. #21
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt4 tutorial needed

    So if you have multiple Qt installations (3.x and 4.x) do you think that the best way would be to call qmake with full path to the instalation you want to link to or do you think that Qt dir is still a reliable way that will work, say to at least 90% of the users? It seems kind of theoretical, but this is a season of moving to Qt 4.x so if you want to distribute a Qt 3.x app the instructions should be "run qmake [whatever].pro" or "run [fullpath to the qmake exec]/qmake [whatever].pro" but then again doesn't Qt 3 qmake take the paths to the include and libs dir relative to QTDIR? I am still assuming in all of my Qt related work that QTDIR is set I must admit.

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Basic Qt4 tutorial needed

    QTDIR is only relevant with Qt3. Qt4 seems to rely only on qmake. So the only thing you need to build with Qt4 is a proper installation and qmake in your path. The best proof for that is KDevelop itself -- to compile using Qt4 and having both Qt3 and Qt4 installed it is enough to do (in my case): "PATH=/usr/local/Qt4/bin:$PATH kdevelop".

    And what's more -- QTDIR is only needed during compilation (qmake relies on it, I guess)! If you distribute your compiled app, there is no need for that. Normal dynamic linker rules apply.

    With Qt4 it seems to be.... emm... different. The path to Qt libraries seems to be imprinted into the app itself, at least under Linux, so as long as I don't move my libraries, I can have them in a custom place (not usually scanned by the linker) and they will still be found (which wasn't the case with Qt3 -- libqt-mt.so had to be in a standard library path).

  3. #23
    Join Date
    Jan 2006
    Posts
    44
    Thanks
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: Basic Qt4 tutorial needed

    Quote Originally Posted by wysota
    For example try adding a resource file to your project using KDevelop. Or add it manually to the project file, then load it into KDevelop and do something so that the project file gets saved by KDevelop. Then look at the resulting .pro file.
    By project file you mean the kdevelop project file, or the .pro?

    Quote Originally Posted by wysota
    Another example -- try turning on or off some of the modules from Qt (like gui, xml or whatever). Or try to do it manually in the project file and then open KDevelop and make it resave the file. Then look at it. You can repeat that for every feature which is not present in Qt3.
    If by this you mean the .pro, I have not had the problem you describe.

    I have added new files into .pro by hand (vi), modified by config variables, then loaded up kdevelop and added new files (e.g. using the new class wizard) resulting in modifications to the pro (as verified by file timestamp checking) and not had any problems.

    Quote Originally Posted by wysota
    Third example -- install Qt3 development files along Qt4 development files. Make sure that Qt3 files are ahead of Qt4 ones in your $PATH and then try to tell KDevelop to compile using Qt4 without changing the $PATH.
    I don't mean to get snarky by that's not kdevelop, that is you telling your system what order you want things searched, and kdevelop obeying as any good app should.

    That said, I have both installed - hence the running of KDE3.5. Now, it may well be specific to gentoo, but I don't have a problem here *in managing qt4 development*. What you are describing while being useful, is beyond the question of kdevelop managing a Qt4 project. I have compiled a Qt3 app done in kdevelop 3.3.x or qt4 w/o changing anything. In fact, I just did it.

    Perhaps it because Qt3 uses QTDIR and Qt4 does not, combined with gentoo putting QT4 first in the path. That way it finds Qt4 by natural path and uses QTDIR for qt3 stuff. That was what was described in the Gentoo forum regarding qt4 alongside qt3.

    It apparently works fine if you have Qt4 first, and use QTDIR to determine Qt3's location. Why insist on doing it the other way?

    Quote Originally Posted by wysota
    Fourth example -- did it install Qt4 documentation so that you can use it from KDevelop's integrated documentation browser? Do you see both Qt3 and Qt4 documentation in the tree there?
    I never use that tool so I can't say. It's not that I don't need the docs (I do!), it is that even before I installed Qt4, the Qt docs refused to show up in kdevelop anyway. So for Qt (3 or 4). SO in that respect kdevelop didn't support managing qt3 proejcts for me. I use either "assistant" or a web archive and firefox. It also grants me more control over the look (such as text size and coloring).


    Quote Originally Posted by wysota
    If you want more examples, drop me a line.

    What is more funny -- there is an entry somewhere in the configuration dialog of KDevelop to set the path to qmake. Well... the funny part is, that KDevelop never checks that when looking for qmake. It has some paths hardcoded, so if you have qmake in some non-default location, it won't find it.
    If Kdevelop (or qmake) are not honoring environment variables, then that is a bug in them that has nothing to do with qt4. Any app that will refuse to honor enviornment variables and use a "hardcoded" environment variable should either have an option not to or at least be very up front about it.

    That said, I have not found anywhere to set the qmake path in the kdevelop option screens, nor in the project options screens. There is a qt root path in the Qt tab in the make options screen of project options.

    There is a "make command" option in the make screen. I just set it to /bin/true and it did in fact execute /bin/true as expected. I then proceeded to set it to my embedded-qt qmake (full path including the binary) and it tried to use that qmake. no problems here on that front.

    But then again, maybe I still don't understand what you're saying.

    As a newbie to Qt the QTDIR being listed in my compiler commands for my Qt4 stuff did give me pause. So I went into my project options and set a blank QTDIR. Now it shows up as such. not that it ever seemed to matter anyway.
    Which reminds me, if your various projects need differing environment variables, why not set them in kdevelop on the project options dialog? Seems to work so far here. If it doesn't that would seem to me to be a kdevelop/qmake bug, not a "kdevelop can't manage Qt4 projects" "bug".

    Cheers,
    Bill
    --
    The Real Bill

  4. #24
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Basic Qt4 tutorial needed

    Quote Originally Posted by ucntcme
    By project file you mean the kdevelop project file, or the .pro?

    If by this you mean the .pro, I have not had the problem you describe.

    I have added new files into .pro by hand (vi), modified by config variables, then loaded up kdevelop and added new files (e.g. using the new class wizard) resulting in modifications to the pro (as verified by file timestamp checking) and not had any problems.
    Are we talking about resource files here? Can you add resource files from within KDevelop?


    I don't mean to get snarky by that's not kdevelop, that is you telling your system what order you want things searched, and kdevelop obeying as any good app should.
    Well... you are wrong. If you have both Qt3 and Qt4 installed, it is the apps responsibility to invoke the proper qmake and it shouldn't force you to modify your path before starting the IDE.

    That said, I have both installed - hence the running of KDE3.5.
    Running kde 3.5 has nothing to do with it. It can be running without Qt3 qmake installed.

    Now, it may well be specific to gentoo, but I don't have a problem here *in managing qt4 development*.
    Can you change the content of the .pro file to add Qt4-specific features without changing the .pro file manually?

    What you are describing while being useful, is beyond the question of kdevelop managing a Qt4 project.
    So I guess vi supports Qt4, too, right? So a piece of paper also supports Qt4? In that sense KDevelop supports any project because it can edit text files?

    I have compiled a Qt3 app done in kdevelop 3.3.x or qt4 w/o changing anything. In fact, I just did it.
    Without touching .pro file outside kdevelop?

    Perhaps it because Qt3 uses QTDIR and Qt4 does not, combined with gentoo putting QT4 first in the path. That way it finds Qt4 by natural path and uses QTDIR for qt3 stuff. That was what was described in the Gentoo forum regarding qt4 alongside qt3.
    So this may be a gentoo patch which was applied to KDevelop. The code I pasted in this thread is from vanilla KDevelop, which doesn't do anything to distinguish between Qt3 and Qt4.

    It apparently works fine if you have Qt4 first, and use QTDIR to determine Qt3's location. Why insist on doing it the other way?
    Tell that to KDevelop people.


    I never use that tool so I can't say. It's not that I don't need the docs (I do!), it is that even before I installed Qt4, the Qt docs refused to show up in kdevelop anyway.
    Did they work in a standalone Assistant?

    If Kdevelop (or qmake) are not honoring environment variables, then that is a bug in them that has nothing to do with qt4.
    It has nothing to do with environment variables but about incorrectly identifying Qt installation directory and not supporting Qt4 options from KDevelop's KDevTrollProject.

    That said, I have not found anywhere to set the qmake path in the kdevelop option screens, nor in the project options screens. There is a qt root path in the Qt tab in the make options screen of project options.
    It is but it is ignored when looking for Qt installation.

    There is a "make command" option in the make screen. I just set it to /bin/true and it did in fact execute /bin/true as expected. I then proceeded to set it to my embedded-qt qmake (full path including the binary) and it tried to use that qmake. no problems here on that front.
    It is a hack. Hacking doesn't mean support.

    So I went into my project options and set a blank QTDIR. Now it shows up as such. not that it ever seemed to matter anyway.
    So you hacked a hack -- a double hack doesn't mean support too.

    Which reminds me, if your various projects need differing environment variables, why not set them in kdevelop on the project options dialog? Seems to work so far here. If it doesn't that would seem to me to be a kdevelop/qmake bug, not a "kdevelop can't manage Qt4 projects" "bug".
    It seems like a hack to me, and... you know the rest

    By support I mean -- I open kdevelop, enter some code, press "Build" and it builds successfully. Without even knowing that some things like QTDIR or qmake exist. That's what's an IDE for.

    I could (which doesn't mean I will) agree with a statement that KDevelop partially or passively supports Qt4, but not with "KDevelop supports Qt4" one. We are talking about an IDE here and with developing software from IDE I demand more than from a simple text editor.

    I think with KDevelop there is a problem of a wrong approach of its developers. They want Qt3 project and Qt4 project to be maintained by the same project manager. Which is wrong, because Qt3 (qmake 3) and Qt4 (qmake 4) differ very much.

  5. #25
    Join Date
    Feb 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Basic Qt4 tutorial needed

    Hi I have a doubt about the new building system using QT designer 4

    In QT3 the tutorial about qt designer talk about a first app using qt designer.
    In there you designe a form then you creat a form_ui.h in there you put the slot definitions.
    Then create a main.cpp
    and then qmake form.pro -o Makefile
    and make

    but in QT4 i design a form and then what files i need to do and what files the qmake do.?

    for example i am using de calculatorform.ui and then what i need to do.

    I use QT3 designer sucessfully. But i am lost using the new version.

    I mean no the function of the designer itself.
    So the question is.
    how to make my hello world program using QTdesigner.?

    I put these question here because i think that this title is de best for my question.
    Last edited by askot; 15th February 2006 at 10:32.

  6. #26
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt4 tutorial needed

    Quote Originally Posted by askot
    Hi I have a doubt about the new building system using QT designer 4

    In QT3 the tutorial about qt designer talk about a first app using qt designer.
    In there you designe a form then you creat a form_ui.h in there you put the slot definitions.
    Then create a main.cpp
    and then qmake form.pro -o Makefile
    and make

    but in QT4 i design a form and then what files i need to do and what files the qmake do.?

    for example i am using de calculatorform.ui and then what i need to do.

    I use QT3 designer sucessfully. But i am lost using the new version.

    I mean no the function of the designer itself.
    So the question is.
    how to make my hello world program using QTdesigner.?

    I put these question here because i think that this title is de best for my question.
    Try the new Qt 4 Edition of the Independent Qt Tutorial. You can find it here: http://qt4.digitalfanatics.org/tiqt .

  7. #27
    Join Date
    Jan 2006
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Basic Qt4 tutorial needed

    i am looking for the same : qt4 seems to be "closed" for beginners...
    i think because there is some money to make...
    for experts
    i can make a slider with qt4 but it's a "factory gaz" apps
    i am trying to translate qt3 apps to qt4 a hard work...


    Quote Originally Posted by pthomas View Post
    Something that I would love to see would be a tutorial showing how to make a basic dialog ( .ui) and use it like the majority of us will probably program.

    In other words, I think it would be really helpful to myself and many others who wish to start learning Qt4 (not Qt3) with a tutorial using the latest Kdevelop (3.3.x) with the embedded Qt4 Designer. Or even just a dialog with the designer and then how to include it and use it in the source and make a custom slot.

    Like if someone could provide details on how to create this:
    http://doc.trolltech.com/4.1/tutorial-t5.html
    by creating the dialog in Kdevelop's embedded Qt4 Designer and show how to make a custom slot and use the *.ui file, I think that would greatly help many of us out.

    Simply providing the finished source files isn't very helpful. The step that I think most of us are stuck on is getting from the dialog created in the designer ( .ui) to how to use it code wise.

    Any kind souls out there?
    Paul

Similar Threads

  1. QtScript basic tutorial
    By thomir in forum Qt Programming
    Replies: 2
    Last Post: 2nd April 2013, 04:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.