Merge pull request !99 from 杨敏/openkylin/nile
This commit is contained in:
杨敏 2024-08-15 05:43:46 +00:00 committed by Gitee
commit 63374cb298
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 65 additions and 2 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
ukui-screensaver (4.10.0.0-ok30~0815) nile; urgency=medium
* BUG号#IAHFEB 锁屏登录界面网络连接按钮悬浮色与其他按钮不一致
#IA5AIS【次要】【屏保】mp4动态屏保的预览界面、屏保界面不会循环播放
#IABL4C【次要】【gg-维哈柯】【屏保】哈柯文,屏保界面休息时间,时分秒显示顺序错误
* 需求号:无
* 其他改动说明:无
* 其他改动影响域:无
-- Yang Min <yangmin@kylinos.cn> Thu, 15 Aug 2024 13:39:12 +0800
ukui-screensaver (4.10.0.0-ok29~0802) nile; urgency=medium
* BUG号#IAF8BR 显示器息屏后,自动断开重连会导致电脑自动解锁登录

View File

@ -118,7 +118,7 @@ add_executable(ukui-screensaver-dialog ${dialog_SRC})
add_definitions(-DAPP_API_MAJOR=0
-DAPP_API_MINOR=11
-DAPP_API_FUNC=0
# -DSUPPORT_MEDIA_CONTROL
-DSUPPORT_MEDIA_CONTROL
)
target_include_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_INCLUDE_DIRS} ${KYSDKWAYLANDHELPER_INCLUDE_DIRS})
target_link_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_LIBRARY_DIRS} ${KYSDKWAYLANDHELPER_LIBRARY_DIRS})

View File

@ -18,7 +18,9 @@
#include "networkbutton.h"
#include <QStylePainter>
#include <QStyleOption>
#include <QApplication>
#include <QMouseEvent>
#include "commonfunc.h"
NetWorkButton::NetWorkButton(QWidget *parent) : KyNetworkIcon(parent)
{
@ -58,6 +60,14 @@ void NetWorkButton::paintEvent(QPaintEvent *e)
// painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
// painter.restore();
// }
if (option.state & QStyle::State_MouseOver) {
painter.save();
painter.setPen(Qt::NoPen);
painter.setBrush(Qt::white);
painter.setOpacity(0.15);
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
painter.restore();
}
if (curStatus == CLICKED) {
painter.save();
@ -84,7 +94,49 @@ void NetWorkButton::paintEvent(QPaintEvent *e)
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
painter.restore();
}
QPushButton::paintEvent(e);
if (option.state & QStyle::State_HasFocus) {
painter.save();
painter.setPen(Qt::NoPen);
painter.setBrush(Qt::white);
painter.setOpacity(0.25);
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
painter.restore();
painter.save();
QStyleOption opt;
QColor color = opt.palette.color(QPalette::Highlight);
painter.setPen(QPen(color, 2));
painter.setBrush(Qt::NoBrush);
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
painter.restore();
}
// 绘制图片
int buttonWidget = this->width();
int buttonHeight = this->height();
QRect buttonRect(0, 0, buttonWidget, buttonHeight);
QPixmap pixmap = option.icon.pixmap(option.iconSize, QIcon::Active);
pixmap = drawSymbolicColoredPixmap(pixmap, "white");
int pixmapWidth = static_cast<int>(pixmap.width() / qApp->devicePixelRatio());
int pixmapHeight = static_cast<int>(pixmap.height() / qApp->devicePixelRatio());
QRect pixmapRect(0, 0, pixmapWidth, pixmapHeight);
int deltaX = 0;
int deltaY = 0;
if (pixmapRect.width() < buttonRect.width())
deltaX = buttonRect.width() - pixmapRect.width();
else
deltaX = pixmapRect.width() - buttonRect.width();
if (pixmapRect.height() < buttonRect.height())
deltaY = buttonRect.height() - pixmapRect.height();
else
deltaY = pixmapRect.height() - buttonRect.height();
painter.save();
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter.translate(deltaX / 2, deltaY / 2);
painter.drawPixmap(pixmapRect, pixmap);
painter.restore();
}
void NetWorkButton::mouseReleaseEvent(QMouseEvent *e)