Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions reader/uiframe/Central.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ Central::Central(QWidget *parent)
keyList.append(QKeySequence::Print);
keyList.append(QKeySequence::Save);
keyList.append(QKeySequence::Copy);
// 屏蔽右侧区域的切页快捷键,使用默认的滚动效果
// when using slide mode, left & right keys are needed. modify by lz,at 2022.4.18
keyList.append(QKeySequence(Qt::Key_Left));
keyList.append(QKeySequence(Qt::Key_Right));

keyList.append(QKeySequence(Qt::Key_Up));
keyList.append(QKeySequence(Qt::Key_Down));
keyList.append(QKeySequence(Qt::Key_Space));
//使用下面5个快捷键会屏蔽主界面对应的功能,故注释
//keyList.append(QKeySequence(Qt::Key_Left));
//keyList.append(QKeySequence(Qt::Key_Right));

//keyList.append(QKeySequence(Qt::Key_Up));
//keyList.append(QKeySequence(Qt::Key_Down));
//keyList.append(QKeySequence(Qt::Key_Space));
keyList.append(QKeySequence(Qt::Key_Escape));
keyList.append(QKeySequence(Qt::Key_F5));
keyList.append(QKeySequence(Qt::Key_F11));
Expand Down
1 change: 0 additions & 1 deletion reader/uiframe/CentralDocPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ void CentralDocPage::handleShortcut(const QString &s)
}

if (m_slideWidget) {
m_slideWidget->handleKeyPressEvent(s);
return;
}

Expand Down
10 changes: 10 additions & 0 deletions reader/widgets/SlideWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
#include "MainWindow.h"
#include "DocSheet.h"
#include "SlidePlayWidget.h"
#include "Application.h"

Check warning on line 10 in reader/widgets/SlideWidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "Application.h" not found.
#include "ReaderImageThreadPoolManager.h"

Check warning on line 11 in reader/widgets/SlideWidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ReaderImageThreadPoolManager.h" not found.
#include "Utils.h"

Check warning on line 12 in reader/widgets/SlideWidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "Utils.h" not found.
#include "ddlog.h"

Check warning on line 13 in reader/widgets/SlideWidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ddlog.h" not found.

#include <DGuiApplicationHelper>

Check warning on line 15 in reader/widgets/SlideWidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DGuiApplicationHelper> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DApplication>
#include <DTitlebar>

Expand All @@ -34,6 +35,7 @@
initControl();
initImageControl();
show();
QTimer::singleShot(0, this, [this](){this->setFocus();});
qCDebug(appLog) << "SlideWidget initialized";
}

Expand Down Expand Up @@ -423,6 +425,14 @@
// qCDebug(appLog) << "Handling key press event end";
}

void SlideWidget::keyPressEvent(QKeyEvent *event)
{
QString key = Utils::getKeyshortcut(event);
handleKeyPressEvent(key);

DWidget::keyPressEvent(event);
}

void SlideWidget::onFetchImage(int index)
{
qCDebug(appLog) << "Fetching image for page:" << index;
Expand Down
16 changes: 9 additions & 7 deletions reader/widgets/SlideWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ public slots:
*/
void setWidgetState(bool full);

/**
* @brief handleKeyPressEvent
* 按键处理事件
* @param sKey
*/
void handleKeyPressEvent(const QString &sKey);

/**
* @brief onImageAniFinished
* 单页幻灯片播放结束
Expand All @@ -56,6 +49,13 @@ public slots:
*/
void initControl();

/**
* @brief handleKeyPressEvent
* 按键处理事件
* @param sKey
*/
void handleKeyPressEvent(const QString &sKey);

/**
* @brief initImageControl
* 初始化图片数据
Expand Down Expand Up @@ -160,6 +160,8 @@ private slots:

void wheelEvent(QWheelEvent *event) override;

void keyPressEvent(QKeyEvent *event) override;

private:
int m_curPageIndex = 0;
bool m_canRestart = false;
Expand Down
Loading