Re: Visual Studio .NET & QT
Quote:
Originally Posted by
fruzzo
if I make some changes in the source code with VS the aren't applicated in Qt Designer. Why is there this problem?
Does this mean that you edit the code generated automatically from .ui files?
Re: Visual Studio .NET & QT
Quote:
Originally Posted by
jacek
Does this mean that you edit the code generated automatically from .ui files?
Yes I import the project .pro in VS...than I change code adding the body of members functions...
I read about subclassing but I don't understand very well the mechanism :(
Re: Visual Studio .NET & QT
Quote:
Originally Posted by
fruzzo
Yes I import the project .pro in VS...than I change code adding the body of members functions...
Is that the .ui.h file?
Quote:
Originally Posted by
fruzzo
I read about subclassing but I don't understand very well the mechanism :(
It's not that hard, every .ui file represents a class, which you can subclass to add whatever functionality you need. The integration module probably can do that for you.
Re: Visual Studio .NET & QT
Quote:
Originally Posted by
jacek
Is that the .ui.h file?
It's not that hard, every .ui file represents a class, which you can subclass to add whatever functionality you need. The integration module probably can do that for you.
Qt 3.3 don't have integration module for VS.
Now I'm think to pass to VS2005...there is something like QMsNetSetup.msi for adding Qt toolbar at VS2005?
Re: Visual Studio .NET & QT
Quote:
Originally Posted by
jacek
Is that the .ui.h file?
no I create a gui called myGUI.ui.......than in VS I have myGUI.ui, myGUI.h and myGUI.cpp
and I modify this last two.
Re: Visual Studio .NET & QT
Quote:
Originally Posted by
fruzzo
no I create a gui called myGUI.ui.......than in VS I have myGUI.ui, myGUI.h and myGUI.cpp
and I modify this last two.
I see, that's what I was afraid of. You shouldn't do that. There are even warnings in those files, which say that. It's because these files are automatically generated everytime you change the .ui file, which means that you will loose all your modifications.
That's why you should use the subclassing approach (it will also save you a bit of pain, when you switch to Qt4). First you have to rename yourGUI.ui to yourGUISkel.ui (or youGUIBase.ui or whatever name you like) and also you will have to rename the widget from yourGUI to yourGUISkel (using Qt Designer). This way Qt will generate youGUISkel class instead of yourGUI. It's because you're going to write yourGUI yourself. It should look like this:
Code:
// yourGUI.h
#include "yourGUISkel.h"
class yourGUI : public yourGUISkel
{
Q_OBJECT
...
};
// yourGUI.cpp
#include "yourGUI.h"
yourGUI
::yourGUI( QWidget * parent
) : yourGUISkel( parent )
{
...
}
Since there is Q_OBJECT macro in yourGUI.h, you need yourGUI.moc file (qmake will make it for you --- you just have to add yourGUI.h to HEADERS variable and yourGUI.cpp to SOURCES in the .pro file and re-run qmake).
Now you can safely edit the youGUISkel.ui file in Qt Designer and add implementation in yourGUI.{h,cpp} files.