Important: Please read the Qt Code of Conduct -

[Partially Solved] [Question] How to code and Display 3 Programs in 1 Program with 1 UI?

  • Evening.

    I am new to C++ and Qt and I have a very noobish Question.

    I am looking for "the best" way to create 1 Program which has different Funtions.

    Function A: A very simple File Editor / Importer / Exporter
    Function B: A ListView or something similar to Display Weblinks and Descriptions (readed from a Text File)
    Function C: A QWebView to Open and Display the SSL Weblinks

    I thought using a TabView would be a good way to go: Function A -> Tab A / Function B -> Tab B and so on.

    When the first 3 Functions are working, i have to implement more which also need to be Displayed. One of them is a REST/JSON/SQL Routine Mix.

    When someone clicks multiple Weblinks in "Linklist", the QWebView should display them all. But i fear the Screen would be "overloaded". Is there a better approach? Should i use something like MDI or anything else? The whole thing must be compatible from Windows 7/8 down to Windows XP Machines. No use on a MAC but maybe at some Point on Linux.

    Some Problem i ran into also:
    When i create the specific .H + .CPP Files, i always use the "depends on QObject" thing. And when i create the Menus not in Mainwindow.cpp but i.e. in Editor.cpp, i always have the Problem that i cant compile at all.

    Qt tells me that the Ui is not defined [Sorry i cant remember the correct Message yet].
    But i when create all the Stuff in the Mainwindow.cpp, everxthing works fine.

    Seems i am doing some very dumb beginner Error somewhere.

    Oh yes: I use QT 5.2 with the latest offical Creator. Both of them self compiled with MingW.

    Thank You!

  • Hi,
    The Menus that you want to display are part of the MainWindow?? So, yes, the ui pointer to the menu's and other GUI elements is private. Other classes can't reach it. You could pass your menu pointer to the class that constructs the menu. Or make the ui pointer itself protected or public, however this is not recommended! (gives bad and ugly code).

    Using a MDI gives lots of work. You could also place the opened Weblinks in dialogs that are non modal. They are still in the same event handler loop as the mainwindow, so easy to control. When the user clicks the mainwindow, the non modal dialogs gets pushed to the background. You are always able to pop them back if needed.

    For you general idea about using the QObject derived stuff for a new class:
    A QObject only makes your class available for the QObject handling stuff that makes Qt great. You are able to assign parents and child relationships. Without the QObject you are not able to use the signal/slot mechanism and lots more of cool QObject things.

  • Qt Champions 2017

    I felt it too much for answering the question. Here design related item and issues are mixed up. How about you providing the issues as separate questions. We can help you.

  • Hello... Open Qt 5.2 and search for examples -> Config Dialog Example... I guess thats what you need... Three buttons, three frames...

    Your problem about UI... Its located in MainWindow "private", so other classes can't access it... As far I know moving it out of "private" is not so smart and you will have to do some stuff before other classes will be able to access it...

  • Hello and Sorry for the late reply.

    I will create specific Threads when i need some specific answers. I have only hoped for some General tips.

    Thanks and have a good Day everyone :)

  • If this helped you enough, place [SOLVED] in front of your first post. This to indicate that the question is solved and other forum users may void reading it.

Log in to reply