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);
|
||||
|
||||
void disableStandardViews();
|
||||
void enableStandardViews();
|
||||
|
||||
private: // functions
|
||||
Q_DISABLE_COPY(ViewManager)
|
||||
|
||||
@@ -107,6 +110,7 @@ private: // functions
|
||||
void attachItemLibraryView();
|
||||
void attachAdditionalViews();
|
||||
void detachAdditionalViews();
|
||||
void detachStandardViews();
|
||||
|
||||
Model *currentModel() const;
|
||||
Model *documentModel() const;
|
||||
|
@@ -73,6 +73,7 @@ public:
|
||||
StatesEditorView statesEditorView;
|
||||
|
||||
QList<QPointer<AbstractView> > additionalViews;
|
||||
bool disableStandardViews = false;
|
||||
};
|
||||
|
||||
static CrumbleBar *crumbleBar() {
|
||||
@@ -104,6 +105,9 @@ DesignDocument *ViewManager::currentDesignDocument() const
|
||||
|
||||
void ViewManager::attachNodeInstanceView()
|
||||
{
|
||||
if (nodeInstanceView()->isAttached())
|
||||
return;
|
||||
|
||||
QElapsedTimer time;
|
||||
if (viewBenchmark().isInfoEnabled())
|
||||
time.start();
|
||||
@@ -196,17 +200,8 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
|
||||
{
|
||||
switchStateEditorViewToBaseState();
|
||||
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())
|
||||
currentModel()->detachView(&d->debugView);
|
||||
detachStandardViews();
|
||||
|
||||
currentModel()->setNodeInstanceView(nullptr);
|
||||
}
|
||||
@@ -229,6 +224,23 @@ void ViewManager::detachAdditionalViews()
|
||||
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()
|
||||
{
|
||||
documentModel()->attachView(&d->componentView);
|
||||
@@ -262,52 +274,25 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
|
||||
|
||||
qCInfo(viewBenchmark) << Q_FUNC_INFO;
|
||||
|
||||
currentModel()->attachView(&d->designerActionManagerView);
|
||||
|
||||
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);
|
||||
|
||||
currentTime = time.elapsed();
|
||||
qCInfo(viewBenchmark) << "FormEditorView:" << 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;
|
||||
currentModel()->attachView(view);
|
||||
currentTime = time.elapsed();
|
||||
qCInfo(viewBenchmark) << view->widgetInfo().uniqueId << currentTime - last;
|
||||
last = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
attachAdditionalViews();
|
||||
|
||||
@@ -459,6 +444,18 @@ bool ViewManager::usesRewriterView(RewriterView *rewriterView)
|
||||
return currentDesignDocument()->rewriterView() == rewriterView;
|
||||
}
|
||||
|
||||
void ViewManager::disableStandardViews()
|
||||
{
|
||||
d->disableStandardViews = true;
|
||||
detachStandardViews();
|
||||
}
|
||||
|
||||
void ViewManager::enableStandardViews()
|
||||
{
|
||||
d->disableStandardViews = false;
|
||||
attachViewsExceptRewriterAndComponetView();
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
#endif //QMLDESIGNER_TEST
|
||||
|
Reference in New Issue
Block a user