diff options
Diffstat (limited to 'src/plugins/designer')
-rw-r--r-- | src/plugins/designer/codemodelhelpers.cpp | 10 | ||||
-rw-r--r-- | src/plugins/designer/editordata.h | 2 | ||||
-rw-r--r-- | src/plugins/designer/formeditorstack.cpp | 6 | ||||
-rw-r--r-- | src/plugins/designer/formeditorw.cpp | 32 | ||||
-rw-r--r-- | src/plugins/designer/formtemplatewizardpage.cpp | 6 | ||||
-rw-r--r-- | src/plugins/designer/formwindoweditor.cpp | 2 | ||||
-rw-r--r-- | src/plugins/designer/formwindowfile.cpp | 2 | ||||
-rw-r--r-- | src/plugins/designer/qtcreatorintegration.cpp | 28 | ||||
-rw-r--r-- | src/plugins/designer/resourcehandler.cpp | 6 | ||||
-rw-r--r-- | src/plugins/designer/settingspage.cpp | 5 | ||||
-rw-r--r-- | src/plugins/designer/settingspage.h | 2 |
11 files changed, 51 insertions, 50 deletions
diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp index 52bb38f5d1..5f3422e412 100644 --- a/src/plugins/designer/codemodelhelpers.cpp +++ b/src/plugins/designer/codemodelhelpers.cpp @@ -67,7 +67,7 @@ public: bool visit(CPlusPlus::Function * f) override; private: - const size_t m_length; + const uint m_length; const char *m_name; FunctionList m_matches; @@ -82,8 +82,8 @@ SearchFunction::SearchFunction(const char *name) : SearchFunction::FunctionList SearchFunction::operator()(const DocumentPtr &doc) { m_matches.clear(); - const unsigned globalSymbolCount = doc->globalSymbolCount(); - for (unsigned i = 0; i < globalSymbolCount; ++i) + const int globalSymbolCount = doc->globalSymbolCount(); + for (int i = 0; i < globalSymbolCount; ++i) accept(doc->globalSymbolAt(i)); return m_matches; } @@ -92,8 +92,8 @@ bool SearchFunction::visit(CPlusPlus::Function * f) { if (const CPlusPlus::Name *name = f->name()) if (const CPlusPlus::Identifier *id = name->identifier()) - if (id->size() == m_length) - if (!qstrncmp(m_name, id->chars(), uint(m_length))) + if (static_cast<uint>(id->size()) == m_length) + if (!qstrncmp(m_name, id->chars(), m_length)) m_matches.push_back(f); return true; } diff --git a/src/plugins/designer/editordata.h b/src/plugins/designer/editordata.h index c4d92f9a41..81904e405e 100644 --- a/src/plugins/designer/editordata.h +++ b/src/plugins/designer/editordata.h @@ -36,7 +36,7 @@ namespace Internal { class EditorData { public: - explicit operator bool() const { return formWindowEditor != 0; } + explicit operator bool() const { return formWindowEditor != nullptr; } FormWindowEditor *formWindowEditor = nullptr; SharedTools::WidgetHost *widgetHost = nullptr; diff --git a/src/plugins/designer/formeditorstack.cpp b/src/plugins/designer/formeditorstack.cpp index df602dda46..f109138cb3 100644 --- a/src/plugins/designer/formeditorstack.cpp +++ b/src/plugins/designer/formeditorstack.cpp @@ -65,7 +65,7 @@ FormEditorStack::~FormEditorStack() void FormEditorStack::add(const EditorData &data) { - if (m_designerCore == 0) { // Initialize first time here + if (m_designerCore == nullptr) { // Initialize first time here m_designerCore = data.widgetHost->formWindow()->core(); connect(m_designerCore->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, this, &FormEditorStack::updateFormWindowSelectionHandles); @@ -128,7 +128,7 @@ EditorData FormEditorStack::activeEditor() const SharedTools::WidgetHost *FormEditorStack::formWindowEditorForFormWindow(const QDesignerFormWindowInterface *fw) const { const int i = indexOfFormWindow(fw); - return i != -1 ? m_formEditors[i].widgetHost : static_cast<SharedTools::WidgetHost *>(0); + return i != -1 ? m_formEditors[i].widgetHost : static_cast<SharedTools::WidgetHost *>(nullptr); } void FormEditorStack::removeFormWindowEditor(QObject *xmlEditor) @@ -183,7 +183,7 @@ void FormEditorStack::formSizeChanged(int w, int h) SharedTools::WidgetHost *FormEditorStack::formWindowEditorForXmlEditor(const Core::IEditor *xmlEditor) const { const int i = indexOfFormEditor(xmlEditor); - return i != -1 ? m_formEditors.at(i).widgetHost : static_cast<SharedTools::WidgetHost *>(0); + return i != -1 ? m_formEditors.at(i).widgetHost : static_cast<SharedTools::WidgetHost *>(nullptr); } void FormEditorStack::modeAboutToChange(Core::Id mode) diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 09e89beed0..36db2e05ba 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -229,7 +229,7 @@ static FormEditorData *d = nullptr; static FormEditorW *m_instance = nullptr; FormEditorData::FormEditorData() : - m_formeditor(QDesignerComponents::createFormEditor(0)), + m_formeditor(QDesignerComponents::createFormEditor(nullptr)), m_initStage(FormEditorW::RegisterPlugins) { if (Designer::Constants::Internal::debug) @@ -238,7 +238,7 @@ FormEditorData::FormEditorData() : d = this; std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, - static_cast<QWidget *>(0)); + static_cast<QWidget *>(nullptr)); m_formeditor->setTopLevel(ICore::mainWindow()); m_formeditor->setSettingsManager(new SettingsManager()); @@ -352,7 +352,7 @@ void FormEditorData::setupViewActions() void FormEditorData::fullInit() { QTC_ASSERT(m_initStage == FormEditorW::RegisterPlugins, return); - QElapsedTimer *initTime = 0; + QElapsedTimer *initTime = nullptr; if (Designer::Constants::Internal::debug) { initTime = new QElapsedTimer; initTime->start(); @@ -410,7 +410,7 @@ void FormEditorData::fullInit() m_modeWidget = new QWidget; m_modeWidget->setObjectName("DesignerModeWidget"); QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(m_toolBar); // Avoid mode switch to 'Edit' mode when the application started by @@ -437,32 +437,32 @@ void FormEditorData::fullInit() void FormEditorData::initDesignerSubWindows() { - std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(0)); + std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(nullptr)); - QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, 0); + QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, nullptr); wb->setWindowTitle(tr("Widget Box")); wb->setObjectName("WidgetBox"); m_formeditor->setWidgetBox(wb); m_designerSubWindows[WidgetBoxSubWindow] = wb; - QDesignerObjectInspectorInterface *oi = QDesignerComponents::createObjectInspector(m_formeditor, 0); + QDesignerObjectInspectorInterface *oi = QDesignerComponents::createObjectInspector(m_formeditor, nullptr); oi->setWindowTitle(tr("Object Inspector")); oi->setObjectName("ObjectInspector"); m_formeditor->setObjectInspector(oi); m_designerSubWindows[ObjectInspectorSubWindow] = oi; - QDesignerPropertyEditorInterface *pe = QDesignerComponents::createPropertyEditor(m_formeditor, 0); + QDesignerPropertyEditorInterface *pe = QDesignerComponents::createPropertyEditor(m_formeditor, nullptr); pe->setWindowTitle(tr("Property Editor")); pe->setObjectName("PropertyEditor"); m_formeditor->setPropertyEditor(pe); m_designerSubWindows[PropertyEditorSubWindow] = pe; - QWidget *se = QDesignerComponents::createSignalSlotEditor(m_formeditor, 0); + QWidget *se = QDesignerComponents::createSignalSlotEditor(m_formeditor, nullptr); se->setWindowTitle(tr("Signals && Slots Editor")); se->setObjectName("SignalsAndSlotsEditor"); m_designerSubWindows[SignalSlotEditorSubWindow] = se; - QDesignerActionEditorInterface *ae = QDesignerComponents::createActionEditor(m_formeditor, 0); + QDesignerActionEditorInterface *ae = QDesignerComponents::createActionEditor(m_formeditor, nullptr); ae->setWindowTitle(tr("Action Editor")); ae->setObjectName("ActionEditor"); m_formeditor->setActionEditor(ae); @@ -641,7 +641,7 @@ void FormEditorData::setupActions() QObject::connect(m_fwm, &QDesignerFormWindowManagerInterface::activeFormWindowChanged, [this] (QDesignerFormWindowInterface *afw) { m_fwm->closeAllPreviews(); - setPreviewMenuEnabled(afw != 0); + setPreviewMenuEnabled(afw != nullptr); }); } @@ -770,11 +770,11 @@ IEditor *FormEditorData::createEditor() qDebug() << "FormEditorW::createEditor"; // Create and associate form and text editor. m_fwm->closeAllPreviews(); - QDesignerFormWindowInterface *form = m_fwm->createFormWindow(0); - QTC_ASSERT(form, return 0); + QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr); + QTC_ASSERT(form, return nullptr); QObject::connect(form, &QDesignerFormWindowInterface::toolChanged, [this] (int i) { toolChanged(i); }); - SharedTools::WidgetHost *widgetHost = new SharedTools::WidgetHost( /* parent */ 0, form); + SharedTools::WidgetHost *widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form); FormWindowEditor *formWindowEditor = m_xmlEditorFactory->create(form); m_editorWidget->add(widgetHost, formWindowEditor); @@ -806,7 +806,7 @@ SharedTools::WidgetHost *FormEditorW::activeWidgetHost() ensureInitStage(FullyInitialized); if (d->m_editorWidget) return d->m_editorWidget->activeEditor().widgetHost; - return 0; + return nullptr; } FormWindowEditor *FormEditorW::activeEditor() @@ -814,7 +814,7 @@ FormWindowEditor *FormEditorW::activeEditor() ensureInitStage(FullyInitialized); if (d->m_editorWidget) return d->m_editorWidget->activeEditor().formWindowEditor; - return 0; + return nullptr; } void FormEditorData::updateShortcut(Command *command) diff --git a/src/plugins/designer/formtemplatewizardpage.cpp b/src/plugins/designer/formtemplatewizardpage.cpp index fb01ddc5f4..3387ec6395 100644 --- a/src/plugins/designer/formtemplatewizardpage.cpp +++ b/src/plugins/designer/formtemplatewizardpage.cpp @@ -55,10 +55,10 @@ FormPageFactory::FormPageFactory() Utils::WizardPage *FormPageFactory::create(ProjectExplorer::JsonWizard *wizard, Core::Id typeId, const QVariant &data) { - Q_UNUSED(wizard); - Q_UNUSED(data); + Q_UNUSED(wizard) + Q_UNUSED(data) - QTC_ASSERT(canCreate(typeId), return 0); + QTC_ASSERT(canCreate(typeId), return nullptr); FormTemplateWizardPage *page = new FormTemplateWizardPage; return page; diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index ac2ddc06ca..b75bad127f 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -50,7 +50,7 @@ FormWindowEditor::~FormWindowEditor() QWidget *FormWindowEditor::toolBar() { - return 0; + return nullptr; } QString FormWindowEditor::contents() const diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index f84b9e197b..2a3b77df5d 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -286,7 +286,7 @@ void FormWindowFile::slotFormWindowRemoved(QDesignerFormWindowInterface *w) // as calls to isDirty() are triggered at arbitrary times // while building. if (w == m_formWindow) - m_formWindow = 0; + m_formWindow = nullptr; } } // namespace Internal diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index d004f4a661..4a760ff65e 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -114,7 +114,7 @@ QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const { if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost()) return host->integrationContainer(); - return 0; + return nullptr; } static QList<Document::Ptr> findDocumentsIncluding(const Snapshot &docTable, @@ -142,8 +142,8 @@ static QList<Document::Ptr> findDocumentsIncluding(const Snapshot &docTable, // Does klass inherit baseClass? static bool inherits(const Overview &o, const Class *klass, const QString &baseClass) { - const unsigned int baseClassCount = klass->baseClassCount(); - for (unsigned int b = 0; b < baseClassCount; ++b) + const int baseClassCount = klass->baseClassCount(); + for (int b = 0; b < baseClassCount; ++b) if (o.prettyName(klass->baseClassAt(b)->name()) == baseClass) return true; return false; @@ -171,14 +171,14 @@ static const Class *findClass(const Namespace *parentNameSpace, const LookupCont qDebug() << Q_FUNC_INFO << className; const Overview o; - const unsigned namespaceMemberCount = parentNameSpace->memberCount(); - for (unsigned i = 0; i < namespaceMemberCount; ++i) { // we go through all namespace members + const int namespaceMemberCount = parentNameSpace->memberCount(); + for (int i = 0; i < namespaceMemberCount; ++i) { // we go through all namespace members const Symbol *sym = parentNameSpace->memberAt(i); // we have found a class - we are interested in classes only if (const Class *cl = sym->asClass()) { // 1) we go through class members - const unsigned classMemberCount = cl->memberCount(); - for (unsigned j = 0; j < classMemberCount; ++j) + const int classMemberCount = cl->memberCount(); + for (int j = 0; j < classMemberCount; ++j) if (Declaration *decl = cl->memberAt(j)->asDeclaration()) { // we want to know if the class contains a member (so we look into // a declaration) of uiClassName type @@ -212,7 +212,7 @@ static const Class *findClass(const Namespace *parentNameSpace, const LookupCont } // member is namespave } // member is no class } // for members - return 0; + return nullptr; } static Function *findDeclaration(const Class *cl, const QString &functionName) @@ -242,7 +242,7 @@ static Function *findDeclaration(const Class *cl, const QString &functionName) return fun; } } - return 0; + return nullptr; } // TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this function @@ -516,13 +516,11 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, newDocTable.insert(i.value()); } } else { - const CppTools::WorkingCopy workingCopy = - CppTools::CppModelManager::instance()->workingCopy(); const Utils::FilePath configFileName = Utils::FilePath::fromString(CppTools::CppModelManager::configurationFileName()); - QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator(); - while (it.hasNext()) { - it.next(); + const CppTools::WorkingCopy::Table elements = + CppTools::CppModelManager::instance()->workingCopy().elements(); + for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it) { const Utils::FilePath &fileName = it.key(); if (fileName != configFileName) newDocTable.insert(docTable.document(fileName)); @@ -557,7 +555,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, // Find the class definition (ui class defined as member or base class) // in the file itself or in the directly included files (order 1). QString namespaceName; - const Class *cl = 0; + const Class *cl = nullptr; Document::Ptr doc; for (const Document::Ptr &d : qAsConst(docMap)) { diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp index 84020f77ee..a86bf21792 100644 --- a/src/plugins/designer/resourcehandler.cpp +++ b/src/plugins/designer/resourcehandler.cpp @@ -56,7 +56,11 @@ void ResourceHandler::ensureInitialized() m_initialized = true; auto connector = [this](Project *p) { - connect(p, &Project::fileListChanged, this, &ResourceHandler::updateResources); + connect(p, + &Project::fileListChanged, + this, + &ResourceHandler::updateResources, + Qt::QueuedConnection); }; for (Project *p : SessionManager::projects()) diff --git a/src/plugins/designer/settingspage.cpp b/src/plugins/designer/settingspage.cpp index 4dfa8bc550..f038b7a4db 100644 --- a/src/plugins/designer/settingspage.cpp +++ b/src/plugins/designer/settingspage.cpp @@ -48,7 +48,7 @@ QWidget *SettingsPage::widget() { m_initialized = true; if (!m_widget) - m_widget = m_designerPage->createPage(0); + m_widget = m_designerPage->createPage(nullptr); return m_widget; } @@ -66,8 +66,7 @@ void SettingsPage::finish() delete m_widget; } -SettingsPageProvider::SettingsPageProvider(QObject *parent) - : IOptionsPageProvider(parent) +SettingsPageProvider::SettingsPageProvider() { setCategory(Designer::Constants::SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("Designer", diff --git a/src/plugins/designer/settingspage.h b/src/plugins/designer/settingspage.h index 6fc13cbb01..13de3c2808 100644 --- a/src/plugins/designer/settingspage.h +++ b/src/plugins/designer/settingspage.h @@ -60,7 +60,7 @@ class SettingsPageProvider : public Core::IOptionsPageProvider Q_OBJECT public: - explicit SettingsPageProvider(QObject *parent = nullptr); + SettingsPageProvider(); QList<Core::IOptionsPage *> pages() const override; bool matches(const QString &searchKeyWord) const override; |