Blank client area
-
@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?
@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.
-
Can you show the code where you create the hierarchy ?
I am currently unsure that you are using QWinWidget at the right place. -
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.
-
The thing that I find strange in your code is
widget = new QWinWidget(this);. QWinWidget takes an HWND as first parameter which I suspectthisis not and that is likely the source of your issue. -
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. -
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.
-
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 ?