Results 1 to 8 of 8

Thread: Help sought on console + GUI Integration...

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

    Question Help sought on console + GUI Integration...

    hi

    i m new to QT programming and i m to design an application getting data from the network (tcp) and displaying it on a frontend (GUI). i want to build up the application in QT. Further, i will be having more than one GUI-windows.My studies about my requirements and QT show that i need a multi-threaded QT application.Please help me regarding:
    1) Can i have multiple GUI windows in a multi-threaded QT application? I want my main GUI to call child-windows/widgets as and when required. Is it possible?
    2) How to start i.e. whether i should start with a GUI based QT application or simply with a Console application?
    3) Can i make use of QT Designer for writing such an application GUI?
    4) I want my GUI thread to be active always (and worker threads to work independently). How to achieve this?
    5) Further, for posting data from threads to GUI, where should the postEvent and allied code should be written and how it will be received in the GUI thread?

    I have gone through all posts regarding this topic on the old forum, got some info also. But still i feel lost on the subject.

    Sorry for such a long query BUT i have tried to list out all related queries in a single post only.Hope the same information can help many other developers also.

    A sample code/ Pseudocode/ Outline will be of great help.I hope to get an answer in order to join hands with QT development community.

    Thanking in advance....

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

    Default Re: Help sought on console + GUI Integration...

    hi
    forgot to mention.
    Currently i m using Qt3.3.4. Is that ok? or will switching to Qt4.1 be helpful?

    Thanks...

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help sought on console + GUI Integration...

    Quote Originally Posted by mysearch05
    1) Can i have multiple GUI windows in a multi-threaded QT application? I want my main GUI to call child-windows/widgets as and when required. Is it possible?
    Yes, you can, but all windows should be managed by the GUI (a.k.a main) thread.

    Quote Originally Posted by mysearch05
    2) How to start i.e. whether i should start with a GUI based QT application or simply with a Console application?
    Don't bother with console --- you will have to make the same thing twice later.

    Quote Originally Posted by mysearch05
    3) Can i make use of QT Designer for writing such an application GUI?
    Yes, but remember that it isn't IDE, only a layout editor. Read this

    Quote Originally Posted by mysearch05
    4) I want my GUI thread to be active always (and worker threads to work independently). How to achieve this?
    Just don't block the GUI thread. You can use custom events to comminicate with other threads.

    Quote Originally Posted by mysearch05
    5) Further, for posting data from threads to GUI, where should the postEvent and allied code should be written and how it will be received in the GUI thread?
    http://doc.trolltech.com/3.3/qcustomevent.html

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

    Default Re: Help sought on console + GUI Integration...

    thanks dear
    can you please comment on following two:

    4) I want my GUI thread to be active always (and worker threads to work independently). How to achieve this?
    ***Just don't block the GUI thread. You can use custom events to comminicate with other threads***

    How to achieve this?

    And

    I m planning to use QT3.3.4. Is that OK or should I use QT 4.1??

    I mean all these questions can be very trival to you but confusing for a newcomer for me...

    Thanks...

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Help sought on console + GUI Integration...

    thanks dear
    OT:
    Hehe, I know you were only trying to be nice mysearch05, but this is usually used between lovers.
    So if you are a girl or gay, then ok, but if not, then... well, just for info

  6. #6
    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: Help sought on console + GUI Integration...

    The book Gui Programming with Qt3 has an excellent chapter on QThread and it's usage. I've used it to move a lengthy printing operation to a new thread and keep my gui responsive. AFAIK it's freely available online (I own a hard copy so I can't give you a direct link but google is always there )

  7. #7
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: Help sought on console + GUI Integration...

    Quote Originally Posted by mysearch05
    ...
    I m planning to use QT3.3.4. Is that OK or should I use QT 4.1??
    ...
    Thanks...
    It would be better to start with QT 4.1 than 3.3 for a couple of reasons.

    First, 3.3 is old and going away, (I haven't heared of anyone developing with 1.x or 2.x Qt lately) so why not start out with the newest and learn it.

    Second, the development paradigm of 3.x is much different than 4.x

    I started my Qt experience with 3.3 and all the time I used learning how to use the 3.3 Designer to build an app was lost when the 4.x Designer came out. The 3.3 Designer has a GUI RAD quality, and it would create form_ui.h automatically. A lot of mental effort went into learning how to get classes, functions, signals and slots stuffed into form_ui.h. When TrollTech released 4.x the Designer lost all of that functionality and is now just a UI designer, nothing more. IMO, it is for the better because now classic C++ design paradigms apply. Using Qt4 is easier and more powerful. You don't tunnel down into generated files trying to find the best place to make a modification or add some functionality, only to discover a "don't edit the code" sign. As a coder you are responsible for main.cpp, yourapp.h, yourapp.cpp and yourform.ui. When you compile the MOC creates ui_yourform.h, and some other files, but you never concern yourself with them You just deal with the *.h, *.cpp and *.ui files that YOU create.

    Having learned both ways I much prefer the "Qt4 way".

    I wrote about it here

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help sought on console + GUI Integration...

    Quote Originally Posted by mysearch05
    4) I want my GUI thread to be active always (and worker threads to work independently). How to achieve this?
    ***Just don't block the GUI thread. You can use custom events to comminicate with other threads***

    How to achieve this?
    There's an example in the docs: http://doc.trolltech.com/3.3/qcustomevent.html

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.