Merge branch '1209' into 'dbus-interface'
bug#100020图标底色 See merge request kylin-desktop/kylin-nm!508
This commit is contained in:
commit
4a3095458a
|
@ -39,7 +39,7 @@ LanListItem::LanListItem(const KyConnectItem *lanConnectItem,
|
|||
LanListItem::LanListItem(QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
m_isActive = false;
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-offline-symbolic"));
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||
setIcon(false);
|
||||
const QString str=tr("Not connected");
|
||||
m_nameLabel->setText(str);
|
||||
|
|
|
@ -36,12 +36,13 @@ WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent)
|
|||
|
||||
qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid;
|
||||
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-none-symbolic"));
|
||||
m_netButton->setDefaultPixmap();
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-offline-symbolic"));
|
||||
m_netButton->setActive(false);
|
||||
// m_netButton->setDefaultPixmap();
|
||||
const QString name = tr("Not connected");
|
||||
setExpanded(false);
|
||||
this->setName(name);
|
||||
this->m_netButton->setEnabled(false);
|
||||
// this->m_netButton->setEnabled(false);
|
||||
this->m_infoButton->hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ void MainWindow::paintWithTrans()
|
|||
tabPal.setColor(QPalette::Base, color);
|
||||
|
||||
QColor inactiveColor = qApp->palette().window().color();
|
||||
inactiveColor.setAlphaF(0.75 *m_transparency);
|
||||
inactiveColor.setAlphaF(0.86 *m_transparency);
|
||||
tabPal.setColor(QPalette::Window, inactiveColor);
|
||||
|
||||
m_centralWidget->tabBar()->setPalette(tabPal);
|
||||
|
@ -184,8 +184,8 @@ void MainWindow::initUI()
|
|||
{
|
||||
m_centralWidget = new QTabWidget(this);
|
||||
this->setCentralWidget(m_centralWidget);
|
||||
m_centralWidget->tabBar()->setFixedWidth(this->width());
|
||||
m_centralWidget->tabBar()->setStyleSheet("QTabBar::tab{min-height:40px}");
|
||||
m_centralWidget->tabBar()->setFixedWidth(this->width()+1);
|
||||
// m_centralWidget->tabBar()->setStyleSheet("QTabBar::tab{min-height:40px}");
|
||||
m_lanWidget = new LanPage(m_centralWidget);
|
||||
m_wlanWidget = new WlanPage(m_centralWidget);
|
||||
connect(this, &MainWindow::mainWindowVisibleChanged, m_wlanWidget, &WlanPage::onMainWindowVisibleChanged);
|
||||
|
@ -204,6 +204,7 @@ void MainWindow::initUI()
|
|||
m_tabBarLayout->addWidget(m_wlanLabel);
|
||||
m_centralWidget->tabBar()->setLayout(m_tabBarLayout);
|
||||
connect(m_centralWidget, &QTabWidget::currentChanged, m_wlanWidget, &WlanPage::onWlanPageVisibleChanged);
|
||||
m_centralWidget->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
paintWithTrans();
|
||||
}
|
||||
|
||||
|
|
|
@ -139,35 +139,63 @@ void RadioItemButton::paintEvent(QPaintEvent *event)
|
|||
|
||||
void RadioItemButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
m_backgroundColor = m_isActivated? FOREGROUND_COLOR_PRESS_ACTIVE :
|
||||
(qApp->palette().base().color().red() > MIDDLE_COLOR ?
|
||||
FOREGROUND_COLOR_PRESS_INACTIVE_LIGHT :
|
||||
FOREGROUND_COLOR_PRESS_INACTIVE_DARK);
|
||||
this->repaint();
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.21);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
m_backgroundColor = m_isActivated? FOREGROUND_COLOR_NORMAL_ACTIVE :
|
||||
(qApp->palette().base().color().red() > MIDDLE_COLOR ?
|
||||
FOREGROUND_COLOR_NORMAL_INACTIVE_LIGHT :
|
||||
FOREGROUND_COLOR_NORMAL_INACTIVE_DARK);
|
||||
this->repaint();
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::enterEvent(QEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.32);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::enterEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::leaveEvent(QEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::leaveEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::refreshButtonIcon()
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = FOREGROUND_COLOR_NORMAL_ACTIVE;
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE));
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
if (qApp->palette().base().color().red() > MIDDLE_COLOR) {
|
||||
m_backgroundColor = FOREGROUND_COLOR_NORMAL_INACTIVE_LIGHT;
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
} else {
|
||||
m_backgroundColor = FOREGROUND_COLOR_NORMAL_INACTIVE_DARK;
|
||||
m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ protected:
|
|||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
bool m_isActivated = false;
|
||||
|
|
Loading…
Reference in New Issue