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 enable menu options to all Qmdisubwindow?
Forum Update on Monday, May 27th 2025

How to enable menu options to all Qmdisubwindow?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.7k 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.
  • U Offline
    U Offline
    umadevi
    wrote on last edited by
    #1

    Hi,
    I have created GUI which render 3d model and view wireframe,point etc view of the rendered model. I have used Qtmdi so that I can open multiple document. Now my problem is , if I open the only one window I am able to perform view (menubar option is view)option(wireframe,point,etc..). but If i open multiple window say window1,window2,window3 etc.. , if i click view option , the window which I opened recently say window3 , I am able to perform view operation but not for other windows . How to enable menu options to all window so that I can perform view operation in all window if I select that window??

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

      Hi
      Without code or pictures Im not sure what is wrong with the option menu.
      Normally, the slot for the Option Action could use
      http://doc.qt.io/qt-5/qmdiarea.html#activeSubWindow
      To operated on the "Selected" one.

      1 Reply Last reply
      2
      • U Offline
        U Offline
        umadevi
        wrote on last edited by
        #3

        Hai,

        I have created menu option using qt creator not using code. here is my subwindow code.

        QMdiSubWindow *subW = ui.mdiArea->addSubWindow(qwidget);
        subW->setWindowFlags(Qt::SubWindow);
        subW->setAttribute(Qt::WA_DeleteOnClose);
        subW->setObjectName(model_path);
        subW->setWindowTitle(model_path);
        subW->maximumSize();
        subW->show();
        ui.mdiArea->setActiveSubWindow(subW);
        ui.statusBar->showMessage("Loaded " + model_path, 5000);
        
        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That look fine but its still not clear what is wrong with your optionmenu ?
          Can you show the slot/code that happens when you click an option?

          1 Reply Last reply
          0
          • U Offline
            U Offline
            umadevi
            wrote on last edited by VRonin
            #5

            Hi ,
            yeah sure..

              connect(ui.action3D_Model, SIGNAL(triggered()), this, SLOT(loadViewer_3d()));
                connect(ui.actionWireFrame, SIGNAL(triggered()), this, SLOT(wireframed_model()));
              connect(ui.actionPoint, SIGNAL(triggered()), this, SLOT(point_model()));
              connect(ui.actionFill, SIGNAL(triggered()), this, SLOT(filled_model()));	
            

            loadViewer_3d() code

            
              model_path = QFileDialog::getOpenFileName(this, tr("Open 3D Model"), "", tr("ALL(*.obj *.dxf *.ply *.3ds *.osg *.osgb *.osgt);;3D Studio(*.3ds);;OBJ(*.obj);;DXF(*.dxf);;PLY(*.ply);;OpenSceneGraph(*.osg *.osgb *.osgt)"));
            	QByteArray file = model_path.toLatin1();
            	char *input = file.data();
            	if (!model_path.isEmpty())
            	{
            		ui.statusBar->showMessage("Loading... " + model_path);
            		osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded;
            		viewWidget = new ModelRender(input, 0, Qt::Widget, threadingModel);	
            		viewWidget->setGeometry(100, 100, 1024, 2048);		
            		loadModelWidget(viewWidget);
            	}
            	else
            	{
            		QMessageBox::information(this, "Alert", "3D Model is Missing");
            	}
            

            loadModelWidget -- code

              QMdiSubWindow *subW = ui.mdiArea->addSubWindow(qwidget);
            subW->setWindowFlags(Qt::SubWindow);
            subW->setAttribute(Qt::WA_DeleteOnClose);
            subW->setObjectName(model_path);
            subW->setWindowTitle(model_path);
            subW->maximumSize();
            subW->show();
            ui.mdiArea->setActiveSubWindow(subW);
            ui.statusBar->showMessage("Loaded " + model_path, 5000);
            
            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Ok
              So if you dont use activeSubWindow() to perform view operations on , you can use
              http://doc.qt.io/qt-5/qmdiarea.html#subWindowList
              to get list of all open windows and do it this way?

              1 Reply Last reply
              0
              • U Offline
                U Offline
                umadevi
                wrote on last edited by
                #7

                okay I will try with subwindowlist

                mrjjM 1 Reply Last reply
                0
                • U umadevi

                  okay I will try with subwindowlist

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

                  @umadevi

                  Do I understand it correctly that you want the View setting to apply to all open?
                  So If you choose vireframe all windows go wireframe?

                  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