Merge branch 'dus-bugfix' into 'dbus-interface'
修改控制面板网络状态底色 See merge request kylin-desktop/kylin-nm!616
This commit is contained in:
commit
72c80c84d4
|
@ -13,9 +13,8 @@ AddNetBtn::AddNetBtn(QWidget *parent) : QPushButton(parent)
|
|||
this->setObjectName("this");
|
||||
this->setMinimumSize(QSize(580, 60));
|
||||
this->setMaximumSize(QSize(16777215, 60));
|
||||
this->setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
this->setProperty("useButtonPalette", true);
|
||||
|
||||
this->setFlat(true);
|
||||
QHBoxLayout *addLyt = new QHBoxLayout;
|
||||
|
||||
QLabel *iconLabel = new QLabel();
|
||||
|
@ -62,9 +61,18 @@ void AddNetBtn::paintEvent(QPaintEvent *event)
|
|||
|
||||
QRect rect = this->rect();
|
||||
QPainterPath path;
|
||||
path.addRoundedRect (rect, RADIUS, RADIUS);
|
||||
QRect temp_rect(rect.left(), rect.top(), rect.width(), rect.height()/2);
|
||||
path.addRect(temp_rect);
|
||||
|
||||
//设置起点
|
||||
path.moveTo(rect.topLeft().x(), rect.topLeft().y());
|
||||
path.lineTo(rect.bottomLeft().x(), rect.bottomLeft().y() - RADIUS);
|
||||
//绘制圆角 圆弧以外切圆的270度位置为起点,逆时针画圆弧运行90度结束
|
||||
path.arcTo(QRect(QPoint(rect.bottomLeft().x(), rect.bottomLeft().y() - (RADIUS * 2)), QSize(RADIUS * 2, RADIUS * 2)), 180, 90);
|
||||
path.lineTo(rect.bottomRight().x() - RADIUS, rect.bottomRight().y());
|
||||
//画圆弧
|
||||
path.arcTo(QRect(QPoint(rect.bottomRight().x() - (RADIUS * 2), rect.bottomRight().y() - (RADIUS * 2)), QSize(RADIUS * 2, RADIUS * 2)), 270, 90);
|
||||
path.lineTo(rect.topRight());
|
||||
path.lineTo(rect.topLeft());
|
||||
|
||||
painter.drawPath(path);
|
||||
QPushButton::paintEvent(event);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
|
|||
{
|
||||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
this->setFlat(true);
|
||||
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
mLanLyt->setSpacing(16);
|
||||
|
|
|
@ -48,6 +48,7 @@ const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
|||
#define TOP_MARGINS 0,8,0,0
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,8
|
||||
#define SPACING 8
|
||||
#define ICON_SIZE 16,16
|
||||
|
||||
bool sortByVal(const QPair<QString, int> &l, const QPair<QString, int> &r) {
|
||||
return (l.second < r.second);
|
||||
|
@ -431,7 +432,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
|
||||
// lanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
// }
|
||||
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
lanItem->titileLabel->setText(infoList.at(0));
|
||||
|
||||
lanItem->uuid = infoList.at(1);
|
||||
|
@ -700,7 +701,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
|
||||
// lanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
// }
|
||||
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
lanItem->titileLabel->setText(connName);
|
||||
|
||||
lanItem->uuid = connUuid;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define SIGNAL_OK 3
|
||||
#define SIGNAL_LOW 4
|
||||
#define SIGNAL_NONE 5
|
||||
#define ICON_SIZE 16,16
|
||||
|
||||
const QString WIRELESS_SWITCH = "wirelessswitch";
|
||||
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
||||
|
@ -440,7 +441,7 @@ void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString sec
|
|||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
item->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
}
|
||||
item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
qDebug() << "updateIcon" << item->titileLabel->text() << " finish";
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1007,7 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString
|
|||
wlanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
wlanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
wlanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(ICON_SIZE))));
|
||||
wlanItem->titileLabel->setText(name);
|
||||
if (status) {
|
||||
wlanItem->statusLabel->setText(tr("connected"));
|
||||
|
|
|
@ -13,7 +13,7 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
|
|||
{
|
||||
this->setMinimumSize(550, 58);
|
||||
this->setProperty("useButtonPalette", true);
|
||||
setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
|
||||
this->setFlat(true);
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
mLanLyt->setSpacing(16);
|
||||
|
@ -81,9 +81,19 @@ void WlanItem::paintEvent(QPaintEvent *event)
|
|||
painter.drawRect(rect);
|
||||
} else {
|
||||
QPainterPath path;
|
||||
path.addRoundedRect (rect, RADIUS, RADIUS);
|
||||
QRect temp_rect(rect.left(), rect.top(), rect.width(), rect.height()/2);
|
||||
path.addRect(temp_rect);
|
||||
// path.addRoundedRect (rect, RADIUS, RADIUS);
|
||||
// QRect temp_rect(rect.left(), rect.top(), rect.width(), rect.height()/2);
|
||||
// path.addRect(temp_rect);
|
||||
//设置起点
|
||||
path.moveTo(rect.topLeft().x(), rect.topLeft().y());
|
||||
path.lineTo(rect.bottomLeft().x(), rect.bottomLeft().y() - RADIUS);
|
||||
//绘制圆角 圆弧以外切圆的270度位置为起点,逆时针画圆弧运行90度结束
|
||||
path.arcTo(QRect(QPoint(rect.bottomLeft().x(), rect.bottomLeft().y() - (RADIUS * 2)), QSize(RADIUS * 2, RADIUS * 2)), 180, 90);
|
||||
path.lineTo(rect.bottomRight().x() - RADIUS, rect.bottomRight().y());
|
||||
//画圆弧
|
||||
path.arcTo(QRect(QPoint(rect.bottomRight().x() - (RADIUS * 2), rect.bottomRight().y() - (RADIUS * 2)), QSize(RADIUS * 2, RADIUS * 2)), 270, 90);
|
||||
path.lineTo(rect.topRight());
|
||||
path.lineTo(rect.topLeft());
|
||||
painter.drawPath(path);
|
||||
}
|
||||
QPushButton::paintEvent(event);
|
||||
|
|
|
@ -166,7 +166,8 @@ void MainWindow::initWindowProperties()
|
|||
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
path.addRoundedRect(rect, 12, 12);
|
||||
// path.addRoundedRect(rect, 12, 12);
|
||||
path.addRect(rect);
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊
|
||||
}
|
||||
|
||||
|
@ -175,8 +176,8 @@ void MainWindow::paintEvent(QPaintEvent *event)
|
|||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
painter.setPen(Qt::transparent);
|
||||
auto rect = this->rect();
|
||||
painter.drawRoundedRect(rect, 12, 12); //窗口圆角
|
||||
// auto rect = this->rect();
|
||||
// painter.drawRoundedRect(rect, 12, 12); //窗口圆角
|
||||
}
|
||||
|
||||
void MainWindow::initTransparency()
|
||||
|
|
Loading…
Reference in New Issue