Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to dynamically embed a window inside of mainwindow?
Forum Updated to NodeBB v4.3 + New Features

How to dynamically embed a window inside of mainwindow?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • kahlenbergK Offline
    kahlenbergK Offline
    kahlenberg
    wrote on last edited by
    #1

    Hi,
    I searched a lot but I didn't find any proper solution.
    I want to embed a second window inside of mainwindow. Mainwindow will have a tree structure, If user clicks an element in tree, an area in mainwindow will be loaded with new window. Each element in tree will have a GUI, that will be loaded if this element is clicked in tree.
    How can I do that? Is there any example project for that?

    Thanks.

    raven-worxR 1 Reply Last reply
    0
    • kahlenbergK kahlenberg

      Hi,
      I searched a lot but I didn't find any proper solution.
      I want to embed a second window inside of mainwindow. Mainwindow will have a tree structure, If user clicks an element in tree, an area in mainwindow will be loaded with new window. Each element in tree will have a GUI, that will be loaded if this element is clicked in tree.
      How can I do that? Is there any example project for that?

      Thanks.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @kahlenberg
      you could add your widgets to a QStackedWidget and switch it's current index.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        What do yo u mean by window?
        If its embedded into mainwindow , its not really a window anymore.
        Is this "other" window from same application, you do you mean a foreign
        program window?

        So as @raven-worx ask, is this more of a page concept ? where clicking in the tree will switch "page"?

        1 Reply Last reply
        1
        • kahlenbergK Offline
          kahlenbergK Offline
          kahlenberg
          wrote on last edited by
          #4

          Hi, Thanks for answers.
          "Embedding" is maybe a wrong wording.
          Lets say, I have 5 different classes with their own GUIs (Widgets?) I want to show them inside of main program if I click a tree element.
          For example in the mainwindow I have a tree at left, and empty place on right. If I click first element in tree, epmty area shall be filled with GUI of first class. If I click second element on tree, epmty area shall be filled with GUI of second class and so on.

          mrjjM raven-worxR 2 Replies Last reply
          0
          • kahlenbergK kahlenberg

            Hi, Thanks for answers.
            "Embedding" is maybe a wrong wording.
            Lets say, I have 5 different classes with their own GUIs (Widgets?) I want to show them inside of main program if I click a tree element.
            For example in the mainwindow I have a tree at left, and empty place on right. If I click first element in tree, epmty area shall be filled with GUI of first class. If I click second element on tree, epmty area shall be filled with GUI of second class and so on.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @kahlenberg

            It does sound like QStackedWidget would be perfect match. :)

            1 Reply Last reply
            0
            • kahlenbergK kahlenberg

              Hi, Thanks for answers.
              "Embedding" is maybe a wrong wording.
              Lets say, I have 5 different classes with their own GUIs (Widgets?) I want to show them inside of main program if I click a tree element.
              For example in the mainwindow I have a tree at left, and empty place on right. If I click first element in tree, epmty area shall be filled with GUI of first class. If I click second element on tree, epmty area shall be filled with GUI of second class and so on.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @kahlenberg
              take a look at the config dialog example
              It uses a listview instead of a tree view, but basically it the exact same concept (QModelIndex from an item view).

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              kahlenbergK 1 Reply Last reply
              1
              • raven-worxR raven-worx

                @kahlenberg
                take a look at the config dialog example
                It uses a listview instead of a tree view, but basically it the exact same concept (QModelIndex from an item view).

                kahlenbergK Offline
                kahlenbergK Offline
                kahlenberg
                wrote on last edited by
                #7

                Thanks for answer and sorry for late answer :)

                @mrjj . I will have a look.

                @raven-worx
                I try to execute this code, I am getting always linker error : :-1: error: LNK1104: cannot open file 'corelibc.lib'.
                Is there a better sample code for PC? In Pro file there is a line :
                wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
                Is it for WinCE OS? I need it for win8.1

                raven-worxR 1 Reply Last reply
                0
                • kahlenbergK kahlenberg

                  Thanks for answer and sorry for late answer :)

                  @mrjj . I will have a look.

                  @raven-worx
                  I try to execute this code, I am getting always linker error : :-1: error: LNK1104: cannot open file 'corelibc.lib'.
                  Is there a better sample code for PC? In Pro file there is a line :
                  wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
                  Is it for WinCE OS? I need it for win8.1

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @kahlenberg
                  try to remove this line from the pro-file (and rerun qmake afterwards)

                  But configdialog.cpp should contain all you need and it's pretty straight forward.

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  kahlenbergK 1 Reply Last reply
                  1
                  • raven-worxR raven-worx

                    @kahlenberg
                    try to remove this line from the pro-file (and rerun qmake afterwards)

                    But configdialog.cpp should contain all you need and it's pretty straight forward.

                    kahlenbergK Offline
                    kahlenbergK Offline
                    kahlenberg
                    wrote on last edited by
                    #9

                    @raven-worx
                    Thanks. It worked now!

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved