mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00

快捷面板点击到了非展开区域的情况下,直接打开快捷面板的弹出窗口,导致隐藏了快捷面板窗口 Log: 优化快捷面板交互问题 Influence: 从快捷面板展开蓝牙或者网络右侧的展开按钮,观察是否显示正常 Task: https://pms.uniontech.com/task-view-211641.html Change-Id: I52a3a74d035aed28465d82c5efb680f9ddb9ded8
568 lines
19 KiB
C++
568 lines
19 KiB
C++
/*
|
||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||
*
|
||
* Author: donghualin <donghualin@uniontech.com>
|
||
*
|
||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation, either version 3 of the License, or
|
||
* any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU General Public License
|
||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
*/
|
||
#include "quicksettingcontainer.h"
|
||
#include "brightnessmodel.h"
|
||
#include "quicksettingcontroller.h"
|
||
#include "pluginsiteminterface.h"
|
||
#include "quicksettingitem.h"
|
||
#include "mediawidget.h"
|
||
#include "dockpopupwindow.h"
|
||
#include "brightnesswidget.h"
|
||
#include "slidercontainer.h"
|
||
#include "pluginchildpage.h"
|
||
#include "utils.h"
|
||
#include "displaysettingwidget.h"
|
||
|
||
#include <DListView>
|
||
#include <DStyle>
|
||
#include <QDrag>
|
||
|
||
#include <QVBoxLayout>
|
||
#include <QMetaObject>
|
||
#include <QStackedLayout>
|
||
#include <QMouseEvent>
|
||
|
||
DWIDGET_USE_NAMESPACE
|
||
|
||
struct QuickDragInfo {
|
||
QPoint dragPosition;
|
||
QWidget *dragItem = nullptr;
|
||
PluginsItemInterface *pluginInter = nullptr;
|
||
void reset() {
|
||
dragPosition.setX(0);
|
||
dragPosition.setY(0);
|
||
dragItem = nullptr;
|
||
pluginInter = nullptr;
|
||
}
|
||
bool isNull() {
|
||
return !dragItem;
|
||
}
|
||
} QuickDragInfo;
|
||
|
||
#define ITEMWIDTH 70
|
||
#define ITEMHEIGHT 60
|
||
#define ITEMSPACE 10
|
||
#define COLUMNCOUNT 4
|
||
|
||
DockPopupWindow *QuickSettingContainer::m_popWindow = nullptr;
|
||
Dock::Position QuickSettingContainer::m_position = Dock::Position::Bottom;
|
||
|
||
QuickSettingContainer::QuickSettingContainer(QWidget *parent)
|
||
: QWidget(parent)
|
||
, m_switchLayout(new QStackedLayout(this))
|
||
, m_mainWidget(new QWidget(this))
|
||
, m_pluginWidget(new QWidget(m_mainWidget))
|
||
, m_pluginLayout(new QGridLayout(m_pluginWidget))
|
||
, m_componentWidget(new QWidget(m_mainWidget))
|
||
, m_mainlayout(new QVBoxLayout(m_mainWidget))
|
||
, m_pluginLoader(QuickSettingController::instance())
|
||
, m_playerWidget(new MediaWidget(m_componentWidget))
|
||
, m_brightnessModel(new BrightnessModel(this))
|
||
, m_brihtnessWidget(new BrightnessWidget(m_brightnessModel, m_componentWidget))
|
||
, m_displaySettingWidget(new DisplaySettingWidget(this))
|
||
, m_childPage(new PluginChildPage(this))
|
||
, m_dragInfo(new struct QuickDragInfo)
|
||
{
|
||
initUi();
|
||
initConnection();
|
||
m_childPage->installEventFilter(this);
|
||
setMouseTracking(true);
|
||
}
|
||
|
||
QuickSettingContainer::~QuickSettingContainer()
|
||
{
|
||
delete m_dragInfo;
|
||
}
|
||
|
||
void QuickSettingContainer::showHomePage()
|
||
{
|
||
m_switchLayout->setCurrentIndex(0);
|
||
}
|
||
|
||
// 根据位置获取箭头的方向
|
||
static DArrowRectangle::ArrowDirection getDirection(const Dock::Position &position)
|
||
{
|
||
switch (position) {
|
||
case Dock::Position::Top:
|
||
return DArrowRectangle::ArrowDirection::ArrowTop;
|
||
case Dock::Position::Left:
|
||
return DArrowRectangle::ArrowDirection::ArrowLeft;
|
||
case Dock::Position::Right:
|
||
return DArrowRectangle::ArrowDirection::ArrowRight;
|
||
default:
|
||
return DArrowRectangle::ArrowDirection::ArrowBottom;
|
||
}
|
||
|
||
return DArrowRectangle::ArrowDirection::ArrowBottom;
|
||
}
|
||
|
||
DockPopupWindow *QuickSettingContainer::popWindow()
|
||
{
|
||
if (m_popWindow) {
|
||
QuickSettingContainer *container = static_cast<QuickSettingContainer *>(m_popWindow->getContent());
|
||
container->showHomePage();
|
||
return m_popWindow;
|
||
}
|
||
|
||
m_popWindow = new DockPopupWindow;
|
||
m_popWindow->setWindowFlag(Qt::Popup);
|
||
m_popWindow->setShadowBlurRadius(20);
|
||
m_popWindow->setRadius(18);
|
||
m_popWindow->setShadowYOffset(2);
|
||
m_popWindow->setShadowXOffset(0);
|
||
m_popWindow->setArrowWidth(18);
|
||
m_popWindow->setArrowHeight(10);
|
||
m_popWindow->setArrowDirection(getDirection(m_position));
|
||
m_popWindow->setContent(new QuickSettingContainer(m_popWindow));
|
||
if (Utils::IS_WAYLAND_DISPLAY)
|
||
m_popWindow->setWindowFlags(m_popWindow->windowFlags() | Qt::FramelessWindowHint | Qt::Popup);
|
||
return m_popWindow;
|
||
}
|
||
|
||
void QuickSettingContainer::setPosition(Position position)
|
||
{
|
||
if (m_position == position)
|
||
return;
|
||
|
||
m_position = position;
|
||
|
||
if (m_popWindow) {
|
||
m_popWindow->setArrowDirection(getDirection(m_position));
|
||
// 在任务栏位置发生变化的时候,需要将当前的content获取后,重新调用setContent接口
|
||
// 如果不调用,那么就会出现内容在容器内部的位置错误,界面上的布局会乱
|
||
QWidget *widget = m_popWindow->getContent();
|
||
m_popWindow->setContent(widget);
|
||
}
|
||
}
|
||
|
||
void QuickSettingContainer::initQuickItem(PluginsItemInterface *plugin)
|
||
{
|
||
QuickSettingItem *quickItem = new QuickSettingItem(plugin, m_pluginLoader->itemKey(plugin), m_pluginLoader->metaData(plugin));
|
||
quickItem->setParent(m_pluginWidget);
|
||
quickItem->setMouseTracking(true);
|
||
quickItem->installEventFilter(this);
|
||
connect(quickItem, &QuickSettingItem::detailClicked, this, &QuickSettingContainer::onItemDetailClick);
|
||
m_quickSettings << quickItem;
|
||
}
|
||
|
||
void QuickSettingContainer::onItemDetailClick(PluginsItemInterface *pluginInter)
|
||
{
|
||
QuickSettingItem *quickItemWidget = static_cast<QuickSettingItem *>(sender());
|
||
if (!quickItemWidget)
|
||
return;
|
||
|
||
QWidget *widget = pluginInter->itemPopupApplet(QUICK_ITEM_KEY);
|
||
if (!widget)
|
||
return;
|
||
|
||
showWidget(widget, pluginInter->pluginDisplayName());
|
||
onResizeView();
|
||
}
|
||
|
||
bool QuickSettingContainer::eventFilter(QObject *watched, QEvent *event)
|
||
{
|
||
switch (event->type()) {
|
||
case QEvent::Resize: {
|
||
if (watched == m_childPage)
|
||
onResizeView();
|
||
break;
|
||
}
|
||
case QEvent::MouseButtonPress: {
|
||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||
QuickSettingItem *item = qobject_cast<QuickSettingItem *>(watched);
|
||
if (item) {
|
||
m_dragInfo->dragPosition = mouseEvent->pos();
|
||
m_dragInfo->dragItem = item;
|
||
m_dragInfo->pluginInter = item->pluginItem();
|
||
} else {
|
||
QList<PluginsItemInterface *> plugins = QuickSettingController::instance()->pluginItems(QuickSettingController::PluginAttribute::Quick);
|
||
for (PluginsItemInterface *plugin : plugins) {
|
||
if (!isApplet(plugin))
|
||
continue;
|
||
|
||
if (plugin->itemWidget(QUICK_ITEM_KEY) != watched)
|
||
continue;
|
||
|
||
m_dragInfo->dragPosition = mouseEvent->pos();
|
||
m_dragInfo->dragItem = plugin->itemWidget(QUICK_ITEM_KEY);
|
||
m_dragInfo->pluginInter = plugin;
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
case QEvent::MouseButtonRelease: {
|
||
m_dragInfo->reset();
|
||
break;
|
||
}
|
||
default:
|
||
break;
|
||
}
|
||
|
||
return QWidget::eventFilter(watched, event);
|
||
}
|
||
|
||
void QuickSettingContainer::showWidget(QWidget *widget, const QString &title)
|
||
{
|
||
m_childPage->setTitle(title);
|
||
m_childPage->pushWidget(widget);
|
||
m_switchLayout->setCurrentWidget(m_childPage);
|
||
}
|
||
|
||
QPoint QuickSettingContainer::hotSpot(const QPixmap &pixmap)
|
||
{
|
||
if (m_position == Dock::Position::Left)
|
||
return QPoint(0, pixmap.height());
|
||
|
||
if (m_position == Dock::Position::Top)
|
||
return QPoint(pixmap.width(), 0);
|
||
|
||
return QPoint(pixmap.width(), pixmap.height());
|
||
}
|
||
|
||
bool QuickSettingContainer::isApplet(PluginsItemInterface *itemInter) const
|
||
{
|
||
if (!itemInter->itemWidget(QUICK_ITEM_KEY))
|
||
return false;
|
||
|
||
QJsonObject json = QuickSettingController::instance()->metaData(itemInter);
|
||
if (!json.contains("applet"))
|
||
return false;
|
||
|
||
return json.value("applet").toBool();
|
||
}
|
||
|
||
bool QuickSettingContainer::isQuickPlugin(PluginsItemInterface *itemInter) const
|
||
{
|
||
// 先判断是否为快捷面板区域(类似声音、亮度,音乐等)
|
||
QWidget *itemWidget = itemInter->itemWidget(QUICK_ITEM_KEY);
|
||
if (itemWidget) {
|
||
for (int i = 0; i < m_componentWidget->layout()->count(); i++) {
|
||
QLayoutItem *layoutItem = m_componentWidget->layout()->itemAt(i);
|
||
if (!layoutItem)
|
||
continue;
|
||
|
||
DBlurEffectWidget *effectWidget = qobject_cast<DBlurEffectWidget *>(layoutItem->widget());
|
||
if (!effectWidget || !effectWidget->layout())
|
||
continue;
|
||
|
||
for (int j = 0; j < effectWidget->layout()->count(); j++) {
|
||
QLayoutItem *layoutItem = effectWidget->layout()->itemAt(i);
|
||
if (!layoutItem || layoutItem->widget() != itemWidget)
|
||
continue;
|
||
|
||
return true;
|
||
}
|
||
}
|
||
} else {
|
||
for (QuickSettingItem *settingItem : m_quickSettings) {
|
||
if (settingItem->pluginItem() != itemInter)
|
||
continue;
|
||
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void QuickSettingContainer::onPluginInsert(PluginsItemInterface * itemInter)
|
||
{
|
||
QWidget *itemWidget = itemInter->itemWidget(QUICK_ITEM_KEY);
|
||
if (isApplet(itemInter)) {
|
||
// 如果存在这个窗体,就让其显示在下方
|
||
DBlurEffectWidget *effectWidget = new DBlurEffectWidget(m_componentWidget);
|
||
QVBoxLayout *layout = new QVBoxLayout(effectWidget);
|
||
layout->setContentsMargins(0, 0, 0, 0);
|
||
itemWidget->setParent(effectWidget);
|
||
itemWidget->setVisible(true);
|
||
layout->addWidget(itemWidget);
|
||
effectWidget->setFixedHeight(itemWidget->height());
|
||
effectWidget->setMaskColor(QColor(239, 240, 245));
|
||
effectWidget->setBlurRectXRadius(8);
|
||
effectWidget->setBlurRectYRadius(8);
|
||
m_componentWidget->layout()->addWidget(effectWidget);
|
||
|
||
itemWidget->installEventFilter(this);
|
||
} else {
|
||
// 如果不存在获取到的子窗体,就让其显示在上方插件显示的位置
|
||
initQuickItem(itemInter);
|
||
updateItemLayout();
|
||
}
|
||
onResizeView();
|
||
}
|
||
|
||
void QuickSettingContainer::onPluginRemove(PluginsItemInterface * itemInter)
|
||
{
|
||
QWidget *itemWidget = itemInter->itemWidget(QUICK_ITEM_KEY);
|
||
if (itemWidget) {
|
||
for (int i = 0; i < m_componentWidget->layout()->count(); i++) {
|
||
QLayoutItem *layoutItem = m_componentWidget->layout()->itemAt(i);
|
||
if (!layoutItem)
|
||
continue;
|
||
|
||
DBlurEffectWidget *effectWidget = qobject_cast<DBlurEffectWidget *>(layoutItem->widget());
|
||
if (!effectWidget || !effectWidget->layout())
|
||
continue;
|
||
|
||
bool found = false;
|
||
for (int j = 0; j < effectWidget->layout()->count(); j++) {
|
||
QLayoutItem *layoutItem = effectWidget->layout()->itemAt(i);
|
||
if (!layoutItem)
|
||
continue;
|
||
|
||
if (layoutItem->widget() == itemWidget) {
|
||
effectWidget->layout()->removeWidget(itemWidget);
|
||
itemWidget->setParent(nullptr);
|
||
found = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!found)
|
||
continue;
|
||
|
||
m_componentWidget->layout()->removeWidget(effectWidget);
|
||
effectWidget->setParent(nullptr);
|
||
effectWidget->deleteLater();
|
||
break;
|
||
}
|
||
} else {
|
||
QuickSettingItem *quickItem = nullptr;
|
||
for (QuickSettingItem *settingItem : m_quickSettings) {
|
||
if (settingItem->pluginItem() != itemInter)
|
||
continue;
|
||
|
||
quickItem = settingItem;
|
||
break;
|
||
}
|
||
if (!quickItem)
|
||
return;
|
||
|
||
m_pluginLayout->removeWidget(quickItem);
|
||
m_quickSettings.removeOne(quickItem);
|
||
disconnect(quickItem, &QuickSettingItem::detailClicked, this, &QuickSettingContainer::onItemDetailClick);
|
||
quickItem->setParent(nullptr);
|
||
quickItem->removeEventFilter(this);
|
||
quickItem->setMouseTracking(false);
|
||
quickItem->deleteLater();
|
||
|
||
//调整子控件的位置
|
||
updateItemLayout();
|
||
}
|
||
|
||
onResizeView();
|
||
}
|
||
|
||
void QuickSettingContainer::mouseMoveEvent(QMouseEvent *event)
|
||
{
|
||
if (m_dragInfo->isNull())
|
||
return;
|
||
|
||
QPoint pointCurrent = event->pos();
|
||
if (qAbs(m_dragInfo->dragPosition.x() - pointCurrent.x()) > 5
|
||
|| qAbs(m_dragInfo->dragPosition.y() - pointCurrent.y()) > 5) {
|
||
|
||
QDrag *drag = new QDrag(this);
|
||
QuickSettingItem *moveItem = qobject_cast<QuickSettingItem *>(m_dragInfo->dragItem);
|
||
QuickPluginMimeData *mimedata = new QuickPluginMimeData(m_dragInfo->pluginInter);
|
||
drag->setMimeData(mimedata);
|
||
if (moveItem) {
|
||
QPixmap dragPixmap = moveItem->dragPixmap();
|
||
drag->setPixmap(dragPixmap);
|
||
drag->setHotSpot(hotSpot(dragPixmap));
|
||
} else {
|
||
// 如果拖动的是声音等插件
|
||
QPixmap dragPixmap = m_dragInfo->dragItem->grab();
|
||
drag->setPixmap(dragPixmap);
|
||
drag->setHotSpot(hotSpot(dragPixmap));
|
||
}
|
||
|
||
m_dragInfo->reset();
|
||
drag->exec(Qt::MoveAction | Qt::CopyAction);
|
||
}
|
||
}
|
||
|
||
void QuickSettingContainer::updateItemLayout()
|
||
{
|
||
// 清空之前的控件,重新添加
|
||
while (m_pluginLayout->count() > 0)
|
||
m_pluginLayout->takeAt(0);
|
||
|
||
int row = 0;
|
||
int column = 0;
|
||
for (QuickSettingItem *item : m_quickSettings) {
|
||
int usedColumn = item->isPrimary() ? 2 : 1;
|
||
m_pluginLayout->addWidget(item, row, column, 1, usedColumn);
|
||
column += usedColumn;
|
||
if (column >= COLUMNCOUNT) {
|
||
row++;
|
||
column = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
void QuickSettingContainer::initUi()
|
||
{
|
||
auto setWidgetStyle = [](DBlurEffectWidget *widget) {
|
||
widget->setMaskColor(QColor(239, 240, 245));
|
||
widget->setBlurRectXRadius(8);
|
||
widget->setBlurRectYRadius(8);
|
||
};
|
||
|
||
// 添加音乐播放插件
|
||
m_playerWidget->setFixedHeight(ITEMHEIGHT);
|
||
m_brihtnessWidget->setFixedHeight(ITEMHEIGHT);
|
||
|
||
setWidgetStyle(m_playerWidget);
|
||
setWidgetStyle(m_brihtnessWidget);
|
||
|
||
m_mainlayout->setSpacing(ITEMSPACE);
|
||
m_mainlayout->setContentsMargins(ITEMSPACE, ITEMSPACE, ITEMSPACE, ITEMSPACE);
|
||
|
||
m_pluginLayout->setContentsMargins(0, 0, 0, 0);
|
||
m_pluginLayout->setSpacing(ITEMSPACE);
|
||
m_pluginLayout->setAlignment(Qt::AlignLeft);
|
||
for (int i = 0; i < COLUMNCOUNT; i++)
|
||
m_pluginLayout->setColumnMinimumWidth(i, ITEMWIDTH);
|
||
|
||
m_pluginWidget->setLayout(m_pluginLayout);
|
||
m_mainlayout->addWidget(m_pluginWidget);
|
||
|
||
QVBoxLayout *ctrlLayout = new QVBoxLayout(m_componentWidget);
|
||
ctrlLayout->setContentsMargins(0, 0, 0, 0);
|
||
ctrlLayout->setSpacing(ITEMSPACE);
|
||
|
||
ctrlLayout->addWidget(m_playerWidget);
|
||
ctrlLayout->addWidget(m_brihtnessWidget);
|
||
|
||
m_mainlayout->addWidget(m_componentWidget);
|
||
// 加载所有的插件
|
||
QList<PluginsItemInterface *> plugins = m_pluginLoader->pluginItems(QuickSettingController::PluginAttribute::Quick);
|
||
for (PluginsItemInterface *plugin : plugins)
|
||
onPluginInsert(plugin);
|
||
|
||
m_switchLayout->addWidget(m_mainWidget);
|
||
m_switchLayout->addWidget(m_childPage);
|
||
|
||
setMouseTracking(true);
|
||
setAcceptDrops(true);
|
||
|
||
QMetaObject::invokeMethod(this, [ = ] {
|
||
if (plugins.size() > 0)
|
||
updateItemLayout();
|
||
// 设置当前窗口的大小
|
||
onResizeView();
|
||
setFixedWidth(ITEMWIDTH * 4 + (ITEMSPACE * 5));
|
||
}, Qt::QueuedConnection);
|
||
|
||
m_displaySettingWidget->setVisible(false);
|
||
}
|
||
|
||
void QuickSettingContainer::initConnection()
|
||
{
|
||
connect(m_pluginLoader, &QuickSettingController::pluginInserted, this, [ = ](PluginsItemInterface *itemInter, const QuickSettingController::PluginAttribute &pluginClass) {
|
||
if (pluginClass != QuickSettingController::PluginAttribute::Quick)
|
||
return;
|
||
|
||
onPluginInsert(itemInter);
|
||
});
|
||
connect(m_pluginLoader, &QuickSettingController::pluginRemoved, this, &QuickSettingContainer::onPluginRemove);
|
||
connect(m_pluginLoader, &QuickSettingController::requestAppletShow, this, &QuickSettingContainer::onRequestAppletShow);
|
||
connect(m_playerWidget, &MediaWidget::visibleChanged, this, &QuickSettingContainer::onResizeView);
|
||
connect(m_brihtnessWidget, &BrightnessWidget::visibleChanged, this, &QuickSettingContainer::onResizeView);
|
||
connect(m_brihtnessWidget->sliderContainer(), &SliderContainer::iconClicked, this, [ this ](const SliderContainer::IconPosition &iconPosition) {
|
||
if (iconPosition == SliderContainer::RightIcon) {
|
||
// 点击右侧的按钮,弹出具体的调节的界面
|
||
showWidget(m_displaySettingWidget, tr("brightness"));
|
||
onResizeView();
|
||
}
|
||
});
|
||
connect(m_childPage, &PluginChildPage::back, this, [ this ] {
|
||
m_switchLayout->setCurrentWidget(m_mainWidget);
|
||
});
|
||
connect(m_childPage, &PluginChildPage::closeSelf, this, [ this ] {
|
||
if (!m_childPage->isBack())
|
||
topLevelWidget()->hide();
|
||
});
|
||
}
|
||
|
||
// 调整尺寸
|
||
void QuickSettingContainer::onResizeView()
|
||
{
|
||
if (m_switchLayout->currentWidget() == m_mainWidget) {
|
||
int selfPluginCount = 0;
|
||
for (QuickSettingItem *item : m_quickSettings) {
|
||
// 如果是置顶的插件,则认为它占用两个普通插件的位置
|
||
int increCount = (item->isPrimary() ? 2 : 1);
|
||
selfPluginCount += increCount;
|
||
}
|
||
int rowCount = selfPluginCount / COLUMNCOUNT;
|
||
if (selfPluginCount % COLUMNCOUNT > 0)
|
||
rowCount++;
|
||
|
||
m_pluginWidget->setFixedHeight(ITEMHEIGHT * rowCount + ITEMSPACE * (rowCount - 1));
|
||
|
||
int height = 0;
|
||
int widgetCount = 0;
|
||
for (int i = 0; i < m_componentWidget->layout()->count(); i++) {
|
||
QLayoutItem *layoutItem = m_componentWidget->layout()->itemAt(i);
|
||
if (!layoutItem)
|
||
continue;
|
||
|
||
DBlurEffectWidget *widget = qobject_cast<DBlurEffectWidget *>(layoutItem->widget());
|
||
if (!widget)
|
||
continue;
|
||
|
||
if (widget == m_playerWidget || widget == m_brihtnessWidget)
|
||
continue;
|
||
|
||
height += widget->height();
|
||
widgetCount++;
|
||
}
|
||
|
||
if (m_playerWidget->isVisible()) {
|
||
height += m_playerWidget->height();
|
||
widgetCount++;
|
||
}
|
||
if (m_brihtnessWidget->isVisible()) {
|
||
height += m_brihtnessWidget->height();
|
||
widgetCount++;
|
||
}
|
||
|
||
m_componentWidget->setFixedHeight(height + (widgetCount - 1) * ITEMSPACE);
|
||
|
||
setFixedHeight(ITEMSPACE * 3 + m_pluginWidget->height() + m_componentWidget->height());
|
||
} else if (m_switchLayout->currentWidget() == m_childPage) {
|
||
setFixedHeight(m_childPage->height());
|
||
}
|
||
}
|
||
|
||
void QuickSettingContainer::onRequestAppletShow(PluginsItemInterface *itemInter, const QString &itemKey)
|
||
{
|
||
// 显示弹出的内容
|
||
QWidget *itemApplet = itemInter->itemPopupApplet(itemKey);
|
||
if (!itemApplet)
|
||
return;
|
||
|
||
showWidget(itemApplet, itemInter->pluginDisplayName());
|
||
onResizeView();
|
||
}
|