From c7ba9ef1a92fc74274b0af38437498b86fb06154 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Sat, 19 Oct 2019 08:21:23 +0930 Subject: [PATCH] Add shortcut key F Bring the part widget of current hovered part to visible area --- docs/shortcuts.rst | 2 ++ src/shortcuts.cpp | 1 + src/skeletongraphicswidget.cpp | 17 +++++++++++++++++ src/skeletongraphicswidget.h | 1 + 4 files changed, 21 insertions(+) diff --git a/docs/shortcuts.rst b/docs/shortcuts.rst index adef4d2d..660ce2c6 100644 --- a/docs/shortcuts.rst +++ b/docs/shortcuts.rst @@ -68,6 +68,8 @@ Keyboard +----------------------+--------------------------------------------------------------------------+ | E | Swith the Selected Nodes to Different Profile (Main / Side) | +----------------------+--------------------------------------------------------------------------+ +| F | Bring the part widget of current hovered part to visible area | ++----------------------+--------------------------------------------------------------------------+ Mouse ====== diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index caa51fb9..8c62c41f 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -46,4 +46,5 @@ void initShortCuts(QWidget *widget, SkeletonGraphicsWidget *graphicsWidget) defineKey(Qt::Key_B, &SkeletonGraphicsWidget::shortcutSubdivedOrNotSelectedPart); defineKey(Qt::Key_U, &SkeletonGraphicsWidget::shortcutRoundEndOrNotSelectedPart); defineKey(Qt::Key_W, &SkeletonGraphicsWidget::shortcutToggleWireframe); + defineKey(Qt::Key_F, &SkeletonGraphicsWidget::shortcutCheckPartComponent); } diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index c29af04d..77430029 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -2386,6 +2386,23 @@ void SkeletonGraphicsWidget::selectPartAll() } } +void SkeletonGraphicsWidget::shortcutCheckPartComponent() +{ + QUuid choosenPartId; + if (m_hoveredNodeItem) { + const SkeletonNode *node = m_document->findNode(m_hoveredNodeItem->id()); + if (node) + choosenPartId = node->partId; + } else if (m_hoveredEdgeItem) { + const SkeletonEdge *edge = m_document->findEdge(m_hoveredEdgeItem->id()); + if (edge) + choosenPartId = edge->partId; + } + if (!choosenPartId.isNull()) { + emit partComponentChecked(choosenPartId); + } +} + void SkeletonGraphicsWidget::selectAll() { unselectAll(); diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index ed99a7a3..9fb2535e 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -543,6 +543,7 @@ public slots: void shortcutXmirrorOnOrOffSelectedPart(); void shortcutSubdivedOrNotSelectedPart(); void shortcutRoundEndOrNotSelectedPart(); + void shortcutCheckPartComponent(); private slots: void turnaroundImageReady(); private: