Core: TaskView: add updateWatcher when an object is set in edit. And add a timer when active document changes.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
|
||||
#include "TaskView.h"
|
||||
#include "TaskDialog.h"
|
||||
@@ -317,6 +318,9 @@ TaskView::TaskView(QWidget *parent)
|
||||
connectApplicationRedoDocument =
|
||||
App::GetApplication().signalRedoDocument.connect
|
||||
(std::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, sp::_1));
|
||||
connectApplicationInEdit =
|
||||
Gui::Application::Instance->signalInEdit.connect(
|
||||
std::bind(&Gui::TaskView::TaskView::slotInEdit, this, sp::_1));
|
||||
//NOLINTEND
|
||||
|
||||
updateWatcher();
|
||||
@@ -329,6 +333,7 @@ TaskView::~TaskView()
|
||||
connectApplicationClosedView.disconnect();
|
||||
connectApplicationUndoDocument.disconnect();
|
||||
connectApplicationRedoDocument.disconnect();
|
||||
connectApplicationInEdit.disconnect();
|
||||
Gui::Selection().Detach(this);
|
||||
|
||||
for (QWidget* panel : contextualPanels) {
|
||||
@@ -474,8 +479,20 @@ QSize TaskView::minimumSizeHint() const
|
||||
void TaskView::slotActiveDocument(const App::Document& doc)
|
||||
{
|
||||
Q_UNUSED(doc);
|
||||
if (!ActiveDialog)
|
||||
if (!ActiveDialog) {
|
||||
// at this point, active object of the active view returns None.
|
||||
// which is a problem if shouldShow of a watcher rely on the presence
|
||||
// of an active object (example Assembly).
|
||||
QTimer::singleShot(100, this, &TaskView::updateWatcher);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskView::slotInEdit(const Gui::ViewProviderDocumentObject& vp)
|
||||
{
|
||||
Q_UNUSED(vp);
|
||||
if (!ActiveDialog) {
|
||||
updateWatcher();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskView::slotDeletedDocument(const App::Document& doc)
|
||||
|
||||
@@ -39,6 +39,7 @@ class Property;
|
||||
namespace Gui {
|
||||
class MDIView;
|
||||
class ControlSingleton;
|
||||
class ViewProviderDocumentObject;
|
||||
namespace DockWnd{
|
||||
class ComboView;
|
||||
}
|
||||
@@ -187,6 +188,7 @@ private:
|
||||
void saveCurrentWidth();
|
||||
void tryRestoreWidth();
|
||||
void slotActiveDocument(const App::Document&);
|
||||
void slotInEdit(const Gui::ViewProviderDocumentObject&);
|
||||
void slotDeletedDocument(const App::Document&);
|
||||
void slotViewClosed(const Gui::MDIView*);
|
||||
void slotUndoDocument(const App::Document&);
|
||||
@@ -224,6 +226,7 @@ protected:
|
||||
Connection connectApplicationClosedView;
|
||||
Connection connectApplicationUndoDocument;
|
||||
Connection connectApplicationRedoDocument;
|
||||
Connection connectApplicationInEdit;
|
||||
};
|
||||
|
||||
} //namespace TaskView
|
||||
|
||||
Reference in New Issue
Block a user