Improve shortcuts
Shortcuts implementation now use QShortcut instead of using the raw key event. Besides, hold spacebar to temporarily enter drag mode also implemented in this commit, this is very useful in zoom mode.master
parent
71ccb2b71f
commit
ee20aff397
|
@ -266,6 +266,9 @@ HEADERS += src/tabwidget.h
|
|||
SOURCES += src/flowlayout.cpp
|
||||
HEADERS += src/flowlayout.h
|
||||
|
||||
SOURCES += src/shortcuts.cpp
|
||||
HEADERS += src/shortcuts.h
|
||||
|
||||
SOURCES += src/main.cpp
|
||||
|
||||
HEADERS += src/version.h
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
#include <QShortcut>
|
||||
#include <QObject>
|
||||
#include "shortcuts.h"
|
||||
|
||||
#define defineKey(keyVal, funcName) do { \
|
||||
auto key = new QShortcut(mainWindow); \
|
||||
key->setKey(keyVal); \
|
||||
QObject::connect(key, &QShortcut::activated, \
|
||||
graphicsWidget, funcName); \
|
||||
} while (false)
|
||||
|
||||
void initShortCuts(QMainWindow *mainWindow, SkeletonGraphicsWidget *graphicsWidget)
|
||||
{
|
||||
defineKey(Qt::Key_Delete, &SkeletonGraphicsWidget::shortcutDelete);
|
||||
defineKey(Qt::Key_Backspace, &SkeletonGraphicsWidget::shortcutDelete);
|
||||
defineKey(Qt::Key_A, &SkeletonGraphicsWidget::shortcutAddMode);
|
||||
defineKey(Qt::CTRL + Qt::Key_Z, &SkeletonGraphicsWidget::shortcutUndo);
|
||||
defineKey(Qt::CTRL + Qt::SHIFT + Qt::Key_Z, &SkeletonGraphicsWidget::shortcutRedo);
|
||||
defineKey(Qt::CTRL + Qt::Key_Y, &SkeletonGraphicsWidget::shortcutRedo);
|
||||
defineKey(Qt::Key_Z, &SkeletonGraphicsWidget::shortcutZlock);
|
||||
defineKey(Qt::Key_Y, &SkeletonGraphicsWidget::shortcutYlock);
|
||||
defineKey(Qt::CTRL + Qt::Key_X, &SkeletonGraphicsWidget::shortcutCut);
|
||||
defineKey(Qt::Key_X, &SkeletonGraphicsWidget::shortcutXlock);
|
||||
defineKey(Qt::CTRL + Qt::Key_C, &SkeletonGraphicsWidget::shortcutCopy);
|
||||
defineKey(Qt::CTRL + Qt::Key_V, &SkeletonGraphicsWidget::shortcutPaste);
|
||||
defineKey(Qt::CTRL + Qt::Key_S, &SkeletonGraphicsWidget::shortcutSave);
|
||||
defineKey(Qt::Key_S, &SkeletonGraphicsWidget::shortcutSelectMode);
|
||||
defineKey(Qt::Key_D, &SkeletonGraphicsWidget::shortcutDragMode);
|
||||
defineKey(Qt::ALT + Qt::Key_Minus, &SkeletonGraphicsWidget::shortcutZoomRenderedModelByMinus10);
|
||||
defineKey(Qt::Key_Minus, &SkeletonGraphicsWidget::shortcutZoomSelectedByMinus1);
|
||||
defineKey(Qt::ALT + Qt::Key_Equal, &SkeletonGraphicsWidget::shortcutZoomRenderedModelBy10);
|
||||
defineKey(Qt::Key_Equal, &SkeletonGraphicsWidget::shortcutZoomSelectedBy1);
|
||||
defineKey(Qt::Key_Comma, &SkeletonGraphicsWidget::shortcutRotateSelectedByMinus1);
|
||||
defineKey(Qt::Key_Period, &SkeletonGraphicsWidget::shortcutRotateSelectedBy1);
|
||||
defineKey(Qt::Key_Left, &SkeletonGraphicsWidget::shortcutMoveSelectedToLeft);
|
||||
defineKey(Qt::Key_Right, &SkeletonGraphicsWidget::shortcutMoveSelectedToRight);
|
||||
defineKey(Qt::Key_Up, &SkeletonGraphicsWidget::shortcutMoveSelectedToUp);
|
||||
defineKey(Qt::Key_Down, &SkeletonGraphicsWidget::shortcutMoveSelectedToDown);
|
||||
defineKey(Qt::Key_BracketLeft, &SkeletonGraphicsWidget::shortcutScaleSelectedByMinus1);
|
||||
defineKey(Qt::Key_BracketRight, &SkeletonGraphicsWidget::shortcutScaleSelectedBy1);
|
||||
defineKey(Qt::Key_E, &SkeletonGraphicsWidget::shortcutSwitchProfileOnSelected);
|
||||
defineKey(Qt::Key_H, &SkeletonGraphicsWidget::shortcutShowOrHideSelectedPart);
|
||||
defineKey(Qt::Key_J, &SkeletonGraphicsWidget::shortcutEnableOrDisableSelectedPart);
|
||||
defineKey(Qt::Key_L, &SkeletonGraphicsWidget::shortcutLockOrUnlockSelectedPart);
|
||||
defineKey(Qt::Key_M, &SkeletonGraphicsWidget::shortcutXmirrorOnOrOffSelectedPart);
|
||||
defineKey(Qt::Key_B, &SkeletonGraphicsWidget::shortcutSubdivedOrNotSelectedPart);
|
||||
defineKey(Qt::Key_U, &SkeletonGraphicsWidget::shortcutRoundEndOrNotSelectedPart);
|
||||
defineKey(Qt::Key_W, &SkeletonGraphicsWidget::shortcutWrapOrNotSelectedPart);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef SHORTCUTS_H
|
||||
#define SHORTCUTS_H
|
||||
#include <QMainWindow>
|
||||
#include "skeletongraphicswidget.h"
|
||||
|
||||
void initShortCuts(QMainWindow *mainWindow, SkeletonGraphicsWidget *graphicsWidget);
|
||||
|
||||
#endif
|
|
@ -35,6 +35,7 @@
|
|||
#include "imageforever.h"
|
||||
#include "spinnableawesomebutton.h"
|
||||
#include "fbxfile.h"
|
||||
#include "shortcuts.h"
|
||||
|
||||
int SkeletonDocumentWindow::m_modelRenderWidgetInitialX = 16;
|
||||
int SkeletonDocumentWindow::m_modelRenderWidgetInitialY = 16;
|
||||
|
@ -888,6 +889,8 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
m_document->generateMaterialPreviews();
|
||||
});
|
||||
|
||||
initShortCuts(this, m_graphicsWidget);
|
||||
|
||||
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
|
|
|
@ -43,7 +43,9 @@ SkeletonGraphicsWidget::SkeletonGraphicsWidget(const SkeletonDocument *document)
|
|||
m_ikMover(nullptr),
|
||||
m_deferredRemoveTimer(nullptr),
|
||||
m_eventForwardingToModelWidget(false),
|
||||
m_modelWidget(nullptr)
|
||||
m_modelWidget(nullptr),
|
||||
m_inTempDragMode(false),
|
||||
m_modeBeforeEnterTempDragMode(SkeletonDocumentEditMode::Select)
|
||||
{
|
||||
setRenderHint(QPainter::Antialiasing, false);
|
||||
setBackgroundBrush(QBrush(QWidget::palette().color(QWidget::backgroundRole()), Qt::SolidPattern));
|
||||
|
@ -627,6 +629,13 @@ void SkeletonGraphicsWidget::keyPressEvent(QKeyEvent *event)
|
|||
QGraphicsView::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
if (keyRelease(event))
|
||||
return;
|
||||
QGraphicsView::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
bool SkeletonGraphicsWidget::mouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (m_dragStarted) {
|
||||
|
@ -1374,9 +1383,8 @@ void SkeletonGraphicsWidget::deleteSelected()
|
|||
}
|
||||
}
|
||||
|
||||
bool SkeletonGraphicsWidget::keyPress(QKeyEvent *event)
|
||||
void SkeletonGraphicsWidget::shortcutDelete()
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete || event->key() ==Qt::Key_Backspace) {
|
||||
bool processed = false;
|
||||
if (!m_rangeSelectionSet.empty()) {
|
||||
deleteSelected();
|
||||
|
@ -1384,219 +1392,288 @@ bool SkeletonGraphicsWidget::keyPress(QKeyEvent *event)
|
|||
}
|
||||
if (processed) {
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_A) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutAddMode()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Add == m_document->editMode) {
|
||||
emit setEditMode(SkeletonDocumentEditMode::Select);
|
||||
} else {
|
||||
emit setEditMode(SkeletonDocumentEditMode::Add);
|
||||
}
|
||||
return true;
|
||||
} else if (event->key() == Qt::Key_Z) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) {
|
||||
emit redo();
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutUndo()
|
||||
{
|
||||
emit undo();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
emit setZlockState(!m_document->zlocked);
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Y) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
if (!QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutRedo()
|
||||
{
|
||||
emit redo();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
emit setYlockState(!m_document->ylocked);
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_X) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
cut();
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutXlock()
|
||||
{
|
||||
emit setXlockState(!m_document->xlocked);
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_C) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutYlock()
|
||||
{
|
||||
emit setYlockState(!m_document->ylocked);
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutZlock()
|
||||
{
|
||||
emit setZlockState(!m_document->zlocked);
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutCut()
|
||||
{
|
||||
cut();
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutCopy()
|
||||
{
|
||||
copy();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_V) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutPaste()
|
||||
{
|
||||
emit paste();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_S) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutSave()
|
||||
{
|
||||
emit save();
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutSelectMode()
|
||||
{
|
||||
emit setEditMode(SkeletonDocumentEditMode::Select);
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_D) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutDragMode()
|
||||
{
|
||||
emit setEditMode(SkeletonDocumentEditMode::Drag);
|
||||
return true;
|
||||
} else if (event->key() == Qt::Key_Minus) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::AltModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutZoomRenderedModelByMinus10()
|
||||
{
|
||||
emit zoomRenderedModelBy(-10);
|
||||
return true;
|
||||
} else if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutZoomSelectedByMinus1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
zoomSelected(-1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Equal) {
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::AltModifier)) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutZoomRenderedModelBy10()
|
||||
{
|
||||
emit zoomRenderedModelBy(10);
|
||||
return true;
|
||||
} else if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutZoomSelectedBy1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
zoomSelected(1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Comma) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutRotateSelectedByMinus1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
rotateSelected(-1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Period) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutRotateSelectedBy1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
rotateSelected(1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Left) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutMoveSelectedToLeft()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
||||
if (m_checkedOriginItem) {
|
||||
moveCheckedOrigin(-1, 0);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
} else if (hasSelection()) {
|
||||
moveSelected(-1, 0);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Right) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutMoveSelectedToRight()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
||||
if (m_checkedOriginItem) {
|
||||
moveCheckedOrigin(1, 0);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
} else if (hasSelection()) {
|
||||
moveSelected(1, 0);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Up) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutMoveSelectedToUp()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
||||
if (m_checkedOriginItem) {
|
||||
moveCheckedOrigin(0, -1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
} else if (hasSelection()) {
|
||||
moveSelected(0, -1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Down) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutMoveSelectedToDown()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
||||
if (m_checkedOriginItem) {
|
||||
moveCheckedOrigin(0, 1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
} else if (hasSelection()) {
|
||||
moveSelected(0, 1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_BracketLeft) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutScaleSelectedByMinus1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
scaleSelected(-1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_BracketRight) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutScaleSelectedBy1()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
scaleSelected(1);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_E) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutSwitchProfileOnSelected()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) {
|
||||
switchProfileOnRangeSelection();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_H) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutShowOrHideSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partVisible = part && part->visible;
|
||||
emit setPartVisibleState(m_lastCheckedPart, !partVisible);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_J) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutEnableOrDisableSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partDisabled = part && part->disabled;
|
||||
emit setPartDisableState(m_lastCheckedPart, !partDisabled);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_L) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutLockOrUnlockSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partLocked = part && part->locked;
|
||||
emit setPartLockState(m_lastCheckedPart, !partLocked);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_M) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutXmirrorOnOrOffSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partXmirrored = part && part->xMirrored;
|
||||
emit setPartXmirrorState(m_lastCheckedPart, !partXmirrored);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_B) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutSubdivedOrNotSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partSubdived = part && part->subdived;
|
||||
emit setPartSubdivState(m_lastCheckedPart, !partSubdived);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_U) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutRoundEndOrNotSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partRounded = part && part->rounded;
|
||||
emit setPartRoundState(m_lastCheckedPart, !partRounded);
|
||||
emit groupOperationAdded();
|
||||
return true;
|
||||
}
|
||||
} else if (event->key() == Qt::Key_W) {
|
||||
}
|
||||
|
||||
void SkeletonGraphicsWidget::shortcutWrapOrNotSelectedPart()
|
||||
{
|
||||
if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) {
|
||||
const SkeletonPart *part = m_document->findPart(m_lastCheckedPart);
|
||||
bool partWrapped = part && part->wrapped;
|
||||
emit setPartWrapState(m_lastCheckedPart, !partWrapped);
|
||||
emit groupOperationAdded();
|
||||
}
|
||||
}
|
||||
|
||||
bool SkeletonGraphicsWidget::keyPress(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Space) {
|
||||
if (SkeletonDocumentEditMode::ZoomIn == m_document->editMode ||
|
||||
SkeletonDocumentEditMode::ZoomOut == m_document->editMode ||
|
||||
SkeletonDocumentEditMode::Select == m_document->editMode ||
|
||||
SkeletonDocumentEditMode::Add == m_document->editMode) {
|
||||
m_inTempDragMode = true;
|
||||
m_modeBeforeEnterTempDragMode = m_document->editMode;
|
||||
emit setEditMode(SkeletonDocumentEditMode::Drag);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SkeletonGraphicsWidget::keyRelease(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Space) {
|
||||
if (m_inTempDragMode) {
|
||||
m_inTempDragMode = false;
|
||||
emit setEditMode(m_modeBeforeEnterTempDragMode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -389,6 +389,7 @@ public:
|
|||
bool mousePress(QMouseEvent *event);
|
||||
bool mouseDoubleClick(QMouseEvent *event);
|
||||
bool keyPress(QKeyEvent *event);
|
||||
bool keyRelease(QKeyEvent *event);
|
||||
bool checkSkeletonItem(QGraphicsItem *item, bool checked);
|
||||
QUuid querySkeletonItemPartId(QGraphicsItem *item);
|
||||
static SkeletonProfile readSkeletonItemProfile(QGraphicsItem *item);
|
||||
|
@ -403,12 +404,13 @@ public:
|
|||
bool hasTwoDisconnectedNodesSelection();
|
||||
void setModelWidget(ModelWidget *modelWidget);
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
public slots:
|
||||
void nodeAdded(QUuid nodeId);
|
||||
void edgeAdded(QUuid edgeId);
|
||||
|
@ -462,6 +464,39 @@ public slots:
|
|||
void setSelectedNodesBoneMark(SkeletonBoneMark boneMark);
|
||||
void timeToRemoveDeferredNodesAndEdges();
|
||||
void switchSelectedXZ();
|
||||
void shortcutDelete();
|
||||
void shortcutAddMode();
|
||||
void shortcutUndo();
|
||||
void shortcutRedo();
|
||||
void shortcutXlock();
|
||||
void shortcutYlock();
|
||||
void shortcutZlock();
|
||||
void shortcutCut();
|
||||
void shortcutCopy();
|
||||
void shortcutPaste();
|
||||
void shortcutSave();
|
||||
void shortcutSelectMode();
|
||||
void shortcutDragMode();
|
||||
void shortcutZoomRenderedModelByMinus10();
|
||||
void shortcutZoomSelectedByMinus1();
|
||||
void shortcutZoomRenderedModelBy10();
|
||||
void shortcutZoomSelectedBy1();
|
||||
void shortcutRotateSelectedByMinus1();
|
||||
void shortcutRotateSelectedBy1();
|
||||
void shortcutMoveSelectedToLeft();
|
||||
void shortcutMoveSelectedToRight();
|
||||
void shortcutMoveSelectedToUp();
|
||||
void shortcutMoveSelectedToDown();
|
||||
void shortcutScaleSelectedByMinus1();
|
||||
void shortcutScaleSelectedBy1();
|
||||
void shortcutSwitchProfileOnSelected();
|
||||
void shortcutShowOrHideSelectedPart();
|
||||
void shortcutEnableOrDisableSelectedPart();
|
||||
void shortcutLockOrUnlockSelectedPart();
|
||||
void shortcutXmirrorOnOrOffSelectedPart();
|
||||
void shortcutSubdivedOrNotSelectedPart();
|
||||
void shortcutRoundEndOrNotSelectedPart();
|
||||
void shortcutWrapOrNotSelectedPart();
|
||||
private slots:
|
||||
void turnaroundImageReady();
|
||||
private:
|
||||
|
@ -515,6 +550,8 @@ private: //need initalize
|
|||
QTimer *m_deferredRemoveTimer;
|
||||
bool m_eventForwardingToModelWidget;
|
||||
ModelWidget *m_modelWidget;
|
||||
bool m_inTempDragMode;
|
||||
SkeletonDocumentEditMode m_modeBeforeEnterTempDragMode;
|
||||
private:
|
||||
QVector3D m_ikMoveTarget;
|
||||
QUuid m_ikMoveEndEffectorId;
|
||||
|
|
Loading…
Reference in New Issue