Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Blank client area
Qt 6.12 LTS is out! See what's new in the release blog

Blank client area

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 3 Posters 3.7k 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #7

    This is the current code which added a QVBoxLayout to the QWinWidget as SGaist suggested:

    	widget = new QWinWidget(this);
    	QVBoxLayout* layout { new QVBoxLayout() };
    	ZTRACE_RUNTIME("Creating Horizontal Splitter");
    	splitter = new QSplitter(Qt::Horizontal, widget);
    	widget->setLayout(layout);
    
    	ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)");
    	explorerBar = new ExplorerBar(widget);
    	ZTRACE_RUNTIME("Creating Explorer bar - ok");
    
    	ZTRACE_RUNTIME("Creating Stacking Panel");
    	stackingDlg = new DSS::StackingDlg(widget);
    	ZTRACE_RUNTIME("Creating Stacking Panel - ok");
    
    	ZTRACE_RUNTIME("Creating stackedWidget");
    	stackedWidget = new QStackedWidget(widget);
    
    	ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget");
    	stackedWidget->addWidget(stackingDlg);
    	stackedWidget->setCurrentWidget(stackingDlg);
    
    	splitter = new QSplitter(Qt::Horizontal, widget);
    	splitter->addWidget(explorerBar);
    	splitter->addWidget(stackedWidget);
    	splitter->setStretchFactor(1, 1);		// Want Stacking part to take any spare space.
    	stackedWidget->show();
    	splitter->show();
    	widget->showCentered();
    

    Are you suggesting I need to add layouts to the Splitter? Do I need to size the QWinWidget to the size of the Windows client area (didn't need to before when the only control I added as a child of the QWinWidget was the ExplorerBar).

    Thanks
    David

    jsulmJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      This is the current code which added a QVBoxLayout to the QWinWidget as SGaist suggested:

      	widget = new QWinWidget(this);
      	QVBoxLayout* layout { new QVBoxLayout() };
      	ZTRACE_RUNTIME("Creating Horizontal Splitter");
      	splitter = new QSplitter(Qt::Horizontal, widget);
      	widget->setLayout(layout);
      
      	ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)");
      	explorerBar = new ExplorerBar(widget);
      	ZTRACE_RUNTIME("Creating Explorer bar - ok");
      
      	ZTRACE_RUNTIME("Creating Stacking Panel");
      	stackingDlg = new DSS::StackingDlg(widget);
      	ZTRACE_RUNTIME("Creating Stacking Panel - ok");
      
      	ZTRACE_RUNTIME("Creating stackedWidget");
      	stackedWidget = new QStackedWidget(widget);
      
      	ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget");
      	stackedWidget->addWidget(stackingDlg);
      	stackedWidget->setCurrentWidget(stackingDlg);
      
      	splitter = new QSplitter(Qt::Horizontal, widget);
      	splitter->addWidget(explorerBar);
      	splitter->addWidget(stackedWidget);
      	splitter->setStretchFactor(1, 1);		// Want Stacking part to take any spare space.
      	stackedWidget->show();
      	splitter->show();
      	widget->showCentered();
      

      Are you suggesting I need to add layouts to the Splitter? Do I need to size the QWinWidget to the size of the Windows client area (didn't need to before when the only control I added as a child of the QWinWidget was the ExplorerBar).

      Thanks
      David

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @Perdrix said in Blank client area:

      Are you suggesting I need to add layouts to the Splitter?

      No, you need to add the splitter to a layout.
      And do you have a layout on "this"? You're added "widget", but is it part of any layout?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by Perdrix
        #9

        I haven't got a layout set on "this" because *this is an MFC CDialog - hence the use of a QWinWidget to act as a message pump and owner of Qt Widgets.

        Here's the code as it now stands after some experimentation:

        	widget = new QWinWidget(this);
        	QVBoxLayout* verticalLayout { new QVBoxLayout(widget) };
        	verticalLayout->setObjectName("verticalLayout");
        	ZTRACE_RUNTIME("Creating Horizontal Splitter");
        	splitter = new QSplitter(Qt::Horizontal, widget);
        	splitter->setObjectName("splitter");
        
        	ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)");
        	explorerBar = new ExplorerBar(splitter);
        	
        	explorerBar->setObjectName("explorerBar");
        	splitter->addWidget(explorerBar);
        
        	ZTRACE_RUNTIME("Creating stackedWidget");
        	stackedWidget = new QStackedWidget(splitter);
        	stackedWidget->setObjectName("stackedWidget");
        
        	ZTRACE_RUNTIME("Creating Stacking Panel");
        	stackingDlg = new DSS::StackingDlg(stackedWidget);
        	
        	stackingDlg->setObjectName("stackingDlg");
        	ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget"); 
        	stackedWidget->addWidget(stackingDlg);
        	stackedWidget->setCurrentWidget(stackingDlg);
        	splitter->addWidget(stackedWidget);
        
        	splitter->setStretchFactor(1, 1);		// Want Stacking part to take any spare space.
        
        	verticalLayout->addWidget(splitter);
        
        	//stackedWidget->show();
        	//splitter->show();
        	widget->showCentered();
        

        The result rather surprised me:

        3bbc7b2f-748a-4250-a223-dc72fdab7b18-image.png

        The StackingDlg has ended up as free-floating window (top-left) when I expected it to be to the RHS of the ExplorerBar. The other thing is how to get it to fill the client area? ExplorerBar has SizePolicy (Preferred, Expanding) and StackingDlg has (Expanding, Expanding).

        jsulmJ 1 Reply Last reply
        0
        • PerdrixP Perdrix

          I haven't got a layout set on "this" because *this is an MFC CDialog - hence the use of a QWinWidget to act as a message pump and owner of Qt Widgets.

          Here's the code as it now stands after some experimentation:

          	widget = new QWinWidget(this);
          	QVBoxLayout* verticalLayout { new QVBoxLayout(widget) };
          	verticalLayout->setObjectName("verticalLayout");
          	ZTRACE_RUNTIME("Creating Horizontal Splitter");
          	splitter = new QSplitter(Qt::Horizontal, widget);
          	splitter->setObjectName("splitter");
          
          	ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)");
          	explorerBar = new ExplorerBar(splitter);
          	
          	explorerBar->setObjectName("explorerBar");
          	splitter->addWidget(explorerBar);
          
          	ZTRACE_RUNTIME("Creating stackedWidget");
          	stackedWidget = new QStackedWidget(splitter);
          	stackedWidget->setObjectName("stackedWidget");
          
          	ZTRACE_RUNTIME("Creating Stacking Panel");
          	stackingDlg = new DSS::StackingDlg(stackedWidget);
          	
          	stackingDlg->setObjectName("stackingDlg");
          	ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget"); 
          	stackedWidget->addWidget(stackingDlg);
          	stackedWidget->setCurrentWidget(stackingDlg);
          	splitter->addWidget(stackedWidget);
          
          	splitter->setStretchFactor(1, 1);		// Want Stacking part to take any spare space.
          
          	verticalLayout->addWidget(splitter);
          
          	//stackedWidget->show();
          	//splitter->show();
          	widget->showCentered();
          

          The result rather surprised me:

          3bbc7b2f-748a-4250-a223-dc72fdab7b18-image.png

          The StackingDlg has ended up as free-floating window (top-left) when I expected it to be to the RHS of the ExplorerBar. The other thing is how to get it to fill the client area? ExplorerBar has SizePolicy (Preferred, Expanding) and StackingDlg has (Expanding, Expanding).

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @Perdrix said in Blank client area:

          The StackingDlg has ended up as free-floating window

          How do you show StackingDlg? And does it have a parent?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          PerdrixP 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Perdrix said in Blank client area:

            The StackingDlg has ended up as free-floating window

            How do you show StackingDlg? And does it have a parent?

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by
            #11

            @jsulm stackingDlg = new DSS::StackingDlg(stackedWidget);

            So yes it has a parent of the stackedWidget whose parent in turn is the splitter.

            As you can see from the code I posted.

            It will be shown when the QWinWidget is shown by the call to showCentered() (won't it?).

            D.

            1 Reply Last reply
            0
            • PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by
              #12

              Any further thoughts guys?

              1 Reply Last reply
              0
              • PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by
                #13

                I'm still getting nowhere with this issue - it has to be a problem with the code I've posted, but for the life of me I cannot see what.

                D.

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

                  Can you show the code where you create the hierarchy ?
                  I am currently unsure that you are using QWinWidget at the right place.

                  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
                  • PerdrixP Offline
                    PerdrixP Offline
                    Perdrix
                    wrote on last edited by
                    #15

                    Here you go:

                    BOOL CDeepStackerDlg::OnInitDialog()
                    {
                    	ZFUNCTRACE_RUNTIME();
                    	ZTRACE_RUNTIME("Initializing Main Dialog");
                    	CDialog::OnInitDialog();
                    	ZTRACE_RUNTIME("Initializing Main Dialog - ok");
                    
                    	widget = new QWinWidget(this);
                    	QVBoxLayout* verticalLayout { new QVBoxLayout(widget) };
                    	verticalLayout->setObjectName("verticalLayout");
                    	ZTRACE_RUNTIME("Creating Horizontal Splitter");
                    	splitter = new QSplitter(Qt::Horizontal, widget);
                    	splitter->setObjectName("splitter");
                    
                    	ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)");
                    	explorerBar = new ExplorerBar(splitter);
                    	
                    	explorerBar->setObjectName("explorerBar");
                    	splitter->addWidget(explorerBar);
                    
                    	ZTRACE_RUNTIME("Creating stackedWidget");
                    	stackedWidget = new QStackedWidget(splitter);
                    	stackedWidget->setObjectName("stackedWidget");
                    	splitter->addWidget(stackedWidget);
                    
                    	ZTRACE_RUNTIME("Creating Stacking Panel");
                    	stackingDlg = new DSS::StackingDlg(stackedWidget);
                    	stackingDlg->setObjectName("stackingDlg");
                    
                    	ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget"); 
                    	stackedWidget->addWidget(stackingDlg);
                    	stackedWidget->setCurrentWidget(stackingDlg);
                    
                    	splitter->setStretchFactor(1, 1);		// Want Stacking part to take any spare space.
                    
                    	verticalLayout->addWidget(splitter);
                    
                    	stackedWidget->show();
                    	splitter->show();
                    	widget->move(0, 0);
                    	widget->show();
                    
                    

                    What's really weird is that if I grab the splitter bar next to the "ExplorerBar", and move it to the right, the StackingDlg Window is changed as if it were not a separate window.

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

                      The thing that I find strange in your code is widget = new QWinWidget(this);. QWinWidget takes an HWND as first parameter which I suspect this is not and that is likely the source of your issue.

                      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
                      1
                      • PerdrixP Offline
                        PerdrixP Offline
                        Perdrix
                        wrote on last edited by Perdrix
                        #17

                        The QWinWidget ctor I'm using eats a CWnd*

                        QWinWidget::QWinWidget(CWnd *parentWnd, QObject *parent, Qt::WindowFlags f)

                        and as a CDialog sub-class, the this pointer will definitely point to a CWnd.

                        So I don't believe that's the issue (and I don't think the compiler would have let me pass a CWnd* to a ctor that ate an hwnd)
                        D.

                        1 Reply Last reply
                        0
                        • PerdrixP Offline
                          PerdrixP Offline
                          Perdrix
                          wrote on last edited by Perdrix
                          #18

                          I know you probably wouldn't normally do so, but given how oddly this is behaving, if you want to debug this problem you can download the entire project which builds with VS2019 (Community edition), Qt VSTools and Qt 15.5.2 from:

                          https://github.com/deepskystacker/DSS/tree/master/DeepSkyStacker

                          The project to build would be the DeepSkyStacker project (Debug, x64).

                          The "solution" file is DeepSkyStacker.VS2019.sln

                          The code in question is in DeepStackerDlg.cpp at line 266 and following:

                          D.

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

                            I currently do not have a Windows machine at hand so I can't check that directly.

                            Did you consider starting from the QWinWidget example and build something similar to that dialog to see where it starts behaving strangely ?

                            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
                            • PerdrixP Offline
                              PerdrixP Offline
                              Perdrix
                              wrote on last edited by
                              #20

                              Problem found! It works a lot better if I make the StackingDlg a Widget NOT a QDialog

                              BLUSH

                              1 Reply Last reply
                              2

                              • Login

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