Gui: Add support for hints in status bar
This commit is contained in:
@@ -160,7 +160,10 @@ private:
|
||||
bool onModeChanged() override
|
||||
{
|
||||
DrawSketchHandler::resetPositionText();
|
||||
DrawSketchHandler::updateHint();
|
||||
|
||||
toolWidgetManager.onHandlerModeChanged();
|
||||
|
||||
if (DSDefaultHandler::onModeChanged()) {
|
||||
// If onModeChanged returns false, then the handler has been purged.
|
||||
toolWidgetManager.afterHandlerModeChanged();
|
||||
|
||||
@@ -96,6 +96,17 @@ public:
|
||||
SNAP_MODE_45Degree
|
||||
};
|
||||
|
||||
std::list<Gui::InputHint> getToolHints() const override
|
||||
{
|
||||
using UserInput = Gui::InputHint::UserInput;
|
||||
|
||||
return {
|
||||
{QWidget::tr("%1 change mode"), {UserInput::KeyM}},
|
||||
{QWidget::tr("%1 start drawing"), {UserInput::MouseLeft}},
|
||||
{QWidget::tr("%1 stop drawing"), {UserInput::MouseRight}},
|
||||
};
|
||||
}
|
||||
|
||||
void registerPressedKey(bool pressed, int key) override
|
||||
{
|
||||
if (Mode == STATUS_SEEK_Second && key == SoKeyboardEvent::M && pressed
|
||||
|
||||
@@ -74,6 +74,29 @@ public:
|
||||
{}
|
||||
~DrawSketchHandlerPolygon() override = default;
|
||||
|
||||
std::list<Gui::InputHint> getToolHints() const override
|
||||
{
|
||||
using UserInput = Gui::InputHint::UserInput;
|
||||
|
||||
switch (state()) {
|
||||
case SelectMode::SeekFirst:
|
||||
return {
|
||||
{QWidget::tr("%1 pick polygon center"), {UserInput::MouseLeft}},
|
||||
{QWidget::tr("%1/%2 increase / decrease number of sides"),
|
||||
{UserInput::KeyU, UserInput::KeyJ}},
|
||||
};
|
||||
case SelectMode::SeekSecond:
|
||||
return {
|
||||
{QWidget::tr("%1 pick rotation and size"), {UserInput::MouseMove}},
|
||||
{QWidget::tr("%1 confirm"), {UserInput::MouseLeft}},
|
||||
{QWidget::tr("%1/%2 increase / decrease number of sides"),
|
||||
{UserInput::KeyU, UserInput::KeyJ}},
|
||||
};
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void updateDataAndDrawToPosition(Base::Vector2d onSketchPos) override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user