forked from qt-creator/qt-creator
Aggregation: Add a convenience function to create simple aggregates
Change-Id: I03300f1fcc20314d392012fd288ef0fc2501d403 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -131,9 +131,7 @@ static QFrame *createHelper(QAbstractItemView *treeView,
|
||||
vbox->addWidget(treeView);
|
||||
vbox->addWidget(placeHolder);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(treeView);
|
||||
agg->add(finder);
|
||||
Aggregation::aggregate({treeView, finder});
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -116,10 +116,9 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
this, &SearchResultWidget::filterInvalidated);
|
||||
connect(m_searchResultTreeView, &SearchResultTreeView::filterChanged,
|
||||
this, &SearchResultWidget::filterChanged);
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(m_searchResultTreeView);
|
||||
agg->add(new ItemViewFind(m_searchResultTreeView,
|
||||
ItemDataRoles::ResultLineRole));
|
||||
|
||||
auto find = new ItemViewFind(m_searchResultTreeView, ItemDataRoles::ResultLineRole);
|
||||
Aggregation::aggregate({m_searchResultTreeView, find});
|
||||
layout->addWidget(m_searchResultTreeView);
|
||||
|
||||
m_infoBarDisplay.setTarget(layout, 2);
|
||||
|
||||
@@ -2531,9 +2531,7 @@ void ICorePrivate::changeLog()
|
||||
auto textEdit = new QTextBrowser;
|
||||
textEdit->setOpenExternalLinks(true);
|
||||
|
||||
auto aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(textEdit);
|
||||
aggregate->add(new Core::BaseTextFind(textEdit));
|
||||
Aggregation::aggregate({textEdit, new BaseTextFind(textEdit)});
|
||||
|
||||
new MarkdownHighlighter(textEdit->document());
|
||||
|
||||
|
||||
@@ -64,9 +64,8 @@ QWidget *LocatorManager::createLocatorInputWidget(QWidget *window)
|
||||
{
|
||||
auto locatorWidget = createStaticLocatorWidget(Locator::instance());
|
||||
// register locator widget for this window
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(window);
|
||||
agg->add(locatorWidget);
|
||||
Aggregation::aggregate({window, locatorWidget});
|
||||
|
||||
return locatorWidget;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,9 +174,7 @@ OutputWindow::OutputWindow(Context context, const Key &settingsKey, QWidget *par
|
||||
p.setColor(QPalette::HighlightedText, activeHighlightedText);
|
||||
setPalette(p);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(this);
|
||||
agg->add(new BaseTextFind(this));
|
||||
Aggregation::aggregate({this, new BaseTextFind(this)});
|
||||
}
|
||||
|
||||
OutputWindow::~OutputWindow()
|
||||
|
||||
@@ -78,9 +78,7 @@ Console::Console()
|
||||
itemDelegate, &ConsoleItemDelegate::currentChanged);
|
||||
m_consoleView->setItemDelegate(itemDelegate);
|
||||
|
||||
auto aggregate = new Aggregation::Aggregate();
|
||||
aggregate->add(m_consoleView);
|
||||
aggregate->add(new Core::ItemViewFind(m_consoleView));
|
||||
Aggregation::aggregate({m_consoleView, new Core::ItemViewFind(m_consoleView)});
|
||||
|
||||
vbox->addWidget(m_consoleView);
|
||||
vbox->addWidget(new Core::FindToolBarPlaceHolder(m_consoleWidget));
|
||||
|
||||
@@ -410,13 +410,8 @@ LogWindow::LogWindow(DebuggerEngine *engine)
|
||||
layout->addWidget(new Core::FindToolBarPlaceHolder(this));
|
||||
setLayout(layout);
|
||||
|
||||
auto aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(m_combinedText);
|
||||
aggregate->add(new Core::BaseTextFind(m_combinedText));
|
||||
|
||||
aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(m_inputText);
|
||||
aggregate->add(new Core::BaseTextFind(m_inputText));
|
||||
Aggregation::aggregate({m_combinedText, new Core::BaseTextFind(m_combinedText)});
|
||||
Aggregation::aggregate({m_inputText, new Core::BaseTextFind(m_inputText)});
|
||||
|
||||
connect(m_inputText, &InputPane::statusMessageRequested,
|
||||
this, &LogWindow::statusMessageRequested);
|
||||
@@ -657,13 +652,8 @@ GlobalLogWindow::GlobalLogWindow()
|
||||
layout->addWidget(new Core::FindToolBarPlaceHolder(this));
|
||||
setLayout(layout);
|
||||
|
||||
auto aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(m_rightPane);
|
||||
aggregate->add(new Core::BaseTextFind(m_rightPane));
|
||||
|
||||
aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(m_leftPane);
|
||||
aggregate->add(new Core::BaseTextFind(m_leftPane));
|
||||
Aggregation::aggregate({m_rightPane, new Core::BaseTextFind(m_rightPane)});
|
||||
Aggregation::aggregate({m_leftPane, new Core::BaseTextFind(m_leftPane)});
|
||||
|
||||
connect(m_leftPane->clearContentsAction(), &QAction::triggered,
|
||||
this, &GlobalLogWindow::clearContents);
|
||||
|
||||
@@ -341,9 +341,7 @@ HelpViewer *createHelpViewer()
|
||||
viewer, &HelpViewer::setScrollWheelZoomingEnabled);
|
||||
|
||||
// add find support
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(viewer);
|
||||
agg->add(new HelpViewerFindSupport(viewer));
|
||||
Aggregation::aggregate({viewer, new HelpViewerFindSupport(viewer)});
|
||||
|
||||
return viewer;
|
||||
}
|
||||
|
||||
@@ -172,9 +172,8 @@ TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
|
||||
d->m_filter = new Internal::TaskFilterModel(d->m_model);
|
||||
d->m_filter->setAutoAcceptChildRows(true);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(&d->m_treeView);
|
||||
agg->add(new Core::ItemViewFind(&d->m_treeView, TaskModel::Description));
|
||||
auto find = new Core::ItemViewFind(&d->m_treeView, TaskModel::Description);
|
||||
Aggregation::aggregate({&d->m_treeView, find});
|
||||
|
||||
d->m_treeView.setHeaderHidden(true);
|
||||
d->m_treeView.setExpandsOnDoubleClick(false);
|
||||
|
||||
@@ -107,9 +107,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
||||
d->m_mainView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setFocusProxy(d->m_mainView);
|
||||
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(d->m_mainView);
|
||||
agg->add(new TraceViewFindSupport(this, modelManager));
|
||||
Aggregation::aggregate({d->m_mainView, new TraceViewFindSupport(this, modelManager)});
|
||||
|
||||
groupLayout->addWidget(d->m_mainView);
|
||||
groupLayout->addWidget(new Core::FindToolBarPlaceHolder(this));
|
||||
|
||||
@@ -1071,14 +1071,12 @@ TextEditorWidgetPrivate::TextEditorWidgetPrivate(TextEditorWidget *parent)
|
||||
, m_editorContext(Id::generate())
|
||||
{
|
||||
m_selectionHighlightOverlay->show();
|
||||
auto aggregate = new Aggregation::Aggregate;
|
||||
m_find = new TextEditorWidgetFind(q);
|
||||
connect(m_find, &BaseTextFind::highlightAllRequested,
|
||||
this, &TextEditorWidgetPrivate::highlightSearchResultsSlot);
|
||||
connect(m_find, &BaseTextFind::findScopeChanged,
|
||||
this, &TextEditorWidgetPrivate::setFindScope);
|
||||
aggregate->add(m_find);
|
||||
aggregate->add(q);
|
||||
Aggregation::aggregate({q, m_find});
|
||||
|
||||
m_extraArea = new TextEditExtraArea(q);
|
||||
m_extraArea->setMouseTracking(true);
|
||||
|
||||
@@ -213,9 +213,8 @@ void TodoOutputPane::createTreeView()
|
||||
|
||||
m_todoTreeView = new TodoOutputTreeView();
|
||||
m_todoTreeView->setModel(m_filteredTodoItemsModel);
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(m_todoTreeView);
|
||||
agg->add(new Core::ItemViewFind(m_todoTreeView));
|
||||
|
||||
Aggregation::aggregate({m_todoTreeView, new Core::ItemViewFind(m_todoTreeView)});
|
||||
|
||||
connect(m_todoTreeView, &TodoOutputTreeView::activated, this, &TodoOutputPane::todoTreeViewClicked);
|
||||
}
|
||||
|
||||
@@ -213,9 +213,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
|
||||
updateFileModel();
|
||||
});
|
||||
|
||||
auto aggregate = new Aggregation::Aggregate;
|
||||
aggregate->add(new BaseTextFind(descriptionEdit));
|
||||
aggregate->add(this);
|
||||
Aggregation::aggregate({this, new BaseTextFind(descriptionEdit)});
|
||||
}
|
||||
|
||||
VcsBaseSubmitEditor::~VcsBaseSubmitEditor()
|
||||
|
||||
Reference in New Issue
Block a user