fix bug 143364

This commit is contained in:
jzxc95 2022-10-21 11:12:04 +08:00
parent ab2f346c1d
commit 264bf84b97
4 changed files with 50 additions and 2 deletions

View File

@ -508,7 +508,7 @@ void MainWindow::showByWaylandHelper()
//去除窗管标题栏传入参数为QWidget* //去除窗管标题栏传入参数为QWidget*
kdk::UkuiStyleHelper::self()->removeHeader(this); kdk::UkuiStyleHelper::self()->removeHeader(this);
this->show(); this->show();
initPlatform(); getTabletMode();
resetWindowPosition(); resetWindowPosition();
//设置窗体位置传入参数为QWindow*QRect //设置窗体位置传入参数为QWindow*QRect
@ -529,6 +529,29 @@ void MainWindow::setCentralWidgetType(IconActiveType iconStatus)
} }
} }
void MainWindow::getTabletMode()
{
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"),
QString("/"),
QString("qt5-ukui-platformtheme"),
QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool)));
QDBusInterface interface(QString("com.kylin.statusmanager.interfacer"),
QString("/"),
QString("qt5-ukui-platformtheme"),
QDBusConnection::sessionBus);
if(!interface.isValid()) {
m_isShowInCenter = true;
return;
}
QDBusReply<bool> reply = interface->call("get_current_tabletmode");
if (!reply.isValid()) {
m_isShowInCenter = true;
return;
}
m_isShowInCenter = reply.value();
}
/** /**
* @brief MainWindow::onTrayIconActivated * @brief MainWindow::onTrayIconActivated
*/ */

View File

@ -161,6 +161,7 @@ private:
void showControlCenter(); void showControlCenter();
void showByWaylandHelper(); void showByWaylandHelper();
void setCentralWidgetType(IconActiveType iconStatus); void setCentralWidgetType(IconActiveType iconStatus);
void getTabletMode();
double m_transparency=1.0; //透明度 double m_transparency=1.0; //透明度
QGSettings * m_transGsettings; //透明度配置文件 QGSettings * m_transGsettings; //透明度配置文件
int currentIconIndex=0; int currentIconIndex=0;

View File

@ -120,7 +120,6 @@ void vpnMainWindow::firstlyStart()
initDbusConnnect(); initDbusConnnect();
initWindowTheme(); initWindowTheme();
initTrayIcon(); initTrayIcon();
initPlatform();
installEventFilter(this); installEventFilter(this);
m_secondaryStartTimer = new QTimer(this); m_secondaryStartTimer = new QTimer(this);
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() { connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
@ -428,6 +427,7 @@ void vpnMainWindow::showByWaylandHelper()
//去除窗管标题栏传入参数为QWidget* //去除窗管标题栏传入参数为QWidget*
kdk::UkuiStyleHelper::self()->removeHeader(this); kdk::UkuiStyleHelper::self()->removeHeader(this);
this->show(); this->show();
getTabletMode();
resetWindowPosition(); resetWindowPosition();
//设置窗体位置传入参数为QWindow*QRect //设置窗体位置传入参数为QWindow*QRect
@ -448,6 +448,29 @@ void vpnMainWindow::setCentralWidgetType(IconActiveType iconStatus)
} }
} }
void vpnMainWindow::getTabletMode()
{
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"),
QString("/"),
QString("qt5-ukui-platformtheme"),
QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool)));
QDBusInterface interface(QString("com.kylin.statusmanager.interfacer"),
QString("/"),
QString("qt5-ukui-platformtheme"),
QDBusConnection::sessionBus);
if(!interface.isValid()) {
m_isShowInCenter = true;
return;
}
QDBusReply<bool> reply = interface->call("get_current_tabletmode");
if (!reply.isValid()) {
m_isShowInCenter = true;
return;
}
m_isShowInCenter = reply.value();
}
/** /**
* @brief vpnMainWindow::onTrayIconActivated * @brief vpnMainWindow::onTrayIconActivated
*/ */

View File

@ -111,6 +111,7 @@ private:
// void showControlCenter(); // void showControlCenter();
void showByWaylandHelper(); void showByWaylandHelper();
void setCentralWidgetType(IconActiveType iconStatus); void setCentralWidgetType(IconActiveType iconStatus);
void getTabletMode();
double m_transparency=1.0; //透明度 double m_transparency=1.0; //透明度
QGSettings * m_transGsettings; //透明度配置文件 QGSettings * m_transGsettings; //透明度配置文件
int m_currentIconIndex = 0; int m_currentIconIndex = 0;