Sketcher: DSH: add two shortcuts for DSH to use. Fix a small syntax error in polygon/rotate.
This commit is contained in:
@@ -183,6 +183,14 @@ private:
|
||||
toolWidgetManager.secondKeyShortcut();
|
||||
}
|
||||
|
||||
if (key == SoKeyboardEvent::R && !pressed && !this->isLastState()) {
|
||||
toolWidgetManager.thirdKeyShortcut();
|
||||
}
|
||||
|
||||
if (key == SoKeyboardEvent::F && !pressed && !this->isLastState()) {
|
||||
toolWidgetManager.fourthKeyShortcut();
|
||||
}
|
||||
|
||||
if (key == SoKeyboardEvent::TAB && !pressed) {
|
||||
toolWidgetManager.tabShortcut();
|
||||
}
|
||||
|
||||
@@ -444,6 +444,12 @@ public:
|
||||
virtual void secondKeyShortcut()
|
||||
{}
|
||||
|
||||
virtual void thirdKeyShortcut()
|
||||
{}
|
||||
|
||||
virtual void fourthKeyShortcut()
|
||||
{}
|
||||
|
||||
virtual void tabShortcut()
|
||||
{
|
||||
passFocusToNextOnViewParameter();
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
Q_UNUSED(onSketchPos)
|
||||
}
|
||||
|
||||
/** on first shortcut, it toggles the first checkbox if there is go. Must be specialised if
|
||||
/** on first shortcut, it toggles the first checkbox if there is one. Must be specialised if
|
||||
* this is not intended */
|
||||
void firstKeyShortcut() override
|
||||
{
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/** on second shortcut, it toggles the second checkbox if there is go. Must be specialised if
|
||||
/** on second shortcut, it toggles the second checkbox if there is one. Must be specialised if
|
||||
* this is not intended */
|
||||
void secondKeyShortcut() override
|
||||
{
|
||||
@@ -240,6 +240,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/** on third shortcut, it toggles the third checkbox if there is one. Must be specialised if
|
||||
* this is not intended */
|
||||
void thirdKeyShortcut() override
|
||||
{
|
||||
if (nCheckbox >= 3) {
|
||||
auto thirdchecked = toolWidget->getCheckboxChecked(WCheckbox::ThirdBox);
|
||||
toolWidget->setCheckboxChecked(WCheckbox::ThirdBox, !thirdchecked);
|
||||
}
|
||||
}
|
||||
|
||||
/** on fourth shortcut, it toggles the fourth checkbox if there is one. Must be specialised if
|
||||
* this is not intended */
|
||||
void fourthKeyShortcut() override
|
||||
{
|
||||
if (nCheckbox >= 4) {
|
||||
auto fourthchecked = toolWidget->getCheckboxChecked(WCheckbox::FourthBox);
|
||||
toolWidget->setCheckboxChecked(WCheckbox::FourthBox, !fourthchecked);
|
||||
}
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -286,7 +286,7 @@ template<>
|
||||
void DSHPolygonController::firstKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value + 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value + 1);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -294,7 +294,7 @@ void DSHPolygonController::secondKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
if (value > 3.0) { // NOLINT
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value - 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ template<>
|
||||
void DSHRotateController::firstKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value + 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value + 1);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -464,7 +464,7 @@ void DSHRotateController::secondKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
if (value > 0.0) {
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value - 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ template<>
|
||||
void DSHTranslateController::firstKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value + 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value + 1);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -456,7 +456,23 @@ void DSHTranslateController::secondKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::First);
|
||||
if (value > 0.0) {
|
||||
toolWidget->setParameterWithoutPassingFocus(OnViewParameter::First, value - 1);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::First, value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
void DSHTranslateController::thirdKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::Second);
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::Second, value + 1);
|
||||
}
|
||||
|
||||
template<>
|
||||
void DSHTranslateController::fourthKeyShortcut()
|
||||
{
|
||||
auto value = toolWidget->getParameter(WParameter::Second);
|
||||
if (value > 1.0) {
|
||||
toolWidget->setParameterWithoutPassingFocus(WParameter::Second, value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,8 +511,9 @@ void DSHTranslateController::configureToolWidget()
|
||||
toolWidget->setParameterLabel(
|
||||
WParameter::First,
|
||||
QApplication::translate("TaskSketcherTool_p3_translate", "Copies (+'U'/-'J')"));
|
||||
toolWidget->setParameterLabel(WParameter::Second,
|
||||
QApplication::translate("TaskSketcherTool_p5_translate", "Rows"));
|
||||
toolWidget->setParameterLabel(
|
||||
WParameter::Second,
|
||||
QApplication::translate("TaskSketcherTool_p5_translate", "Rows (+'R'/-'F')"));
|
||||
|
||||
toolWidget->setParameter(OnViewParameter::First, 0.0);
|
||||
toolWidget->setParameter(OnViewParameter::Second, 1.0);
|
||||
|
||||
Reference in New Issue
Block a user