qtquick: Fix guest view not getting parented when getting added
To be improved on milestone 3
This commit is contained in:
@@ -80,6 +80,14 @@ void DockWidget_qtquick::init()
|
||||
auto dw = this->dockWidget();
|
||||
connect(dw, &Controllers::DockWidget::actualTitleBarChanged,
|
||||
this, &DockWidget_qtquick::actualTitleBarChanged);
|
||||
|
||||
connect(dw, &Controllers::DockWidget::guestViewChanged, this, [this, dw] {
|
||||
if (auto guest = dw->guestView()) {
|
||||
// TODOm3: Move this logic to the controller
|
||||
guest->setParent(this);
|
||||
guest->setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void DockWidget_qtquick::setWidget(const QString &qmlFilename)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "controllers/DockWidget.h"
|
||||
#include "ViewFactory.h"
|
||||
#include "Config.h"
|
||||
#include "Platform.h"
|
||||
|
||||
TEST_CASE("DockWidget Ctor")
|
||||
{
|
||||
@@ -23,3 +24,20 @@ TEST_CASE("DockWidget Ctor")
|
||||
|
||||
delete dw;
|
||||
}
|
||||
|
||||
TEST_CASE("setGuestView")
|
||||
{
|
||||
auto dw = Config::self().viewFactory()->createDockWidget("dw1")->asDockWidgetController();
|
||||
auto guest = Platform::instance()->tests_createView({ true })->asWrapper();
|
||||
dw->setGuestView(guest);
|
||||
dw->view()->show();
|
||||
Platform::instance()->tests_wait(500); // TODOm3: Replace with wait for visible or so.
|
||||
|
||||
CHECK(guest->isVisible());
|
||||
CHECK(dw->guestView()->equals(guest));
|
||||
REQUIRE(dw->view()->window());
|
||||
REQUIRE(guest->window());
|
||||
CHECK(dw->view()->window()->equals(guest->window()));
|
||||
|
||||
delete dw;
|
||||
}
|
||||
Reference in New Issue
Block a user