forked from qt-creator/qt-creator
QmlDesigners: Allow detaching of standard views
Change-Id: I8b05d73724003c43565578a6bb9846d11af919ab Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
fd55b36b7c
commit
9f5c1184ea
@@ -100,6 +100,9 @@ public:
|
|||||||
|
|
||||||
bool usesRewriterView(RewriterView *rewriterView);
|
bool usesRewriterView(RewriterView *rewriterView);
|
||||||
|
|
||||||
|
void disableStandardViews();
|
||||||
|
void enableStandardViews();
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
Q_DISABLE_COPY(ViewManager)
|
Q_DISABLE_COPY(ViewManager)
|
||||||
|
|
||||||
@@ -107,6 +110,7 @@ private: // functions
|
|||||||
void attachItemLibraryView();
|
void attachItemLibraryView();
|
||||||
void attachAdditionalViews();
|
void attachAdditionalViews();
|
||||||
void detachAdditionalViews();
|
void detachAdditionalViews();
|
||||||
|
void detachStandardViews();
|
||||||
|
|
||||||
Model *currentModel() const;
|
Model *currentModel() const;
|
||||||
Model *documentModel() const;
|
Model *documentModel() const;
|
||||||
|
@@ -73,6 +73,7 @@ public:
|
|||||||
StatesEditorView statesEditorView;
|
StatesEditorView statesEditorView;
|
||||||
|
|
||||||
QList<QPointer<AbstractView> > additionalViews;
|
QList<QPointer<AbstractView> > additionalViews;
|
||||||
|
bool disableStandardViews = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CrumbleBar *crumbleBar() {
|
static CrumbleBar *crumbleBar() {
|
||||||
@@ -104,6 +105,9 @@ DesignDocument *ViewManager::currentDesignDocument() const
|
|||||||
|
|
||||||
void ViewManager::attachNodeInstanceView()
|
void ViewManager::attachNodeInstanceView()
|
||||||
{
|
{
|
||||||
|
if (nodeInstanceView()->isAttached())
|
||||||
|
return;
|
||||||
|
|
||||||
QElapsedTimer time;
|
QElapsedTimer time;
|
||||||
if (viewBenchmark().isInfoEnabled())
|
if (viewBenchmark().isInfoEnabled())
|
||||||
time.start();
|
time.start();
|
||||||
@@ -196,17 +200,8 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
|
|||||||
{
|
{
|
||||||
switchStateEditorViewToBaseState();
|
switchStateEditorViewToBaseState();
|
||||||
detachAdditionalViews();
|
detachAdditionalViews();
|
||||||
currentModel()->detachView(&d->designerActionManagerView);
|
|
||||||
currentModel()->detachView(&d->edit3DView);
|
|
||||||
currentModel()->detachView(&d->formEditorView);
|
|
||||||
currentModel()->detachView(&d->textEditorView);
|
|
||||||
currentModel()->detachView(&d->navigatorView);
|
|
||||||
currentModel()->detachView(&d->itemLibraryView);
|
|
||||||
currentModel()->detachView(&d->statesEditorView);
|
|
||||||
currentModel()->detachView(&d->propertyEditorView);
|
|
||||||
|
|
||||||
if (d->debugView.isAttached())
|
detachStandardViews();
|
||||||
currentModel()->detachView(&d->debugView);
|
|
||||||
|
|
||||||
currentModel()->setNodeInstanceView(nullptr);
|
currentModel()->setNodeInstanceView(nullptr);
|
||||||
}
|
}
|
||||||
@@ -229,6 +224,23 @@ void ViewManager::detachAdditionalViews()
|
|||||||
currentModel()->detachView(view.data());
|
currentModel()->detachView(view.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewManager::detachStandardViews()
|
||||||
|
{
|
||||||
|
|
||||||
|
for (auto view : std::vector<AbstractView *>({ &d->designerActionManagerView,
|
||||||
|
&d->edit3DView,
|
||||||
|
&d->formEditorView,
|
||||||
|
&d->textEditorView,
|
||||||
|
&d->navigatorView,
|
||||||
|
&d->itemLibraryView,
|
||||||
|
&d->statesEditorView,
|
||||||
|
&d->propertyEditorView,
|
||||||
|
&d->debugView})) {
|
||||||
|
if (view->isAttached())
|
||||||
|
currentModel()->detachView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ViewManager::attachComponentView()
|
void ViewManager::attachComponentView()
|
||||||
{
|
{
|
||||||
documentModel()->attachView(&d->componentView);
|
documentModel()->attachView(&d->componentView);
|
||||||
@@ -262,52 +274,25 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
|
|||||||
|
|
||||||
qCInfo(viewBenchmark) << Q_FUNC_INFO;
|
qCInfo(viewBenchmark) << Q_FUNC_INFO;
|
||||||
|
|
||||||
currentModel()->attachView(&d->designerActionManagerView);
|
|
||||||
|
|
||||||
int last = time.elapsed();
|
int last = time.elapsed();
|
||||||
qCInfo(viewBenchmark) << "ActionManagerView:" << last << time.elapsed();
|
int currentTime = 0;
|
||||||
|
if (!d->disableStandardViews) {
|
||||||
|
for (auto view : std::vector<AbstractView *>({&d->designerActionManagerView,
|
||||||
|
&d->edit3DView,
|
||||||
|
&d->formEditorView,
|
||||||
|
&d->textEditorView,
|
||||||
|
&d->navigatorView,
|
||||||
|
&d->itemLibraryView,
|
||||||
|
&d->statesEditorView,
|
||||||
|
&d->propertyEditorView})) {
|
||||||
|
|
||||||
currentModel()->attachView(&d->edit3DView);
|
|
||||||
|
|
||||||
int currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "Edit3DView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
currentModel()->attachView(&d->formEditorView);
|
|
||||||
|
|
||||||
|
currentModel()->attachView(view);
|
||||||
currentTime = time.elapsed();
|
currentTime = time.elapsed();
|
||||||
qCInfo(viewBenchmark) << "FormEditorView:" << currentTime - last;
|
qCInfo(viewBenchmark) << view->widgetInfo().uniqueId << currentTime - last;
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
currentModel()->attachView(&d->textEditorView);
|
|
||||||
|
|
||||||
currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "TextEditorView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
currentModel()->attachView(&d->navigatorView);
|
|
||||||
|
|
||||||
currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "NavigatorView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
attachItemLibraryView();
|
|
||||||
|
|
||||||
currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "ItemLibraryView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
currentModel()->attachView(&d->statesEditorView);
|
|
||||||
|
|
||||||
currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "StatesEditorView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
|
||||||
|
|
||||||
currentModel()->attachView(&d->propertyEditorView);
|
|
||||||
|
|
||||||
currentTime = time.elapsed();
|
|
||||||
qCInfo(viewBenchmark) << "PropertyEditorView:" << currentTime - last;
|
|
||||||
last = currentTime;
|
last = currentTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attachAdditionalViews();
|
attachAdditionalViews();
|
||||||
|
|
||||||
@@ -459,6 +444,18 @@ bool ViewManager::usesRewriterView(RewriterView *rewriterView)
|
|||||||
return currentDesignDocument()->rewriterView() == rewriterView;
|
return currentDesignDocument()->rewriterView() == rewriterView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewManager::disableStandardViews()
|
||||||
|
{
|
||||||
|
d->disableStandardViews = true;
|
||||||
|
detachStandardViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewManager::enableStandardViews()
|
||||||
|
{
|
||||||
|
d->disableStandardViews = false;
|
||||||
|
attachViewsExceptRewriterAndComponetView();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
#endif //QMLDESIGNER_TEST
|
#endif //QMLDESIGNER_TEST
|
||||||
|
Reference in New Issue
Block a user