Results 1 to 5 of 5

Thread: new to qt4

  1. #1
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default new to qt4

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: new to qt4

    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));

  3. #3
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: new to qt4

    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)

  4. #4
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: new to qt4

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: new to qt4

    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.

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.