diff --git a/frame/controller/dockitemcontroller.cpp b/frame/controller/dockitemcontroller.cpp index 2dd89e6b4..73159c62e 100644 --- a/frame/controller/dockitemcontroller.cpp +++ b/frame/controller/dockitemcontroller.cpp @@ -24,7 +24,7 @@ #include "item/stretchitem.h" #include "item/launcheritem.h" #include "item/pluginsitem.h" -#include "item/systemtraypluginitem.h" +#include "item/traypluginitem.h" #include "util/docksettings.h" #include @@ -89,7 +89,7 @@ void DockItemController::updatePluginsItemOrderKey() for (auto item : m_itemList) { DockItem::ItemType tyep = item->itemType(); - if (item.isNull() || (tyep != DockItem::Plugins && tyep != DockItem::SystemTrayPlugin)) + if (item.isNull() || (tyep != DockItem::Plugins && tyep != DockItem::TrayPlugin)) continue; static_cast(item.data())->setItemSortKey(++index); } @@ -108,8 +108,8 @@ void DockItemController::itemMove(DockItem * const moveItem, DockItem * const re return; // plugins move - if (moveType == DockItem::Plugins || moveType == DockItem::SystemTrayPlugin) - if (replaceType != DockItem::Plugins && replaceType != DockItem::SystemTrayPlugin) + if (moveType == DockItem::Plugins || moveType == DockItem::TrayPlugin) + if (replaceType != DockItem::Plugins && replaceType != DockItem::TrayPlugin) return; const int moveIndex = m_itemList.indexOf(moveItem); @@ -124,7 +124,7 @@ void DockItemController::itemMove(DockItem * const moveItem, DockItem * const re // update plugins sort key if order changed if (moveType == DockItem::Plugins || replaceType == DockItem::Plugins - || moveType == DockItem::SystemTrayPlugin || replaceType == DockItem::SystemTrayPlugin) + || moveType == DockItem::TrayPlugin || replaceType == DockItem::TrayPlugin) m_updatePluginsOrderTimer->start(); // for app move, index 0 is launcher item, need to pass it. @@ -136,7 +136,7 @@ void DockItemController::itemMove(DockItem * const moveItem, DockItem * const re void DockItemController::itemDroppedIntoContainer(DockItem * const item) { - Q_ASSERT(item->itemType() == DockItem::Plugins || item->itemType() == DockItem::SystemTrayPlugin); + Q_ASSERT(item->itemType() == DockItem::Plugins || item->itemType() == DockItem::TrayPlugin); PluginsItem *pi = static_cast(item); @@ -167,7 +167,7 @@ void DockItemController::itemDragOutFromContainer(DockItem * const item) switch (item->itemType()) { case DockItem::Plugins: - case DockItem::SystemTrayPlugin: + case DockItem::TrayPlugin: static_cast(item)->setInContainer(false); pluginItemInserted(static_cast(item)); break; @@ -196,7 +196,7 @@ void DockItemController::placeholderItemRemoved(PlaceholderItem *item) m_itemList.removeOne(item); } -// refresh right spliter visible of fashion system tray plugin item +// refresh right spliter visible of fashion tray plugin item void DockItemController::refreshFSTItemSpliterVisible() { if (DockSettings::Instance().displayMode() != Dock::DisplayMode::Fashion) { @@ -204,8 +204,8 @@ void DockItemController::refreshFSTItemSpliterVisible() } for (int i = 0; i < m_itemList.size(); ++i) { - if (m_itemList.at(i)->itemType() == DockItem::ItemType::SystemTrayPlugin) { - static_cast(m_itemList.at(i).data()) + if (m_itemList.at(i)->itemType() == DockItem::ItemType::TrayPlugin) { + static_cast(m_itemList.at(i).data()) ->setRightSplitVisible(i != (m_itemList.size() - 1)); break; } @@ -250,7 +250,7 @@ DockItemController::DockItemController(QObject *parent) connect(m_pluginsInter, &DockPluginsController::pluginItemInserted, this, &DockItemController::pluginItemInserted, Qt::QueuedConnection); connect(m_pluginsInter, &DockPluginsController::pluginItemRemoved, this, &DockItemController::pluginItemRemoved, Qt::QueuedConnection); connect(m_pluginsInter, &DockPluginsController::pluginItemUpdated, this, &DockItemController::itemUpdated, Qt::QueuedConnection); - connect(m_pluginsInter, &DockPluginsController::fashionSystemTraySizeChanged, this, &DockItemController::fashionSystemTraySizeChanged, Qt::QueuedConnection); + connect(m_pluginsInter, &DockPluginsController::fashionTraySizeChanged, this, &DockItemController::fashionTraySizeChanged, Qt::QueuedConnection); QMetaObject::invokeMethod(this, "refershItemsIcon", Qt::QueuedConnection); } @@ -318,7 +318,7 @@ void DockItemController::pluginItemInserted(PluginsItem *item) for (int i(0); i != m_itemList.size(); ++i) { DockItem::ItemType type = m_itemList[i]->itemType(); - if (type != DockItem::Plugins && type != DockItem::SystemTrayPlugin) + if (type != DockItem::Plugins && type != DockItem::TrayPlugin) continue; firstPluginPosition = i; @@ -390,7 +390,7 @@ void DockItemController::sortPluginItems() for (int i(0); i != m_itemList.size(); ++i) { DockItem::ItemType type = m_itemList[i]->itemType(); - if (type == DockItem::Plugins || type == DockItem::SystemTrayPlugin) + if (type == DockItem::Plugins || type == DockItem::TrayPlugin) { firstPluginIndex = i; break; diff --git a/frame/controller/dockitemcontroller.h b/frame/controller/dockitemcontroller.h index fb48baa85..5247bcd00 100644 --- a/frame/controller/dockitemcontroller.h +++ b/frame/controller/dockitemcontroller.h @@ -53,7 +53,7 @@ signals: void itemMoved(DockItem *item, const int index) const; void itemManaged(DockItem *item) const; void itemUpdated(DockItem *item) const; - void fashionSystemTraySizeChanged(const QSize &systemTraySize) const; + void fashionTraySizeChanged(const QSize &traySize) const; public slots: void refershItemsIcon(); diff --git a/frame/controller/dockpluginscontroller.cpp b/frame/controller/dockpluginscontroller.cpp index 12ef95d25..b5d85dedd 100644 --- a/frame/controller/dockpluginscontroller.cpp +++ b/frame/controller/dockpluginscontroller.cpp @@ -23,7 +23,7 @@ #include "pluginsiteminterface.h" #include "dockitemcontroller.h" #include "dockpluginloader.h" -#include "item/systemtraypluginitem.h" +#include "item/traypluginitem.h" #include #include @@ -48,10 +48,10 @@ void DockPluginsController::itemAdded(PluginsItemInterface * const itemInter, co return; PluginsItem *item = nullptr; - if (itemInter->pluginName() == "system-tray") { - item = new SystemTrayPluginItem(itemInter, itemKey); - connect(static_cast(item), &SystemTrayPluginItem::fashionSystemTraySizeChanged, - this, &DockPluginsController::fashionSystemTraySizeChanged, Qt::UniqueConnection); + if (itemInter->pluginName() == "tray") { + item = new TrayPluginItem(itemInter, itemKey); + connect(static_cast(item), &TrayPluginItem::fashionTraySizeChanged, + this, &DockPluginsController::fashionTraySizeChanged, Qt::UniqueConnection); } else { item = new PluginsItem(itemInter, itemKey); } diff --git a/frame/controller/dockpluginscontroller.h b/frame/controller/dockpluginscontroller.h index bf180b61e..b0f3940d1 100644 --- a/frame/controller/dockpluginscontroller.h +++ b/frame/controller/dockpluginscontroller.h @@ -53,7 +53,7 @@ signals: void pluginItemInserted(PluginsItem *pluginItem) const; void pluginItemRemoved(PluginsItem *pluginItem) const; void pluginItemUpdated(PluginsItem *pluginItem) const; - void fashionSystemTraySizeChanged(const QSize &systemTraySize) const; + void fashionTraySizeChanged(const QSize &traySize) const; private slots: void startLoader(); diff --git a/frame/item/dockitem.h b/frame/item/dockitem.h index e3c2b12d9..fc3987cac 100644 --- a/frame/item/dockitem.h +++ b/frame/item/dockitem.h @@ -47,7 +47,7 @@ public: Plugins, Container, Placeholder, - SystemTrayPlugin, + TrayPlugin, }; public: diff --git a/frame/item/systemtraypluginitem.cpp b/frame/item/traypluginitem.cpp similarity index 76% rename from frame/item/systemtraypluginitem.cpp rename to frame/item/traypluginitem.cpp index 69b1dbd77..8d2fc552e 100644 --- a/frame/item/systemtraypluginitem.cpp +++ b/frame/item/traypluginitem.cpp @@ -19,37 +19,37 @@ * along with this program. If not, see . */ -#include "systemtraypluginitem.h" +#include "traypluginitem.h" #include -SystemTrayPluginItem::SystemTrayPluginItem(PluginsItemInterface * const pluginInter, const QString &itemKey, QWidget *parent) +TrayPluginItem::TrayPluginItem(PluginsItemInterface * const pluginInter, const QString &itemKey, QWidget *parent) : PluginsItem(pluginInter, itemKey, parent) { } -void SystemTrayPluginItem::setSuggestIconSize(QSize size) +void TrayPluginItem::setSuggestIconSize(QSize size) { // invoke the method "setSuggestIconSize" of FashionTrayItem class QMetaObject::invokeMethod(centralWidget(), "setSuggestIconSize", Qt::QueuedConnection, Q_ARG(QSize, size)); } -void SystemTrayPluginItem::setRightSplitVisible(const bool visible) +void TrayPluginItem::setRightSplitVisible(const bool visible) { // invoke the method "setRightSplitVisible" of FashionTrayItem class QMetaObject::invokeMethod(centralWidget(), "setRightSplitVisible", Qt::QueuedConnection, Q_ARG(bool, visible)); } -bool SystemTrayPluginItem::eventFilter(QObject *watched, QEvent *e) +bool TrayPluginItem::eventFilter(QObject *watched, QEvent *e) { // 时尚模式下 - // 监听插件Widget的"FashionSystemTraySize"属性 + // 监听插件Widget的"FashionTraySize"属性 // 当接收到这个属性变化的事件后,重新计算和设置dock的大小 if (watched == centralWidget() && e->type() == QEvent::DynamicPropertyChange) { const QString &propertyName = static_cast(e)->propertyName(); - if (propertyName == "FashionSystemTraySize") { - Q_EMIT fashionSystemTraySizeChanged(watched->property("FashionSystemTraySize").toSize()); + if (propertyName == "FashionTraySize") { + Q_EMIT fashionTraySizeChanged(watched->property("FashionTraySize").toSize()); } else if (propertyName == "RequestWindowAutoHide") { Q_EMIT requestWindowAutoHide(watched->property("RequestWindowAutoHide").toBool()); } else if (propertyName == "RequestRefershWindowVisible") { diff --git a/frame/item/systemtraypluginitem.h b/frame/item/traypluginitem.h similarity index 75% rename from frame/item/systemtraypluginitem.h rename to frame/item/traypluginitem.h index 8de79b119..161ef7e54 100644 --- a/frame/item/systemtraypluginitem.h +++ b/frame/item/traypluginitem.h @@ -19,28 +19,28 @@ * along with this program. If not, see . */ -#ifndef SYSTEMTRAYPLUGINITEM_H -#define SYSTEMTRAYPLUGINITEM_H +#ifndef TRAYPLUGINITEM_H +#define TRAYPLUGINITEM_H #include "pluginsitem.h" -class SystemTrayPluginItem : public PluginsItem +class TrayPluginItem : public PluginsItem { Q_OBJECT public: - SystemTrayPluginItem(PluginsItemInterface* const pluginInter, const QString &itemKey, QWidget *parent = 0); + TrayPluginItem(PluginsItemInterface* const pluginInter, const QString &itemKey, QWidget *parent = 0); - inline ItemType itemType() const Q_DECL_OVERRIDE {return ItemType::SystemTrayPlugin;} + inline ItemType itemType() const Q_DECL_OVERRIDE {return ItemType::TrayPlugin;} void setSuggestIconSize(QSize size); void setRightSplitVisible(const bool visible); Q_SIGNALS: - void fashionSystemTraySizeChanged(const QSize &systemTraySize) const; + void fashionTraySizeChanged(const QSize &traySize) const; private: bool eventFilter(QObject *watched, QEvent *e) Q_DECL_OVERRIDE; }; -#endif // SYSTEMTRAYPLUGINITEM_H +#endif // TRAYPLUGINITEM_H diff --git a/frame/panel/mainpanel.cpp b/frame/panel/mainpanel.cpp index 80c71d135..fd4df0654 100644 --- a/frame/panel/mainpanel.cpp +++ b/frame/panel/mainpanel.cpp @@ -31,7 +31,7 @@ #include -#include +#include static DockItem *DraggingItem = nullptr; static PlaceholderItem *RequestDockItem = nullptr; @@ -311,7 +311,7 @@ void MainPanel::dragLeaveEvent(QDragLeaveEvent *e) if (DraggingItem) { DockItem::ItemType type = DraggingItem->itemType(); - if (type != DockItem::Plugins && type != DockItem::SystemTrayPlugin) + if (type != DockItem::Plugins && type != DockItem::TrayPlugin) DraggingItem->hide(); } } @@ -405,9 +405,9 @@ void MainPanel::adjustItemSize() int totalHeight = 0; const auto &itemList = m_itemController->itemList(); - // FSTray: FashionSystemTray - const QSize &FSTrayTotalSize = DockSettings::Instance().fashionSystemTraySize(); // the total size of FSTray - SystemTrayPluginItem *FSTrayItem = nullptr; // the FSTray item object + // FTray: FashionTray + const QSize &FSTrayTotalSize = DockSettings::Instance().fashionTraySize(); // the total size of FSTray + TrayPluginItem *FSTrayItem = nullptr; // the FSTray item object QSize FSTraySuggestIconSize = itemSize; // the suggested size of FStray icons for (auto item : itemList) @@ -432,11 +432,11 @@ void MainPanel::adjustItemSize() totalHeight += itemSize.height(); break; case DockItem::Plugins: - case DockItem::SystemTrayPlugin: + case DockItem::TrayPlugin: if (m_displayMode == Fashion) { // 特殊处理时尚模式下的托盘插件 - if (item->itemType() == DockItem::SystemTrayPlugin) { - FSTrayItem = static_cast(item.data()); + if (item->itemType() == DockItem::TrayPlugin) { + FSTrayItem = static_cast(item.data()); if (m_position == Dock::Top || m_position == Dock::Bottom) { // item->setFixedWidth(FSTrayTotalSize.width()); // item->setFixedHeight(itemSize.height()); @@ -548,7 +548,7 @@ void MainPanel::adjustItemSize() if (m_itemController->itemIsInContainer(item)) continue; } - if (itemType == DockItem::SystemTrayPlugin) { + if (itemType == DockItem::TrayPlugin) { if (m_displayMode == Dock::Fashion) { switch (m_position) { case Dock::Top: @@ -651,7 +651,7 @@ void MainPanel::itemDragStarted() static_cast(m_appDragWidget)->viewport()->installEventFilter(this); } - if (draggingTyep == DockItem::Plugins || draggingTyep == DockItem::SystemTrayPlugin) + if (draggingTyep == DockItem::Plugins || draggingTyep == DockItem::TrayPlugin) { if (static_cast(DraggingItem)->allowContainer()) { @@ -688,7 +688,7 @@ void MainPanel::itemDropped(QObject *destnation) // drag from container if (itemIsInContainer - && (src->itemType() == DockItem::Plugins || src->itemType() == DockItem::SystemTrayPlugin) + && (src->itemType() == DockItem::Plugins || src->itemType() == DockItem::TrayPlugin) && destnation == this) m_itemController->itemDragOutFromContainer(src); diff --git a/frame/util/docksettings.cpp b/frame/util/docksettings.cpp index 7ca42f0cb..0ea3d0dde 100644 --- a/frame/util/docksettings.cpp +++ b/frame/util/docksettings.cpp @@ -43,7 +43,7 @@ DockSettings::DockSettings(QWidget *parent) , m_autoHide(true) , m_isMaxSize(false) , m_opacity(0.4) - , m_fashionSystemTraySize(QSize(0, 0)) + , m_fashionTraySize(QSize(0, 0)) , m_fashionModeAct(tr("Fashion Mode"), this) , m_efficientModeAct(tr("Efficient Mode"), this) , m_topPosAct(tr("Top"), this) @@ -149,7 +149,7 @@ DockSettings::DockSettings(QWidget *parent) connect(m_itemController, &DockItemController::itemInserted, this, &DockSettings::dockItemCountChanged, Qt::QueuedConnection); connect(m_itemController, &DockItemController::itemRemoved, this, &DockSettings::dockItemCountChanged, Qt::QueuedConnection); - connect(m_itemController, &DockItemController::fashionSystemTraySizeChanged, this, &DockSettings::onFashionSystemTraySizeChanged, Qt::QueuedConnection); + connect(m_itemController, &DockItemController::fashionTraySizeChanged, this, &DockSettings::onFashionTraySizeChanged, Qt::QueuedConnection); connect(m_displayInter, &DBusDisplay::PrimaryRectChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection); connect(m_displayInter, &DBusDisplay::ScreenHeightChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection); @@ -526,15 +526,15 @@ void DockSettings::onOpacityChanged(const double value) emit opacityChanged(value * 255); } -void DockSettings::onFashionSystemTraySizeChanged(const QSize &systemTraySize) +void DockSettings::onFashionTraySizeChanged(const QSize &traySize) { if (m_displayMode == Dock::Efficient) return; - if (m_fashionSystemTraySize == systemTraySize) + if (m_fashionTraySize == traySize) return; - m_fashionSystemTraySize = systemTraySize; + m_fashionTraySize = traySize; calculateWindowConfig(); @@ -585,8 +585,8 @@ void DockSettings::calculateWindowConfig() } } - const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2 + m_fashionSystemTraySize.width(); - const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2 + m_fashionSystemTraySize.height(); + const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2 + m_fashionTraySize.width(); + const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2 + m_fashionTraySize.height(); const int maxWidth = m_primaryRect.width() - FASHION_MODE_PADDING * 2; const int maxHeight = m_primaryRect.height() - FASHION_MODE_PADDING * 2; const int calcWidth = qMin(maxWidth, perfectWidth); diff --git a/frame/util/docksettings.h b/frame/util/docksettings.h index cbfbc0de7..51dc09620 100644 --- a/frame/util/docksettings.h +++ b/frame/util/docksettings.h @@ -78,7 +78,7 @@ public: inline const QRect frontendWindowRect() const { return m_frontendRect; } inline const QSize windowSize() const { return m_mainWindowSize; } inline const quint8 Opacity() const { return m_opacity * 255; } - inline const QSize fashionSystemTraySize() const { return m_fashionSystemTraySize; } + inline const QSize fashionTraySize() const { return m_fashionTraySize; } const QSize panelSize() const; const QRect windowRect(const Position position, const bool hide = false) const; @@ -111,7 +111,7 @@ private slots: void resetFrontendGeometry(); void updateForbidPostions(); void onOpacityChanged(const double value); - void onFashionSystemTraySizeChanged(const QSize &systemTraySize); + void onFashionTraySizeChanged(const QSize &traySize); private: DockSettings(QWidget *parent = 0); @@ -138,7 +138,7 @@ private: QRect m_primaryRawRect; QRect m_frontendRect; QSize m_mainWindowSize; - QSize m_fashionSystemTraySize; + QSize m_fashionTraySize; WhiteMenu m_settingsMenu; WhiteMenu *m_hideSubMenu; diff --git a/plugins/tray/fashiontrayitem.cpp b/plugins/tray/fashiontrayitem.cpp index a5f0eb5b9..f8b56132c 100644 --- a/plugins/tray/fashiontrayitem.cpp +++ b/plugins/tray/fashiontrayitem.cpp @@ -198,7 +198,7 @@ void FashionTrayItem::onTrayListExpandChanged(const bool expand) } } -// used by QMetaObject::invokeMethod in SystemTrayPluginItem / MainPanel class +// used by QMetaObject::invokeMethod in TrayPluginItem / MainPanel class void FashionTrayItem::setSuggestIconSize(QSize size) { size = size * 0.6; @@ -363,9 +363,9 @@ void FashionTrayItem::setCurrentAttentionTray(FashionTrayWidgetWrapper *attentio void FashionTrayItem::requestResize() { - // reset property "FashionSystemTraySize" to notify dock resize + // reset property "FashionTraySize" to notify dock resize // DockPluginsController will watch this property - setProperty("FashionSystemTraySize", sizeHint()); + setProperty("FashionTraySize", sizeHint()); } void FashionTrayItem::moveOutAttionTray() diff --git a/plugins/tray/sni/statusnotifierwatcher.cpp b/plugins/tray/sni/statusnotifierwatcher.cpp index 0b2362d72..ebe233553 100644 --- a/plugins/tray/sni/statusnotifierwatcher.cpp +++ b/plugins/tray/sni/statusnotifierwatcher.cpp @@ -65,9 +65,9 @@ void StatusNotifierWatcher::RegisterStatusNotifierItem(const QString &serviceOrP QString notifierItemId = service + path; if (QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && !m_registeredServices.contains(notifierItemId)) { - qDebug()<<"Registering" << notifierItemId << "to system tray"; + qDebug()<<"Registering" << notifierItemId << "to tray"; - //check if the service has registered a SystemTray object + //check if the service has registered a Tray object com::deepin::dde::StatusNotifierItem trayclient(service, path, QDBusConnection::sessionBus()); if (trayclient.isValid()) { @@ -112,7 +112,7 @@ void StatusNotifierWatcher::RegisterStatusNotifierHost(const QString &service) if (service.contains(QStringLiteral("org.kde.StatusNotifierHost-")) && QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && !m_statusNotifierHostServices.contains(service)) { - qDebug()<<"Registering"<addWatchedService(service); diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index a3e8630c9..1c27bee2a 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -40,7 +40,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface * const pluginInter, const Q m_popupAdjustDelayTimer(new QTimer(this)), m_itemKey(itemKey) { - qDebug() << "load system tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget; + qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget; m_centralWidget->setParent(this); m_centralWidget->setVisible(true); diff --git a/plugins/tray/trayplugin.cpp b/plugins/tray/trayplugin.cpp index 0ff9a58c0..75e6cb2e2 100644 --- a/plugins/tray/trayplugin.cpp +++ b/plugins/tray/trayplugin.cpp @@ -42,14 +42,14 @@ TrayPlugin::TrayPlugin(QObject *parent) { m_fashionItem = new FashionTrayItem(position()); - m_tipsLabel->setObjectName("sys-tray"); + m_tipsLabel->setObjectName("tray"); m_tipsLabel->setText(tr("System Tray")); m_tipsLabel->setVisible(false); } const QString TrayPlugin::pluginName() const { - return "system-tray"; + return "tray"; } void TrayPlugin::init(PluginProxyInterface *proxyInter) @@ -308,7 +308,7 @@ void TrayPlugin::trayRemoved(const QString &itemKey) } // only delete tray object when it is a tray of applications - // set the parent of the tray object to avoid be deconstructed by parent(DockItem/PluginsItem/SystemTrayPluginsItem) + // set the parent of the tray object to avoid be deconstructed by parent(DockItem/PluginsItem/TrayPluginsItem) if (widget->trayTyep() == AbstractTrayWidget::TrayType::SystemTray) { widget->setParent(nullptr); } else {