!130 fix bug IA9G2K

Merge pull request !130 from 李美奇/openkylin/nile
This commit is contained in:
苏芳 2024-08-05 01:58:54 +00:00 committed by Gitee
commit 37fa99b91d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 49 additions and 58 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-photo-viewer (1.3.0.3-ok22.22) nile; urgency=medium
* BUG号#IA9G2K 【次要】 【wlcom】【看图】窗口最大化后全屏esc退出全屏后窗口无法恢复默认大小
* 需求号:无
* 其他改动说明:无
* 影响域:无
-- limeiqi <limeiqi@kylinos.cn> Fri, 02 Aug 2024 11:04:13 +0800
kylin-photo-viewer (1.3.0.3-ok22.21) nile; urgency=medium
* BUG号#IA6PIE【次要】【看图】标注-绘制后点击一次撤销,会撤销多次绘制的内容

93
src/view/kyview.cpp Normal file → Executable file
View File

@ -132,9 +132,10 @@ KyView::KyView(const QStringList &args)
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
connect(kdk::WindowManager::self(), &kdk::WindowManager::windowAdded, this, [=](const kdk::WindowId& window_id){
if (getpid() == kdk::WindowManager::getPid(window_id) && m_windowId == 0)
if (getpid() == kdk::WindowManager::getPid(window_id) && m_isFirst)
{
m_windowId = window_id.toULongLong();
m_windowId = window_id;
m_isFirst = false;
kdk::WindowManager::activateWindow(m_windowId);
}
});
@ -173,7 +174,7 @@ void KyView::connectToPanelSizeChange()
// 处理任务栏尺寸改变
void KyView::handlePanelSizeChanged(int size)
{
if (this->isMaximized()||this->isFullScreen() || m_nowFullScreen) {
if (this->isMaximized()||this->isFullScreen() || m_nowFullScreen || m_isMaxAndFull) {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
int sw = QGuiApplication::primaryScreen()->availableGeometry().width();
int sh = QGuiApplication::primaryScreen()->availableGeometry().height()- size;
@ -1183,17 +1184,17 @@ void KyView::fullScreen()
KWindowSystem::clearState(winId(), NET::FullScreen);
}
m_nowFullScreen = false;
// m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic"));//主题库的全屏图标
// m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
} else {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
if(this->isMaximized() ){
m_isMaxAndFull = true;
}
this->showFullScreen();
} else {
KWindowSystem::setState(winId(), NET::FullScreen);
}
m_nowFullScreen = true;
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
}
m_titlebar->dealEditState();
}
@ -1256,23 +1257,30 @@ void KyView::markToolChange()
//最大化和还原
void KyView::changOrigSize()
{
if (this->isMaximized()) {
this->showNormal();
} else if (this->isFullScreen() || m_nowFullScreen) {
if (this->isFullScreen() || m_nowFullScreen) { //全屏恢复
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
this->showNormal();
} else {
KWindowSystem::clearState(winId(), NET::FullScreen);
}
m_nowFullScreen = false;
} else {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
// int sw = QGuiApplication::primaryScreen()->availableGeometry().width();
// int sh = QGuiApplication::primaryScreen()->availableGeometry().height();
// this->resize(sw, sh);
kdk::WindowManager::maximizeWindow(m_windowId);
} else if (this->isMaximized() || m_isMaxAndFull) { //最大化恢复
if(m_isMaxAndFull && QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)){
m_isMaxAndFull = false;
kdk::WindowManager::setGeometry(this->windowHandle(),m_origRect);
}else{
this->showNormal();
}
} else { //最大化
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
m_origRect = kdk::WindowManager::windowGeometry(m_windowId);
kdk::WindowManager::maximizeWindow(m_windowId);
}else{
this->showMaximized();
}
this->showMaximized();
}
m_titlebar->dealEditState();
}
@ -1447,7 +1455,7 @@ void KyView::resizeEvent(QResizeEvent *event)
if (m_isScanning) {
scannerChange();
}
if (this->isMaximized() || this->isFullScreen() || m_nowFullScreen) {
if (this->isMaximized() || this->isFullScreen() || m_nowFullScreen || m_isMaxAndFull) {
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的全屏图标
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
} else {
@ -1559,16 +1567,8 @@ void KyView::keyPressEvent(QKeyEvent *event)
this->fullScreen();
}
if (event->key() == Qt::Key_Escape) {
if (this->isFullScreen()) {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
this->showNormal();
} else {
KWindowSystem::clearState(winId(), NET::FullScreen);
}
if (m_titlebar != nullptr) {
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
}
if (this->isFullScreen() || m_nowFullScreen) {
this->fullScreen();
}
}
}
@ -1754,36 +1754,15 @@ void KyView::dealMouseDouble()
if (!m_navigator->isHidden() && (m_navigator->geometry().contains(this->mapFromGlobal(QCursor::pos())))) {
return;
}
if (this->isFullScreen()) {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
this->showNormal();
} else {
KWindowSystem::clearState(winId(), NET::FullScreen);
}
} else {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
this->showFullScreen();
} else {
KWindowSystem::setState(winId(), NET::FullScreen);
}
}
//图片区域双击全屏
this->fullScreen();
} else if (m_titlebar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
if (this->isMaximized()) {
this->showNormal();
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
} else if (this->isFullScreen()) {
//标题栏处双击最大化/还原
if(this->isFullScreen() || m_nowFullScreen){
return;
} else {
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
// int sw = QGuiApplication::primaryScreen()->availableGeometry().width();
// int sh = QGuiApplication::primaryScreen()->availableGeometry().height();
// this->resize(sw, sh);
kdk::WindowManager::maximizeWindow(m_windowId);
}
this->showMaximized();
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
}else{
this->changOrigSize();
}
}
}
@ -2192,7 +2171,7 @@ void KyView::changeEvent(QEvent *event)
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
} else {
if (this->isMaximized()) {
if (this->isMaximized() || m_isMaxAndFull) {
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
} else {

5
src/view/kyview.h Normal file → Executable file
View File

@ -63,7 +63,8 @@ protected:
void changeEvent(QEvent *event);
void closeEvent(QCloseEvent *event) override;
private:
quint32 m_windowId;
kdk::WindowId m_windowId;
bool m_isFirst = true;
int toolbarHeightValue;
int titlebarHeightValue;
double m_backWidHeight = 0;
@ -204,6 +205,8 @@ private:
bool m_isScanning = false; //黑白扫描
void scannerChange();
bool m_isMaxAndFull = false; //最大化且全屏
QRect m_origRect; //最大化前的位置及大小
private Q_SLOTS: