Skip to content

Commit

Permalink
fix #29701
Browse files Browse the repository at this point in the history
  • Loading branch information
liyandada committed Jan 18, 2021
1 parent 4499068 commit d29681a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
18 changes: 18 additions & 0 deletions src/plugins/ukui-sidebar-notification/Inside_Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ void inside_widget::paintEvent(QPaintEvent *e)
p.drawRoundedRect(rect,0,0);
QWidget::paintEvent(e);
}

TakeInCoutLabel::TakeInCoutLabel(QWidget *parent) : QLabel(parent)
{

}


void TakeInCoutLabel::paintEvent(QPaintEvent *e)
{
QPainter p(this);
QRect rect = this->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(QBrush(QColor(255,255,255)));
p.setOpacity(0.7);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect,20,20);
QLabel::paintEvent(e);
}
14 changes: 14 additions & 0 deletions src/plugins/ukui-sidebar-notification/Inside_Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QWidget>
#include <QPainter>
#include <QGSettings>
#include <QLabel>
#define UKUI_TRANSPARENCY_SETTING "org.ukui.control-center.personalise"
class inside_widget : public QWidget
{
Expand All @@ -22,4 +23,17 @@ class inside_widget : public QWidget
public slots:
};



class TakeInCoutLabel : public QLabel
{
Q_OBJECT
public:
explicit TakeInCoutLabel(QWidget *parent = nullptr);

protected:
void paintEvent(QPaintEvent *e);
};


#endif // M_PMSG_H
9 changes: 5 additions & 4 deletions src/plugins/ukui-sidebar-notification/notificationPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ NotificationPlugin::NotificationPlugin()
pNotificationVBoxLayout->addWidget(pWidget1);

//悬浮收纳数标签
m_pTakeInCoutLabel = new QLabel(m_pMainWidget);
m_pTakeInCoutLabel = new TakeInCoutLabel(m_pMainWidget);
m_pTakeInCoutLabel->setObjectName("takeincout");
m_pTakeInCoutLabel->setFixedSize(15,15);
QPalette pe1;
pe1.setColor(QPalette::WindowText,Qt::black);
m_pTakeInCoutLabel->setPalette(pe1);
Expand All @@ -98,9 +99,9 @@ NotificationPlugin::NotificationPlugin()
pQHBoxLayout2->setContentsMargins(12,0,10,8);

m_pNotificationLabel = new QLabel(QObject::tr("Important notice"));
QPalette pe2;
pe2.setColor(QPalette::WindowText,Qt::black);
m_pTakeInCoutLabel->setPalette(pe2);
// QPalette pe2;
// pe2.setColor(QPalette::WindowText,Qt::black);
// m_pTakeInCoutLabel->setPalette(pe2);
m_pNotificationLabel->setObjectName("importantnotification");
m_pNotificationLabel->setAttribute(Qt::WA_TranslucentBackground);
QSpacerItem* pHSpacer = new QSpacerItem(300, 10, QSizePolicy::Expanding, QSizePolicy::Fixed);
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/ukui-sidebar-notification/notificationPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class NotificationPlugin : public QObject, public NotificationInterface
external_widget* m_pMainWidget;
QList<AppMsg*> m_listAppMsg; //对于SingleMsg类对象用list表记录
QList<AppMsg*> m_listTakeInAppMsg;
inside_widget* m_pMsgListWidget; //消息列表部件,用于装消息的
inside_widget* m_pMsgDoubleListWidget; //消息列表部件,用于装两个消息列表的
inside_widget* m_pMsgListWidget; //消息列表部件,用于装消息的
inside_widget* m_pMsgDoubleListWidget; //消息列表部件,用于装两个消息列表的
QPropertyAnimation* m_pSwitchAnimation;
ScrollAreaWidget* m_pQScrollAreaNotify; //通知列表ScrollAreaWidget
QVBoxLayout* m_pScrollAreaNotifyVBoxLayout;
Expand All @@ -69,7 +69,7 @@ class NotificationPlugin : public QObject, public NotificationInterface
TakeInBoxToolButton* m_pTakeInBoxToolButton;
QPushButton* m_pClearAllToolButton;
QPixmap* m_pPixmap;
QLabel* m_pTakeInCoutLabel; //收纳盒计数统计Label
TakeInCoutLabel* m_pTakeInCoutLabel; //收纳盒计数统计Label
bool m_bInitialFlag; //初始化标志

double transparency = 0.7;
Expand Down

0 comments on commit d29681a

Please sign in to comment.