[Dialog] Don't alter mainItem's visibility

The item's visible property is independent of the window visibility, which can be checked using Window.visible.

Differential Revision: https://phabricator.kde.org/D17543
This commit is contained in:
Kai Uwe Broulik 2019-01-10 12:14:32 +01:00
parent f4bd4a6131
commit b257029afc

View File

@ -267,9 +267,6 @@ void DialogPrivate::updateTheme()
void DialogPrivate::updateVisibility(bool visible) void DialogPrivate::updateVisibility(bool visible)
{ {
if (mainItem) {
mainItem->setVisible(visible);
}
if (visible) { if (visible) {
if (visualParent && visualParent->window()) { if (visualParent && visualParent->window()) {
q->setTransientParent(visualParent->window()); q->setTransientParent(visualParent->window());
@ -782,7 +779,6 @@ void Dialog::setMainItem(QQuickItem *mainItem)
if (d->mainItem) { if (d->mainItem) {
disconnect(d->mainItem, nullptr, this, nullptr); disconnect(d->mainItem, nullptr, this, nullptr);
d->mainItem->setVisible(false);
d->mainItem->setParentItem(nullptr); d->mainItem->setParentItem(nullptr);
} }
@ -793,7 +789,6 @@ void Dialog::setMainItem(QQuickItem *mainItem)
d->mainItem = mainItem; d->mainItem = mainItem;
if (mainItem) { if (mainItem) {
d->mainItem->setVisible(isVisible());
mainItem->setParentItem(contentItem()); mainItem->setParentItem(contentItem());
connect(mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged())); connect(mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged()));
@ -1360,11 +1355,6 @@ void Dialog::setVisible(bool visible)
if (visible && d->visualParent) { if (visible && d->visualParent) {
setPosition(popupPosition(d->visualParent, size())); setPosition(popupPosition(d->visualParent, size()));
} }
//setting the main item visible before the show event arrives
//makes positioning work better
if (visible && d->mainItem) {
d->mainItem->setVisible(true);
}
// Bug 381242: Qt remembers minimize state and re-applies it when showing // Bug 381242: Qt remembers minimize state and re-applies it when showing
setWindowStates(windowStates() & ~Qt::WindowMinimized); setWindowStates(windowStates() & ~Qt::WindowMinimized);