Results 1 to 4 of 4

Thread: Combining different widgets

  1. #1
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Combining different widgets

    Hi guys,

    Newbie question here, so sorry if it isnt clear.

    My environment is Windows, MS VC++ .NET 2005. I use VS Integration and Designer.

    My GUI app is going to be composed of many widgets. Since this is my first Qt GUI app, I plan to build each widget as a standalone first to test if each behaves properly. I plan to build each widget with Designer. Each widget will be a thread since it needs to communicate with a serial port, and displaying the values received.

    Question is if I do that, each widget will have the .ui file of its own...then would my final widget be able to have all the different UI's listed in the project?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Combining different widgets

    Yes, of course. You can do that. You either arrange your widgets in a layout, or add the to a QStackedWidgget, or whatever. It doesn't matter at this stage if you plan to use multiple threads, you can do this part later.

    For more details, you'll have to be more clear.
    Anyway, your final widget ( that will contain all the other widgets ) will most likely be a QMainWindow or a QDialog.

    Also, when using Designer you can promote some standard widgets to custom widgets, that you design yourself, either with the Designer, or by yourself.

    Regards

  3. The following user says thank you to marcel for this useful post:

    ShaChris23 (30th April 2007)

  4. #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: Combining different widgets

    Quote Originally Posted by ShaChris23 View Post
    Each widget will be a thread
    Before you start doing anything with threads in Qt, read this carefully: http://doc.trolltech.com/4.2/threads.html (esp. the part that says that all widgets must live in the GUI thread, aka the main thread).

  5. #4
    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: Combining different widgets

    In addition to what jacek said, the fact the widgets need to communicate with the serial port does not automaticaly mean threads are needed.
    Don't use thread unless you HAVE to.
    If you exmplain the requirements of your app, we might be able to help you decide if threads are needed.
    Most likely, if its not a real time super fast constant reading from the serial port, you can achieve what you want with timers.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QLogText & QLogTable : 2 widgets to display text log
    By fcoiffie in forum Qt-based Software
    Replies: 7
    Last Post: 28th April 2019, 07:52
  2. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  3. Replies: 11
    Last Post: 7th July 2006, 13:09
  4. How to movable dock widgets?
    By becond in forum Qt Tools
    Replies: 3
    Last Post: 21st February 2006, 19:57
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.