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. Qwidgets can become a part of the main form and a separate form
Forum Updated to NodeBB v4.3 + New Features

Qwidgets can become a part of the main form and a separate form

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 298 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1

    How to design and implement the following functions? Qwidgets can become a part of the main form and a separate form, and can switch freely between these two modes?
    It is hard to manage the form and the main window at the same time.

    JonBJ 1 Reply Last reply
    0
    • nicker playerN nicker player

      How to design and implement the following functions? Qwidgets can become a part of the main form and a separate form, and can switch freely between these two modes?
      It is hard to manage the form and the main window at the same time.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @nicker-player
      Don't totally understand your question. You can create a UI class (e.g. in Designer) and at runtime create separate instances which you put on different forms (i.e. have different parents). If you want to stick with a single instance you will have to re-parent if you want to move it from one form/parent to another. What you cannot do is (somehow) have a single instance which lives on more than one form. Nor can you create a copy of any QWidget instance, since QWidget/QObject does not allow copying.

      nicker playerN 1 Reply Last reply
      0
      • JonBJ JonB

        @nicker-player
        Don't totally understand your question. You can create a UI class (e.g. in Designer) and at runtime create separate instances which you put on different forms (i.e. have different parents). If you want to stick with a single instance you will have to re-parent if you want to move it from one form/parent to another. What you cannot do is (somehow) have a single instance which lives on more than one form. Nor can you create a copy of any QWidget instance, since QWidget/QObject does not allow copying.

        nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote on last edited by JKSH
        #3

        @JonB
        What I asked is that how to change the parent object of the qwidget I maded. Is using the medhod of setParent() when overriding the event?

        JonBJ 1 Reply Last reply
        0
        • nicker playerN nicker player

          @JonB
          What I asked is that how to change the parent object of the qwidget I maded. Is using the medhod of setParent() when overriding the event?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @nicker-player
          Yes, QWidget::setParent() does indeed... change the parent of a widget! I don't know what event you are overriding or whether it is a good idea to do it there.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Sounds like you might be describing QDockWidget ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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