fixed:#I5XHG7 【wayland】【计算器】【平板模式】未全屏化
This commit is contained in:
parent
5ded44706b
commit
da5c2ac4a5
|
@ -1,3 +1,12 @@
|
|||
kylin-calculator (1.2.0.0-ok4) yangtze; urgency=medium
|
||||
|
||||
* BUG号:#I5XHG7 【Wayland】【计算器】【平板模式】未全屏化
|
||||
* 任务号:无
|
||||
* 其他更改说明:无
|
||||
* 其他改动影响域:无
|
||||
|
||||
-- lidecheng <lidecheng@kylinos.cn> Thu, 14 Sep 2023 16:55:23 +0800
|
||||
|
||||
kylin-calculator (1.2.0.0-ok3) yangtze; urgency=medium
|
||||
|
||||
* BUG号:#I5XHG7 【计算器】【平板模式】未全屏化
|
||||
|
|
13
main.cpp
13
main.cpp
|
@ -59,6 +59,11 @@ int main(int argc, char *argv[])
|
|||
/* 实例 */
|
||||
LogicCenter::getInstance();
|
||||
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(platform.startsWith(QLatin1String("Wayland"),Qt::CaseInsensitive) || QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") {
|
||||
MainWindow::getInstance()->setIsWayland(true);
|
||||
}
|
||||
|
||||
/* 添加窗管协议 */
|
||||
kabase::WindowManage::removeHeader(MainWindow::getInstance());
|
||||
|
||||
|
@ -66,6 +71,7 @@ int main(int argc, char *argv[])
|
|||
// QRect availableGeometry = qApp->primaryScreen()->availableGeometry();
|
||||
// MainWindow::getInstance()->move(availableGeometry.width() / 2 - MainWindow::getInstance()->width() / 2,
|
||||
// availableGeometry.height() / 2 - MainWindow::getInstance()->height() / 2);
|
||||
|
||||
a.setActivationWindow(MainWindow::getInstance());
|
||||
|
||||
/* wayland 下最小化拉起 */
|
||||
|
@ -76,7 +82,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
MainWindow::getInstance()->show();
|
||||
kabase::WindowManage::setMiddleOfScreen(MainWindow::getInstance());
|
||||
if (MainWindow::getInstance()->isWayland() && MainWindow::getInstance()->isTabletMode()) {
|
||||
MainWindow::getInstance()->setWindowState(MainWindow::getInstance()->windowState() | Qt::WindowFullScreen);
|
||||
}
|
||||
else {
|
||||
kabase::WindowManage::setMiddleOfScreen(MainWindow::getInstance());
|
||||
}
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -334,9 +334,19 @@ void MainWindow::setWindowSize() {
|
|||
if(this->isTabletMode()){ //平板模式下界面大小直接设置为最大值
|
||||
this->setMinimumSize(1, 1);
|
||||
this->setMaximumSize(99999, 99999);
|
||||
setWindowState(windowState() | Qt::WindowMaximized);
|
||||
if(isWayland()) {
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
}
|
||||
else {
|
||||
setWindowState(windowState() | Qt::WindowMaximized);
|
||||
}
|
||||
} else { //PC 模式下界面设置为对应模式固定值
|
||||
setWindowState(windowState() & ~Qt::WindowMaximized);
|
||||
if(isWayland()) {
|
||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||
}
|
||||
else {
|
||||
setWindowState(windowState() & ~Qt::WindowMaximized);
|
||||
}
|
||||
this->setFixedSize(currentWindowW, currentWindowH);
|
||||
// this->resize(currentWindowW, currentWindowH);
|
||||
}
|
||||
|
@ -1389,6 +1399,15 @@ void MainWindow::tabletModeChange(bool isTabletMode)
|
|||
this->setWindowSize();
|
||||
}
|
||||
|
||||
/* 是否是Wayland */
|
||||
bool MainWindow::isWayland() {
|
||||
return m_isWayland;
|
||||
}
|
||||
|
||||
/* 设置Wayland */
|
||||
void MainWindow::setIsWayland(bool isWayland) {
|
||||
m_isWayland = isWayland;
|
||||
}
|
||||
/* 鼠标移动事件 , 用于点击主界面时来隐藏模式切换列表 */
|
||||
void MainWindow::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
|
|
|
@ -134,9 +134,15 @@ public:
|
|||
/* 是否平板模式 */
|
||||
bool isTabletMode();
|
||||
|
||||
/* 设置当前界面的大小*/
|
||||
/* 设置当前界面的大小 */
|
||||
void setWindowSize();
|
||||
|
||||
/* 是否是Wayland模式 */
|
||||
bool isWayland();
|
||||
|
||||
/* 设置Wayland模式 */
|
||||
void setIsWayland(bool isWayland);
|
||||
|
||||
public slots:
|
||||
// 键盘响应事件
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
@ -197,6 +203,9 @@ private:
|
|||
// 是否平板模式
|
||||
bool m_isTabletMode = false;
|
||||
|
||||
// 是否Wayland
|
||||
bool m_isWayland = false;
|
||||
|
||||
//平板中的横竖屏切换部分
|
||||
deviceMode hLayoutFlag = PCMode; //默认横屏
|
||||
HorizontalOrVerticalMode *hOrVMode = nullptr; //平板横竖屏Dbus的信号监听及接口调用
|
||||
|
|
Loading…
Reference in New Issue