bug#93787

This commit is contained in:
kangshuning 2021-11-30 18:14:03 +08:00
parent ae087e88d7
commit 78b653c46d
3 changed files with 14 additions and 2 deletions

View File

@ -120,7 +120,7 @@ void MainWindow::initWindowProperties()
this->setFixedSize(MAINWINDOW_WIDTH, MAINWINDOW_HEIGHT);
// //绘制毛玻璃特效
// this->setStyleSheet("background:transparent"); //透明
// this->setAttribute(Qt::WA_TranslucentBackground, true); //透明
// this->setAttribute(Qt::WA_TranslucentBackground, true); //透明
this->setWindowOpacity(0.8);
QPainterPath path;
@ -129,6 +129,15 @@ void MainWindow::initWindowProperties()
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊
}
void MainWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
painter.setPen(Qt::transparent);
auto rect = this->rect();
painter.drawRoundedRect(rect, 6, 6); //窗口圆角
}
/**
* @brief MainWindow::initUI
*/
@ -137,6 +146,7 @@ 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_lanWidget = new LanPage(m_centralWidget);
m_wlanWidget = new WlanPage(m_centralWidget);
connect(this, &MainWindow::mainWindowVisibleChanged, m_wlanWidget, &WlanPage::onMainWindowVisibleChanged);
@ -155,6 +165,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->hide();
}
/**

View File

@ -95,6 +95,7 @@ public slots:
protected:
void keyPressEvent(QKeyEvent *event);
bool eventFilter(QObject *watched, QEvent *event) override;
void paintEvent(QPaintEvent *event);
private:
void firstlyStart(); //一级启动

View File

@ -17,7 +17,7 @@
#define MAIN_LAYOUT_MARGINS 0,0,0,0
#define MAIN_LAYOUT_SPACING 0
#define TITLE_FRAME_HEIGHT 52
#define TITLE_FRAME_HEIGHT 50 //TabWidget的tab和widget有间隙和设计稿看起来一致就不能设为设计稿里的高度
#define TITLE_LAYOUT_MARGINS 24,0,24,0
#define DEVICE_LAYOUT_MARGINS 24,0,24,8
#define DEVICE_COMBOBOX_WIDTH 150