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. A nested SubClassed widget Not displayed in MdiArea - the "base" subclassed widget is displayed instead.

A nested SubClassed widget Not displayed in MdiArea - the "base" subclassed widget is displayed instead.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 379 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.
  • T Offline
    T Offline
    Tim Peer
    wrote on last edited by
    #1

    I have a MdiChild form - with a nested subclassed structure:

    frmCustomer
    -- frmBaseClass
    --- QWidget

    /   class frmBaseClass : public QWidget
    {
       Q_OBJECT
    ::
    }
    
    class frmCustomer : public frmBaseClass
    {
       Q_OBJECT
    ::
    }
    

    Loading the form from a QMainWindow

    //void MainWindow::newCustomer()
    {
        frmCustomer *child = create_frmCustomer();
        child->Load();
        child->show();
    }
    
    //frmCustomer *MainWindow::create_frmCustomer()
    {
        frmCustomer *child = new frmCustomer;
        mdiArea->addSubWindow(child);
    
        return child;
    }
    

    The UI controls are placed on the frmCustomer and the control's logic in the base class frmBaseClass as application forms are very similar from a controls perspective.

    Why is this with Qt 5.13.0 development ID - QTCreator and VS2017.

    Thanks

    Tim

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tim Peer
      wrote on last edited by
      #2

      Updated Nested Class Structure -- QMdiSubWindow\frmBaseClass\frmCustomer - no change to behavior (except the child form-frmBaseClass format is changed) when it displays in the QMdiArea window.

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

        Hi and welcome to devnet,

        Can you show the code of these nested classes ?

        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
        • T Offline
          T Offline
          Tim Peer
          wrote on last edited by
          #4

          Hello SGaist,

          creating a reproducer would seem very trivial. I don't think I am doing anything unusual. When subclassing a Qt form Widget class - from another, a second level- base class, the second level base class is inherited from QMdiSubWindow. When Qt attempts to load the "top-level Qt form Widget" the second-level blank-form is displayed. This seems to be very odd behavior.

          Am I missing a call to the top-level form or the MDIArea control before attempting to show the form?

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

            It might be trivial but it allows everybody to work on the same code base to find out what is happening.

            And from time to time, it's when writing the minimal case that you can find what's wrong.

            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
            3

            • Login

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