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. Implementing QMdiArea - no show

Implementing QMdiArea - no show

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 343 Views
  • 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I am rebuilding my project using QMdiArea.
    I have placed my original MainWindow_CAT_TAB: as QMdiArea ->central widget.
    I can get the window title set, but no original TAB widget will show.
    Not really sure why I actually see the new title, but that is not an issue for now.

    I must have missed something, perhaps the original TAB is covered...
    I can "show " the QMdiArea without the central widget , with window title set .

    
        { // area first
            // tempoaray insert  QMdiArea test 
            QMdiArea *QMDIA = new QMdiArea();
     
            // placing MainWindow_CAT_TAB: AS CENTRAL WIDGET
            MainWindow_CAT_TAB  *mainWindow = new  MainWindow_CAT_TAB() ;
            mainWindow->setWindowTitle(" CAT  TAB orignal  now QMDI  central widget temporary ");
            mainWindow->setCentralWidget(QMDIA);
            mainWindow→show();          **NO SHOW**    	               mainWindow→centralWidget()→show();   moves QmdiArea  but no TAB show 
         //    QMDIA->show();
            return a.exec();
        }
    
    
    
    
    MainWindow_CAT_TAB::MainWindow_CAT_TAB(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow_CAT_TAB)
    {
    …
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What is this "original TAB" that you are mentioning ?

      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
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        It is the main , see the definition code , and so far the only object / widget I want to add to QMdiArea.
        I think my error is - I am assuming that mainWindow->setCentralWidget is the way to do that. Apparently not.
        What confuses me - QMdiArea is a displayable widget . The attached code shows the QMdiArea and I can change its window title.

        I do not get the need for
        mainWindow->setCentralWidget

        I should be able to just add widgets , sus as my TAB widget to the QMdiArea.

        Back to RTFM ....

        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv); // runs main events
        
            {
                QMdiArea *mdiArea = new QMdiArea();
                mdiArea->show();
        
                return a.exec();
            }
        }
        
        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #4

          This works....as suspected,,,
          Why ? I need to digest that....
          ( back to setting centralWidget purpose...)

                  QMdiArea *mdiArea = new QMdiArea();
                  MainWindow_CAT_TAB  *mainWindow = new  MainWindow_CAT_TAB() ;
                  mdiArea->addSubWindow(mainWindow);
                  mdiArea->show();
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            In that case your QMdiArea is a top level widget hence it has a title bar and you can set its title.

            If you use it as a "sub-widget" it will not get any decoration hence no title bar.

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

            A 1 Reply Last reply
            0
            • SGaistS SGaist

              In that case your QMdiArea is a top level widget hence it has a title bar and you can set its title.

              If you use it as a "sub-widget" it will not get any decoration hence no title bar.

              A Offline
              A Offline
              Anonymous_Banned275
              wrote on last edited by
              #6

              @SGaist said in Implementing QMdiArea - no show:

              In that case your QMdiArea is a top level widget hence it has a title bar and you can set its title.

              If you use it as a "sub-widget" it will not get any decoration hence no title bar.

              I am happy so far, still like to know what is the purpose of confusing me with "center widget".

              BTW the default color scheme is awful..
              ( Why do I always get stuck doing QA ?
              Yes, I had a good paying jobs doing ad-hock QA )

              Since "center widget". appears to have no effect - perhaps another "sugar"? JUST KIDDING

              I have a strange feeling I have been in QMdi before in MFC / OpenCV etc. recall "viewpoints / view-ports"...

              From exposure so far I am not sure if it is going to be better ride this time..

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

                The central widget is just literally the central widget of your QMainWindow that may also contain tool bars and dock widgets. Nothing more to it than that.

                As for the color scheme, you should post a picture so we can see however Qt uses what the system proposes unless you specify a style sheet.

                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