Add Ctrl+A to select all; Arrow keys for movement
This commit is contained in:
parent
88d6b4b1e1
commit
a345b1a763
2 changed files with 45 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -1159,6 +1160,49 @@ void PerspectiveTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) {
|
|||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
bool PerspectiveTool::keyDown(QKeyEvent *event) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->key() == Qt::Key_A) {
|
||||
for (int i = 0; i < m_perspectiveObjs.size(); i++) {
|
||||
m_selection.select(i);
|
||||
m_perspectiveObjs[i]->setActive(true);
|
||||
}
|
||||
m_selection.makeCurrent();
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
TPointD delta;
|
||||
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Up:
|
||||
delta.y = 1;
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
delta.y = -1;
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
delta.x = -1;
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
delta.x = 1;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
std::set<int> selectedObjects = m_selection.getSelectedObjects();
|
||||
std::set<int>::iterator it;
|
||||
for (it = selectedObjects.begin(); it != selectedObjects.end(); it++)
|
||||
m_perspectiveObjs[*it]->shiftPerspectiveObject(delta);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
void PerspectiveTool::invalidateControl(int controlIdx) {
|
||||
if (!m_perspectiveObjs.size() || controlIdx >= m_perspectiveObjs.size())
|
||||
return;
|
||||
|
|
|
@ -409,6 +409,7 @@ public:
|
|||
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
||||
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
||||
void leftButtonUp(const TPointD &pos, const TMouseEvent &) override;
|
||||
bool keyDown(QKeyEvent *event) override;
|
||||
|
||||
bool onPropertyChanged(std::string propertyName) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue