Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions panels/dock/tray/frame/util/dockpopupwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ void DockPopupWindow::show(const int x, const int y)
break;
}
blockButtonRelease();
QScreen *screen = DIS_INS->screen(DOCK_SCREEN->current());

// find the screen where dock onto
QScreen *screen = nullptr;
for (auto tw : qApp->topLevelWidgets()) {
if (QString(tw->metaObject()->className()) == "DockTrayWindow") {
screen = tw->screen();
break;
}
};
if (!screen)
return;
QRect screenRect = screen->geometry();
Expand Down Expand Up @@ -265,8 +273,12 @@ void DockPopupWindow::onButtonPress(int type, int x, int y, const QString &key)
return;

if (m_extendWidget) {
QPoint offset = m_extendWidget->mapTo(m_extendWidget->topLevelWidget(), rect().topLeft());
auto topW = m_extendWidget->topLevelWidget();

// 计算额外添加的区域,如果鼠标的点击点在额外的区域内,也无需隐藏
QPoint extendPoint = m_extendWidget->mapToGlobal(QPoint(0, 0));
QPoint extendPoint = topW->geometry().topLeft() + offset;
auto p = m_extendWidget->mapToGlobal(QPoint(0, 0));
QRect extendRect(((extendPoint - screenRect.topLeft()) * qApp->devicePixelRatio() + screenRect.topLeft()), m_extendWidget->size() * qApp->devicePixelRatio());
if (extendRect.contains(QPoint(x, y)))
return;
Expand Down
2 changes: 1 addition & 1 deletion panels/dock/tray/plugins/notification/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_library(${PLUGIN_NAME} SHARED
notification.qrc
)
target_compile_definitions(${PLUGIN_NAME} PRIVATE QT_PLUGIN)
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ..)

target_include_directories(${PLUGIN_NAME} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../interfaces>
Expand Down
9 changes: 7 additions & 2 deletions panels/dock/tray/plugins/notification/notificationplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ void NotificationPlugin::pluginSettingsChanged()
QIcon NotificationPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
{
Q_UNUSED(themeType)
if (dockPart == DockPart::DCCSetting)
return QIcon::fromTheme("notification");
if (dockPart == DockPart::DCCSetting) {
if (themeType == DGuiApplicationHelper::LightType) {
return QIcon(":/dsg/built-in-icons/notification-dark.svg");
} else {
return QIcon(":/dsg/built-in-icons/notification.svg");
}
}
return m_notification->icon();
}

Expand Down