forked from qt-creator/qt-creator
Designer: Use static pattern for FormEditorW singleton
Change-Id: Icf4a0135d9bc8441d468fd77abe29adcee677bb9 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -76,9 +76,8 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document
|
||||
.arg(uiClassName, files);
|
||||
}
|
||||
|
||||
QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :
|
||||
QDesignerIntegration(core, parent),
|
||||
m_few(parent)
|
||||
QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, QObject *parent)
|
||||
: QDesignerIntegration(core, parent)
|
||||
{
|
||||
setResourceFileWatcherBehaviour(ReloadResourceFileSilently);
|
||||
Feature f = features();
|
||||
@@ -103,15 +102,15 @@ void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, cons
|
||||
|
||||
void QtCreatorIntegration::updateSelection()
|
||||
{
|
||||
if (const EditorData ed = m_few->activeEditor())
|
||||
ed.widgetHost->updateFormWindowSelectionHandles(true);
|
||||
if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost())
|
||||
host->updateFormWindowSelectionHandles(true);
|
||||
QDesignerIntegration::updateSelection();
|
||||
}
|
||||
|
||||
QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
||||
{
|
||||
if (const EditorData ed = m_few->activeEditor())
|
||||
return ed.widgetHost->integrationContainer();
|
||||
if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost())
|
||||
return host->integrationContainer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -467,7 +466,7 @@ void QtCreatorIntegration::slotNavigateToSlot(const QString &objectName, const Q
|
||||
{
|
||||
QString errorMessage;
|
||||
if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty())
|
||||
QMessageBox::warning(m_few->designerEditor()->topLevel(), tr("Error finding/adding a slot."), errorMessage);
|
||||
QMessageBox::warning(FormEditorW::designerEditor()->topLevel(), tr("Error finding/adding a slot."), errorMessage);
|
||||
}
|
||||
|
||||
// Build name of the class as generated by uic, insert Ui namespace
|
||||
@@ -510,9 +509,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
||||
{
|
||||
typedef QMap<int, Document::Ptr> DocumentMap;
|
||||
|
||||
const EditorData ed = m_few->activeEditor();
|
||||
QTC_ASSERT(ed, return false);
|
||||
const QString currentUiFile = ed.formWindowEditor->document()->filePath();
|
||||
const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath();
|
||||
#if 0
|
||||
return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage);
|
||||
#endif
|
||||
@@ -566,7 +563,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
||||
return false;
|
||||
}
|
||||
|
||||
QDesignerFormWindowInterface *fwi = ed.widgetHost->formWindow();
|
||||
QDesignerFormWindowInterface *fwi = FormEditorW::activeWidgetHost()->formWindow();
|
||||
|
||||
const QString uiClass = uiClassName(fwi->mainContainer()->objectName());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user