PDA

View Full Version : new to qt4



sksingh73
1st June 2010, 19:07
i am newbie to qt4. actually i have written a program in c++ of about 400 lines(ubuntu) & i want to make a user interface for it. since i am new to qt4, i want to know whether i can integrate my existing code with a form made in qt4 designer or i have to rewrite my existing code to suit requirements of qt4. thanx

tbscope
1st June 2010, 19:14
It's very difficult for anyone to give a good response without giving a little bit more information.

In general, yes, you can keep most of your code and build a Qt4 GUI around it.
If you look at the QString class for example, you can use QString ( const char * str ) for example.

So, if you have a char* somewhere in your code, you can use a label like this: myLabel->setText(QString(mycharpointer));

Zlatomir
1st June 2010, 19:21
No one but you can answer to that question.
You should be able to write an GUI for your c++ application, but how fast/easy/etc?... that depends on how the code it's structured and how fast are you learning Qt's way of c++.

But first, try at least a tutorial of Qt, just to get used to the Qt's way of doing things (it should be easy if you know c++), and then try to write a GUI for your application (and see if you need to re-write functionality)

sksingh73
1st June 2010, 19:30
thanx for quick responses. actually i am writing a server-client program, which involves 7-8 both way communication taking place between them. so i want basically two functionallity i.e a form which will have a main menu for communication, which will have option like "enter message", "send message" etc & pop-up sort of thing when any one of them receive any new message.
my only doubt is that whether i have to rewrite my code or i can just integrate my code with forms & dialogue of qt4.

tbscope
1st June 2010, 21:07
You probably don't have to rewrite it, but you will need to integrate it with the gui.
This means, you can call whatever functions you have right now from within a slot that is connected to a clicked signal from a button.

Suppose that you have a sendMessage(const char* message) function already. You can then set up a gui with a line edit (textbox) and a button. Connect the clicked signal of the button to a slot. From within the slot, call the sendMessage function using the text in the line edit.

If you want specific help ask specific questions. Your question is very broad, especially without seeing any code.