PDA

View Full Version : designing in qt3



deekayt
31st May 2006, 08:10
1. i am using qt version 3 for making gui
everything works fine till the time i donot use kde supported widgets like
kcomborequester or kimageveiwer
if i include anything of the k widgets the code doesnot make
though it qmakes
there are very good functionalities of kde supported widgets which i want to include
how to do it
even after including the header files it doesnot work

2. secondly how to incoporate the source codes of other aplications.
i mean when u make a main dialog form , u get automatic form class and
and object assoictaed with it
if i want to use other classes how to do it
multi inheritance is perhaps not supported
please guide me .

wysota
31st May 2006, 08:23
1. i am using qt version 3 for making gui
everything works fine till the time i donot use kde supported widgets like
kcomborequester or kimageveiwer
if i include anything of the k widgets the code doesnot make
though it qmakes
there are very good functionalities of kde supported widgets which i want to include
how to do it
even after including the header files it doesnot work
Some KDE widgets require KApplication instance instead of QApplication and you need to link with "kdeui" library to be able to use those kde-provided widgets.



2. secondly how to incoporate the source codes of other aplications.
i mean when u make a main dialog form , u get automatic form class and
and object assoictaed with it
if i want to use other classes how to do it
multi inheritance is perhaps not supported
please guide me .
you can use multiple inheritance as long as you don't inherit from two QObject descendants. Besides that, any C++ technique is allowed and works exactly like in plain old C++. After all, Qt is only a library which provides new functionality -- it doesn't introduce any limitations on C++ functionality.

deekayt
31st May 2006, 18:00
dear freind

i have tried your suggestion.
I will give some more details of the program which I have.
I have made a GUI in QT 3.3.4 ( on Suse10) . I have utilized the Main Dialog.
All the objects are created from FORM class (which iself is derived from QMainWindow as class Form : public QMainWindow)
Now my requirement is to be able to show an image / any ( not only text) file when i click on a button in this form or when a image /text file is selected from a file menu and copied to a textedit widget.
I have tried using system commands like system ( " gedit filename " or " "image veiwer filename")
but this blocks the application and one has to close the gedit window to do anything on the form.
Moreover the filename is static in this scenario. So i tried script file by inputing the name of the file and running the script( which also had the system command giving the same problem)
hence i have to use some class to show these files.
how to go about it.
i have tried one similar FAQ as
-------------------------------------------------------------------------
Assuming you have two form classes: Form1 and Form2 and that Form1 has a pushbutton "button" child and Form2 is derived from QDialog.
Add a custom slot to Form1 and fill it with:

void Form1::openForm2(){
static Form2 *form2 = new Form2(this);
form2->show();
form2->activateWindow(); // or form2->setActiveWindow() in Qt3
form2->raise();
}
If you want Form2 to be modal change it to:

void Form1::openForm2(){
Form2 form(this);
form2.exec();
}
Then you have to connect a proper signal to this slot. In the constructor of Form1 add:
connect(button, SIGNAL(clicked()), this, SLOT(openForm2()));
---------------------------------------------------------------------------------

but it didnot work out.
i looked for the "kdeui" lib and found
kdeui.so size : 63864 bytes
kdeui.tag size : 1,086,440 bytes
kdeuimod.sip size : 3912 bytes

which one do i include and how
please guide me.

wysota
31st May 2006, 18:05
I don't see how is your issue related to kde custom widgets... All you need to run an external application is QProcess, you don't need any kde related stuff.

But anyway, if you want to use kdeui, you just have to link with it, for example by adding LIBS+=-lkdeui to your .pro file (remember to run qmake afterwards).

deekayt
31st May 2006, 18:20
you are correct
in veiw of the Qprocess my problem has got very less to do with Kwidgets.

In order to call Qprocess. fn() i will have to do something like this in .ui.h

void FORM2::openfile()
{
pushbutton->----- / here will the function of Qprocess work
}

and i shall be connecting the pushbutton to the slot openfile()

how do i ensure that form2 class takes functions from Qprocess also.

wysota
31st May 2006, 21:04
Just create a QProcess object either as a member of the class or in the slot which makes use of it (be sure it is allocated on heap in the latter case, so that it doesn't go out of scope).

deekayt
1st June 2006, 14:30
i have now done the following


#include <qprocess.h>
void Form2 :: showimage()
{
QProcess* proc = new QProcess( this );
proc->addArgument( "eog " );
proc->addArgument("/root/images/dk.jpg");
proc->start();
}

// where showimage is a slot connected by pushbutton
i am able to qmake and make also
but when i run
i get the following message
---------------------------------------------------------------------------
linux:~/prac # ./prac
name = latin
name = ipa-x-sampa
name = viqr
name = hangul2
name = hangul3
name = romaja
name = tutcode
name = tcode
name = skk
name = canna
name = anthy
name = py
name = pyunihan
name = pinyin-big5
name = direct
WARNING: please edit ~/.scim/global and change /DefaultConfigModule to kconfig
---------------------------------------------------------------------------
i am not able to find ~/.scim/global in the directories even after an extensive search .
please guide me .

wysota
1st June 2006, 15:51
But what does it have to do with Qt? The error comes from the external app you start with QProcess...

deekayt
1st June 2006, 16:49
but sir
my problem is not still sorted out
infact on he command line "eog filename" works fine
even system ("eog filename" ) works
then why not qprocess
please guide me
thanks in advance

wysota
1st June 2006, 16:53
I'm sorry, I don't know this "eog" app, so I won't be able to help you. In general it looks like there is something wrong with your kde installation (or scim). Do you get the same message while running "eog" from the command line?

Anyway you might try what the message suggests -- create ~/.scim/global and set /DefaultConfigModule to kconfig. If you have any doubts here, google is your friend.

BTW. Next time please use the "[code]" tags to format the source code you enter here. The tag is available under the "#" button in the editor toolbar.