Gui: offer possibility to editing view provider to handle "Select All" command
This commit is contained in:
@@ -227,7 +227,12 @@ public:
|
||||
else if (event->type() == QEvent::KeyPress) {
|
||||
auto ke = static_cast<QKeyEvent*>(event); // NOLINT
|
||||
if (ke->matches(QKeySequence::SelectAll)) {
|
||||
static_cast<View3DInventorViewer*>(obj)->selectAll();
|
||||
auto* viewer3d = static_cast<View3DInventorViewer*>(obj);
|
||||
auto* editingVP = viewer3d->getEditingViewProvider();
|
||||
if(!editingVP || !editingVP->selectAll())
|
||||
{
|
||||
viewer3d->selectAll();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1088,6 +1093,12 @@ bool View3DInventorViewer::isEditingViewProvider() const
|
||||
return this->editViewProvider != nullptr;
|
||||
}
|
||||
|
||||
/// return currently editing view provider
|
||||
ViewProvider* View3DInventorViewer::getEditingViewProvider() const
|
||||
{
|
||||
return this->editViewProvider;
|
||||
}
|
||||
|
||||
/// display override mode
|
||||
void View3DInventorViewer::setOverrideMode(const std::string& mode)
|
||||
{
|
||||
|
||||
@@ -220,6 +220,8 @@ public:
|
||||
void setEditingViewProvider(Gui::ViewProvider* vp, int ModNum);
|
||||
/// return whether a view provider is edited
|
||||
bool isEditingViewProvider() const;
|
||||
/// return currently editing view provider
|
||||
ViewProvider* getEditingViewProvider() const;
|
||||
/// reset from edit mode
|
||||
void resetEditingViewProvider();
|
||||
void setupEditingRoot(SoNode *node=nullptr, const Base::Matrix4D *mat=nullptr);
|
||||
|
||||
@@ -462,6 +462,9 @@ public:
|
||||
virtual void getTaskViewContent(std::vector<Gui::TaskView::TaskContent*>&) const {}
|
||||
//@}
|
||||
|
||||
/// is called when the provider is in edit and a "Select All" command was issued
|
||||
/// Provider shall return 'false' is it ignores the command, 'true' otherwise
|
||||
virtual bool selectAll() { return false; }
|
||||
/// is called when the provider is in edit and a key event occurs. Only ESC ends edit.
|
||||
virtual bool keyPressed(bool pressed, int key);
|
||||
/// Is called by the tree if the user double clicks on the object. It returns the string
|
||||
|
||||
@@ -2588,6 +2588,12 @@ void ViewProviderSketch::updateColor()
|
||||
editCoinManager->updateColor();
|
||||
}
|
||||
|
||||
bool ViewProviderSketch::selectAll()
|
||||
{
|
||||
// TODO: eventually implement "select all" logic
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ViewProviderSketch::doubleClicked()
|
||||
{
|
||||
Gui::Application::Instance->activeDocument()->setEdit(this);
|
||||
|
||||
@@ -656,6 +656,9 @@ public:
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
/// is called when the provider is in edit and a "Select All" command was issued
|
||||
/// Provider shall return 'false' is it ignores the command, 'true' otherwise
|
||||
bool selectAll() override;
|
||||
/// is called by the tree if the user double clicks on the object
|
||||
bool doubleClicked() override;
|
||||
/// is called when the Provider is in edit and the mouse is moved
|
||||
|
||||
Reference in New Issue
Block a user