Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification plugin not generated in correct location in debug mode #273

Merged
merged 3 commits into from
Apr 28, 2024
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 @@
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 @@
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));

Check warning on line 281 in panels/dock/tray/frame/util/dockpopupwindow.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Variable 'p' is assigned a value that is never used.
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
Loading