Skip to content

Commit acbe93a

Browse files
authored
Merge pull request #388 from DkAlsace/dbq04261
bug46939双屏扩展模式下闹钟的提示弹窗未显示在桌面右下角
2 parents b9f6379 + 479ed61 commit acbe93a

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/plugins/ukui-clock/clock.cpp

+30-1
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,8 @@ void Clock::countdownNoticeDialogShow()
20272027
if (model_setup->index(0, 3).data().toInt()) {
20282028
countdownNoticeDialog->showFullScreen();
20292029
} else {
2030-
countdownNoticeDialog->move(screen_width-350,screen_height-150);
2030+
moveUnderMultiScreen(SP_RIGHT);
2031+
// countdownNoticeDialog->move(screen_width-350,screen_height-150);
20312032
}
20322033
countdownNoticeDialog->music->setVolume(model_setup->index(0, 6).data().toInt());
20332034
countdownNoticeDialog->timer->start();
@@ -3027,6 +3028,34 @@ void Clock::showPaint8()
30273028
}
30283029
}
30293030

3031+
void Clock::moveUnderMultiScreen(Clock::ScreenPosition spostion)
3032+
{
3033+
QScreen *screen=QGuiApplication::primaryScreen ();
3034+
int screen_width = screen->geometry().width();
3035+
int screen_height = screen->geometry().height();
3036+
switch (spostion) {
3037+
case SP_LEFT:
3038+
{
3039+
QPoint po = this->geometry().bottomLeft();
3040+
countdownNoticeDialog->move(po.x(),po.y());
3041+
}break;
3042+
case SP_RIGHT:
3043+
{
3044+
3045+
QPoint po = this->geometry().bottomRight();
3046+
//略微调整下右下角
3047+
countdownNoticeDialog->move(po.x()+screen_width/4,po.y());
3048+
}break;
3049+
case SP_CENTER:
3050+
{
3051+
QPoint po = this->geometry().center();
3052+
countdownNoticeDialog->move(po);
3053+
}break;
3054+
default:
3055+
{}
3056+
}
3057+
}
3058+
30303059
/*窗口拖动事件,
30313060
*添加原因为:通用窗口拖动事件导致窗口周边大约8像素左右无法拖动。
30323061
*注释原因为:非系统窗口拖动事件会导致在4K屏幕下,拖动光标偏移现象。

src/plugins/ukui-clock/clock.h

+6
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ class Clock : public QWidget
131131
void showPaint1();
132132
void showPaint7();
133133
void showPaint8();
134+
enum ScreenPosition {
135+
SP_LEFT = 1,
136+
SP_CENTER,
137+
SP_RIGHT
138+
};
134139

140+
void moveUnderMultiScreen(Clock::ScreenPosition); //多显示器下,位置移动
135141
Ui::Clock *ui;
136142
QSqlTableModel *model_setup;
137143

0 commit comments

Comments
 (0)