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. Which class to chose as a subwindow is appropriate?

Which class to chose as a subwindow is appropriate?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.2k Views 2 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.
  • D Offline
    D Offline
    doodle
    wrote on last edited by
    #1

    I am writing a serial port program to show some data in the mainwindow, and at the same time I want to use the serial port data to plot wave form. I put a button in the mainwindow and use it to open a subwindow to show the wave form, and the mainwindow is also accessible.
    I found the QDialog class, is it OK, or is there any better method?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      if you are using QMainWidow,you can use a QMdiArea as central widget and open as many sub windows in in as necessary

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • D Offline
        D Offline
        doodle
        wrote on last edited by doodle
        #3

        @VRonin I hope the subwindow can be moved outside the mainwindow.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          doodle
          wrote on last edited by
          #4

          Is there any result?

          mrjjM 1 Reply Last reply
          0
          • D doodle

            Is there any result?

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

            @doodle
            hi,
            MDI windows cannot be moved outside mainwindow.
            There is also QDock windows.
            http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.html

            those can tear off and be outside mainwindow.

            However, for just displaying a floating window, dialog should be fine.

            Unless you need more that one plot open at a time then
            mdi or dock might be easier to work with.

            D 1 Reply Last reply
            4
            • mrjjM mrjj

              @doodle
              hi,
              MDI windows cannot be moved outside mainwindow.
              There is also QDock windows.
              http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.html

              those can tear off and be outside mainwindow.

              However, for just displaying a floating window, dialog should be fine.

              Unless you need more that one plot open at a time then
              mdi or dock might be easier to work with.

              D Offline
              D Offline
              doodle
              wrote on last edited by
              #6

              @mrjj OK, I'll choose Qdialog and dock for a try.

              mrjjM 1 Reply Last reply
              1
              • D doodle

                @mrjj OK, I'll choose Qdialog and dock for a try.

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

                @doodle
                Yes, testing both would a good way to find out what will work for you.

                Notes for using the dialog. ( just to be sure. u might already know)
                Since you want mainwindow to be accessible while
                dialog is open, you should use
                show() and not exec() when you show it.
                Also, the
                mydialog->setAttribute(Qt::WA_DeleteOnClose);
                is quite handy for such modeless dialogs as it will then
                delete the instance if user close it. (auto clean)

                D 1 Reply Last reply
                4
                • mrjjM mrjj

                  @doodle
                  Yes, testing both would a good way to find out what will work for you.

                  Notes for using the dialog. ( just to be sure. u might already know)
                  Since you want mainwindow to be accessible while
                  dialog is open, you should use
                  show() and not exec() when you show it.
                  Also, the
                  mydialog->setAttribute(Qt::WA_DeleteOnClose);
                  is quite handy for such modeless dialogs as it will then
                  delete the instance if user close it. (auto clean)

                  D Offline
                  D Offline
                  doodle
                  wrote on last edited by
                  #8

                  @mrjj Great!

                  1 Reply Last reply
                  1

                  • Login

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