forked from openkylin/kylin-photo-viewer
!12 Fix issues #I5SXTA #I5TBH5
Merge pull request !12 from zhangyuan/openkylin/yangtze
This commit is contained in:
commit
ca85007a97
|
@ -1,3 +1,12 @@
|
|||
kylin-photo-viewer (1.3.0.3-ok15) yangtze; urgency=medium
|
||||
|
||||
* BUG号: #I5SXTA #I5TBH5
|
||||
* 需求号:无
|
||||
* 其他改动说明:
|
||||
* 影响域:wayland环境下的标题栏拖动窗口
|
||||
|
||||
-- zhangyuan <zhangyuan@kylinos.cn> Tue, 13 Jun 2023 16:12:18 +0800
|
||||
|
||||
kylin-photo-viewer (1.3.0.3-ok14) yangtze; urgency=medium
|
||||
|
||||
* rebuild
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -21,14 +21,17 @@
|
|||
#include <QLoggingCategory>
|
||||
#include "view/openimage.h"
|
||||
#include <window_management.hpp>
|
||||
#include "kabaselog.hpp"
|
||||
#include "windowmanage.hpp"
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
#include "windowmanager/windowmanager.h"
|
||||
#include <log.hpp>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//适配4K屏以及分数缩放
|
||||
kdk::kabase::WindowManagement::setScalingProperties();
|
||||
//日志输出
|
||||
qInstallMessageHandler(::kabase::KabaseLog::logOutput);
|
||||
// qInstallMessageHandler(::kabase::KabaseLog::logOutput);
|
||||
qInstallMessageHandler(kdk::kabase::Log::logOutput);
|
||||
QApplication a(argc, argv);
|
||||
qApp->setWindowIcon(QIcon::fromTheme("kylin-photo-viewer", QIcon(":/res/res/kyview_logo.png")));
|
||||
// QLoggingCategory::setFilterRules(QStringLiteral("qt.qml.binding.removal.info=true"));
|
||||
|
@ -67,7 +70,7 @@ int main(int argc, char *argv[])
|
|||
a.setApplicationName(QApplication::tr("Pictures"));
|
||||
//主题框架
|
||||
KyView w(a.arguments());
|
||||
::kabase::WindowManage::removeHeader(&w);
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(&w);
|
||||
Interaction::getInstance()->initUiFinish();
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ INCLUDEPATH += /usr/include/kysdk/applications/kabase/kylin_system/
|
|||
INCLUDEPATH += /usr/include/kabase/kylin_system/
|
||||
INCLUDEPATH += /usr/include/kysdk/applications/kabase/
|
||||
|
||||
INCLUDEPATH += ../kabase/
|
||||
INCLUDEPATH += ../kabase/Qt
|
||||
#INCLUDEPATH += ../kabase/
|
||||
#INCLUDEPATH += ../kabase/Qt
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "sizedate.h"
|
||||
#include "X11/Xlib.h"
|
||||
#include <QX11Info>
|
||||
#include "windowmanage.hpp"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
#include "global/interactiveqml.h"
|
||||
KyView *KyView::mutual = nullptr;
|
||||
KyView::KyView(const QStringList &args)
|
||||
|
@ -96,7 +96,9 @@ KyView::KyView(const QStringList &args)
|
|||
|
||||
//应用居中
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
||||
::kabase::WindowManage::setMiddleOfScreen(this);
|
||||
int sw = QGuiApplication::primaryScreen()->availableGeometry().width();
|
||||
int sh = QGuiApplication::primaryScreen()->availableGeometry().height();
|
||||
leftPoint = QPoint((sw - this->width()) / 2, (sh - this->height()) / 2);
|
||||
} else {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
this->move((screen->geometry().width() - this->width()) / 2,
|
||||
|
@ -1000,6 +1002,11 @@ void KyView::changOrigSize()
|
|||
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);
|
||||
}
|
||||
this->showMaximized();
|
||||
}
|
||||
m_titlebar->dealEditState();
|
||||
|
@ -1118,7 +1125,11 @@ void KyView::mouseMoveEvent(QMouseEvent *event)
|
|||
XSendEvent(display, QX11Info::appRootWindow(QX11Info::appScreen()), False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask, &xEvent);
|
||||
XFlush(display);
|
||||
}
|
||||
} else {
|
||||
leftPoint = leftPoint + (event->globalPos() - m_dragPos);
|
||||
kdk::WindowManager::setGeometry(this->windowHandle(),QRect(leftPoint, QSize(this->width(), this->height())));
|
||||
}
|
||||
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
@ -1127,6 +1138,7 @@ void KyView::mousePressEvent(QMouseEvent *event)
|
|||
//只能是鼠标左键移动和改变大小
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_mousePress = true;
|
||||
this->m_dragPos = event->globalPos();
|
||||
}
|
||||
m_pressPosRecord = event->pos();
|
||||
}
|
||||
|
@ -1397,6 +1409,11 @@ void KyView::dealMouseDouble()
|
|||
} else if (this->isFullScreen()) {
|
||||
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);
|
||||
}
|
||||
this->showMaximized();
|
||||
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
|
||||
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
|
||||
|
@ -1751,10 +1768,19 @@ void KyView::changeEvent(QEvent *event)
|
|||
if (!m_isPcModeStarted) {
|
||||
m_isPcModeStarted = true;
|
||||
resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
||||
int sw = QGuiApplication::primaryScreen()->availableGeometry().width();
|
||||
int sh = QGuiApplication::primaryScreen()->availableGeometry().height();
|
||||
leftPoint = QPoint((sw - this->width()) / 2, (sh - this->height()) / 2);
|
||||
qDebug() << "= "<< __FUNCTION__<<" "<<__LINE__ << this->geometry() << " leftPoint = " << leftPoint;
|
||||
} else {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
this->move((screen->geometry().width() - this->width()) / 2,
|
||||
(screen->geometry().height() - this->height()) / 2);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
|
||||
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
explicit KyView(const QStringList &args);
|
||||
~KyView();
|
||||
static KyView *mutual; //指针类型静态成员变量
|
||||
QPoint leftPoint;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -114,6 +115,8 @@ private:
|
|||
bool m_isMaxScreen = false; //上一次动作非最大化
|
||||
bool m_isCutting = false; //裁剪模式
|
||||
bool m_isResponseDbClick = false; //判断是否需要响应双击最大化
|
||||
|
||||
QPoint m_dragPos; // 记录鼠标按下时的位置
|
||||
|
||||
//标注-0910
|
||||
QPoint m_recordMarkOldPos; //记录标注栏起始位置
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include "sizedate.h"
|
||||
#include "global/variable.h"
|
||||
#include "global/interactiveqml.h"
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->initInteraction();
|
||||
|
@ -955,7 +958,12 @@ void ShowImageWidget::initInteraction()
|
|||
void ShowImageWidget::startWithOpenImage(QString path)
|
||||
{
|
||||
if (path != Variable::API_TYPE) {
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(KyView::mutual);
|
||||
KyView::mutual->show();
|
||||
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
||||
kdk::WindowManager::setGeometry(KyView::mutual->windowHandle(),
|
||||
QRect(KyView::mutual->leftPoint, QSize(KyView::mutual->width(), KyView::mutual->height())));
|
||||
}
|
||||
Q_EMIT decideMainWidDisplay(true);
|
||||
}
|
||||
Q_EMIT startWayToSetTitleStyle();
|
||||
|
|
Loading…
Reference in New Issue