diff options
author | Filip Bucek <fbucek@atlas.cz> | 2019-01-03 10:56:36 +0100 |
---|---|---|
committer | Filip Bucek <fbucek@atlas.cz> | 2019-01-23 09:10:42 +0000 |
commit | aaa8beab88dddd7218f6d3c30fb29c04679e2098 (patch) | |
tree | b6416714fee6923386c87b0b29f72a6bccecf90e /src | |
parent | 2781c2a9004f1404580c287364e10add20bcb180 (diff) | |
download | qt-creator-aaa8beab88dddd7218f6d3c30fb29c04679e2098.tar.gz |
Wizards: Support using #pragma once instead of include guards
Allow users to choose #pragma once instead of #ifndef include guards in
generated header files.
Fixes: QTCREATORBUG-12166
Change-Id: I3ba41c7570beb9c5958e174b5581fcc25855050f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Filip Bucek <fbucek@atlas.cz>
Diffstat (limited to 'src')
16 files changed, 127 insertions, 45 deletions
diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp index 22a4c304d5..ceaddd73b3 100644 --- a/src/plugins/cpptools/abstracteditorsupport.cpp +++ b/src/plugins/cpptools/abstracteditorsupport.cpp @@ -27,6 +27,7 @@ #include "cppfilesettingspage.h" #include "cppmodelmanager.h" +#include "cpptools/cpptoolsplugin.h" #include <utils/fileutils.h> #include <utils/macroexpander.h> @@ -68,5 +69,10 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin return Utils::TemplateEngine::processText(&expander, license, nullptr); } +bool AbstractEditorSupport::usePragmaOnce() +{ + return Internal::CppToolsPlugin::instance()->usePragmaOnce(); +} + } // namespace CppTools diff --git a/src/plugins/cpptools/abstracteditorsupport.h b/src/plugins/cpptools/abstracteditorsupport.h index 3351ce0856..617c9099f7 100644 --- a/src/plugins/cpptools/abstracteditorsupport.h +++ b/src/plugins/cpptools/abstracteditorsupport.h @@ -49,6 +49,7 @@ public: unsigned revision() const { return m_revision; } static QString licenseTemplate(const QString &file = QString(), const QString &className = QString()); + static bool usePragmaOnce(); private: CppModelManager *m_modelmanager; diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index 5c172e89a7..5ff64b165d 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -55,6 +55,7 @@ static const char headerSuffixKeyC[] = "HeaderSuffix"; static const char sourceSuffixKeyC[] = "SourceSuffix"; static const char headerSearchPathsKeyC[] = "HeaderSearchPaths"; static const char sourceSearchPathsKeyC[] = "SourceSearchPaths"; +static const char headerPragmaOnceC[] = "HeaderPragmaOnce"; static const char licenseTemplatePathKeyC[] = "LicenseTemplate"; const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::CppFileSettingsWidget", @@ -68,11 +69,6 @@ const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::Cpp namespace CppTools { namespace Internal { -CppFileSettings::CppFileSettings() : - lowerCaseFiles(false) -{ -} - void CppFileSettings::toSettings(QSettings *s) const { s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP)); @@ -83,6 +79,7 @@ void CppFileSettings::toSettings(QSettings *s) const s->setValue(QLatin1String(headerSearchPathsKeyC), headerSearchPaths); s->setValue(QLatin1String(sourceSearchPathsKeyC), sourceSearchPaths); s->setValue(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), lowerCaseFiles); + s->setValue(QLatin1String(headerPragmaOnceC), headerPragmaOnce); s->setValue(QLatin1String(licenseTemplatePathKeyC), licenseTemplatePath); s->endGroup(); } @@ -106,6 +103,7 @@ void CppFileSettings::fromSettings(QSettings *s) .toStringList(); const bool lowerCaseDefault = Constants::lowerCaseFilesDefault; lowerCaseFiles = s->value(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), QVariant(lowerCaseDefault)).toBool(); + headerPragmaOnce = s->value(headerPragmaOnceC, headerPragmaOnce).toBool(); licenseTemplatePath = s->value(QLatin1String(licenseTemplatePathKeyC), QString()).toString(); s->endGroup(); } @@ -127,6 +125,7 @@ bool CppFileSettings::applySuffixesToMimeDB() bool CppFileSettings::equals(const CppFileSettings &rhs) const { return lowerCaseFiles == rhs.lowerCaseFiles + && headerPragmaOnce == rhs.headerPragmaOnce && headerPrefixes == rhs.headerPrefixes && sourcePrefixes == rhs.sourcePrefixes && headerSuffix == rhs.headerSuffix @@ -303,6 +302,7 @@ CppFileSettings CppFileSettingsWidget::settings() const { CppFileSettings rc; rc.lowerCaseFiles = m_ui->lowerCaseFileNamesCheckBox->isChecked(); + rc.headerPragmaOnce = m_ui->headerPragmaOnceCheckBox->isChecked(); rc.headerPrefixes = trimmedPaths(m_ui->headerPrefixesEdit->text()); rc.sourcePrefixes = trimmedPaths(m_ui->sourcePrefixesEdit->text()); rc.headerSuffix = m_ui->headerSuffixComboBox->currentText(); @@ -323,6 +323,7 @@ void CppFileSettingsWidget::setSettings(const CppFileSettings &s) { const QChar comma = QLatin1Char(','); m_ui->lowerCaseFileNamesCheckBox->setChecked(s.lowerCaseFiles); + m_ui->headerPragmaOnceCheckBox->setChecked(s.headerPragmaOnce); m_ui->headerPrefixesEdit->setText(s.headerPrefixes.join(comma)); m_ui->sourcePrefixesEdit->setText(s.sourcePrefixes.join(comma)); setComboText(m_ui->headerSuffixComboBox, s.headerSuffix); diff --git a/src/plugins/cpptools/cppfilesettingspage.h b/src/plugins/cpptools/cppfilesettingspage.h index e5d8faafa8..5375664828 100644 --- a/src/plugins/cpptools/cppfilesettingspage.h +++ b/src/plugins/cpptools/cppfilesettingspage.h @@ -42,16 +42,15 @@ namespace Ui { class CppFileSettingsPage; } struct CppFileSettings { - CppFileSettings(); - QStringList headerPrefixes; QString headerSuffix; QStringList headerSearchPaths; QStringList sourcePrefixes; QString sourceSuffix; QStringList sourceSearchPaths; - bool lowerCaseFiles; QString licenseTemplatePath; + bool headerPragmaOnce = false; + bool lowerCaseFiles = false; void toSettings(QSettings *) const; void fromSettings(QSettings *); diff --git a/src/plugins/cpptools/cppfilesettingspage.ui b/src/plugins/cpptools/cppfilesettingspage.ui index a060e167fd..9edf2cd5da 100644 --- a/src/plugins/cpptools/cppfilesettingspage.ui +++ b/src/plugins/cpptools/cppfilesettingspage.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>547</width> - <height>363</height> + <height>406</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -67,7 +67,7 @@ These paths are used in addition to current directory on Switch Header/Source.</ </property> </widget> </item> - <item row="4" column="0"> + <item row="5" column="0"> <widget class="QLabel" name="headerPrefixesLabel"> <property name="text"> <string>&Prefixes:</string> @@ -77,7 +77,7 @@ These paths are used in addition to current directory on Switch Header/Source.</ </property> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <widget class="QLineEdit" name="headerPrefixesEdit"> <property name="toolTip"> <string>Comma-separated list of header prefixes. @@ -86,6 +86,26 @@ These prefixes are used in addition to current file name on Switch Header/Source </property> </widget> </item> + <item row="7" column="0"> + <widget class="QLabel" name="headerPragmaOnceLabel"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string>Include guards</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QCheckBox" name="headerPragmaOnceCheckBox"> + <property name="toolTip"> + <string>Uses #pragma once instead of #ifndef include guards.</string> + </property> + <property name="text"> + <string>Use '#pragma once' instead of '#ifndef' guards</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index a844c6bb30..8068c27d0b 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -140,6 +140,11 @@ QString CppToolsPlugin::licenseTemplate() return m_instance->m_fileSettings->licenseTemplate(); } +bool CppToolsPlugin::usePragmaOnce() +{ + return m_instance->m_fileSettings->headerPragmaOnce; +} + const QStringList &CppToolsPlugin::headerSearchPaths() { return m_instance->m_fileSettings->headerSearchPaths; @@ -204,6 +209,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) tr("The configured path to the license template"), []() { return CppToolsPlugin::licenseTemplatePath().toString(); }); + expander->registerVariable( + "Cpp:PragmaOnce", + tr("Insert #pragma once instead of #ifndef include guards into header file"), + [] { return usePragmaOnce() ? QString("true") : QString(); }); + return true; } diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index 25ae97f1c8..84e43da383 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -65,6 +65,7 @@ public: static void clearHeaderSourceCache(); static Utils::FileName licenseTemplatePath(); static QString licenseTemplate(); + static bool usePragmaOnce(); bool initialize(const QStringList &arguments, QString *errorMessage) final; void extensionsInitialized() final; diff --git a/src/plugins/designer/cpp/formclasswizarddialog.cpp b/src/plugins/designer/cpp/formclasswizarddialog.cpp index 95b099b4c4..66956b99a7 100644 --- a/src/plugins/designer/cpp/formclasswizarddialog.cpp +++ b/src/plugins/designer/cpp/formclasswizarddialog.cpp @@ -26,6 +26,7 @@ #include "formclasswizarddialog.h" #include "formclasswizardpage.h" #include "formclasswizardparameters.h" +#include <cpptools/abstracteditorsupport.h> #include <designer/formtemplatewizardpage.h> #include <qtsupport/codegenerator.h> @@ -88,6 +89,7 @@ FormClassWizardParameters FormClassWizardDialog::parameters() const m_classPage->getParameters(&rc); // Name the ui class in the Ui namespace after the class specified rc.uiTemplate = QtSupport::CodeGenerator::changeUiClassName(m_rawFormTemplate, rc.className); + rc.usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce(); return rc; } diff --git a/src/plugins/designer/cpp/formclasswizardparameters.h b/src/plugins/designer/cpp/formclasswizardparameters.h index 7aa25f5cb3..1396c9052c 100644 --- a/src/plugins/designer/cpp/formclasswizardparameters.h +++ b/src/plugins/designer/cpp/formclasswizardparameters.h @@ -43,6 +43,7 @@ public: QString sourceFile; QString headerFile; QString uiFile; + bool usePragmaOnce = false; }; } // namespace Designer diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp index 7ad455e159..2584ff7de1 100644 --- a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp +++ b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp @@ -104,8 +104,12 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete // 1) Header file QTextStream headerStr(header); - headerStr << headerLicense << "#ifndef " << guard - << "\n#define " << guard << '\n' << '\n'; + headerStr << headerLicense; + + if (parameters.usePragmaOnce) + headerStr << "#pragma once\n\n"; + else + headerStr << "#ifndef " << guard << "\n#define " << guard << "\n\n"; // Include 'ui_' if (generationParameters.embedding != QtSupport::CodeGenSettings::PointerAggregatedUiClass) { @@ -165,7 +169,9 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete } headerStr << namespaceIndent << "};\n\n"; Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr); - headerStr << "#endif // "<< guard << '\n'; + + if (!parameters.usePragmaOnce) + headerStr << "#endif // " << guard << '\n'; // 2) Source file QTextStream sourceStr(source); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 827edbedb3..6c5c6cdb3a 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -939,7 +939,17 @@ QString CustomWizardContext::processFile(const FieldReplacementMap &fm, QString replaceFields(fm, &in); QString out; + + // Expander needed to handle extra variable "Cpp:PragmaOnce" QString errorMessage; + Utils::MacroExpander *expander = Utils::globalMacroExpander(); + in = Utils::TemplateEngine::processText(expander, in, &errorMessage); + if (!errorMessage.isEmpty()) { + qWarning("Error processing custom widget file: %s\nFile:\n%s", + qPrintable(errorMessage), qPrintable(in)); + return QString(); + } + if (!Utils::TemplateEngine::preprocessText(in, &out, &errorMessage)) { qWarning("Error preprocessing custom widget file: %s\nFile:\n%s", qPrintable(errorMessage), qPrintable(in)); diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp index f43b4ca73e..be08ea5ff2 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp @@ -30,6 +30,8 @@ #include <cpptools/abstracteditorsupport.h> #include <utils/fileutils.h> +#include <utils/macroexpander.h> +#include <utils/templateengine.h> #include <QFileInfo> #include <QDir> @@ -311,7 +313,20 @@ QString PluginGenerator::processTemplate(const QString &tmpl, if (!reader.fetch(tmpl, errorMessage)) return QString(); + QString cont = QString::fromUtf8(reader.data()); + + // Expander needed to handle extra variable "Cpp:PragmaOnce" + Utils::MacroExpander *expander = Utils::globalMacroExpander(); + QString errMsg; + cont = Utils::TemplateEngine::processText(expander, cont, &errMsg); + if (!errMsg.isEmpty()) { + qWarning("Error processing custom plugin file: %s\nFile:\n%s", + qPrintable(errMsg), qPrintable(cont)); + errorMessage = &errMsg; + return QString(); + } + const QChar atChar = QLatin1Char('@'); int offset = 0; for (;;) { diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp index a2e8c217c7..08b7514a8e 100644 --- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp @@ -105,6 +105,7 @@ static inline bool generateFormClass(const GuiAppParameters ¶ms, fp.className = params.className; fp.sourceFile = params.sourceFileName; fp.headerFile = params.headerFileName; + fp.usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce(); QString headerContents; QString sourceContents; // Invoke code generation service of Qt Designer plugin. @@ -224,7 +225,6 @@ bool GuiAppWizard::parametrizeTemplate(const QString &templatePath, const QStrin if (!reader.fetch(fileName, QIODevice::Text, errorMessage)) return false; QString contents = QString::fromUtf8(reader.data()); - contents.replace(QLatin1String("%QAPP_INCLUDE%"), QLatin1String("QApplication")); contents.replace(QLatin1String("%INCLUDE%"), params.headerFileName); contents.replace(QLatin1String("%CLASS%"), params.className); @@ -236,6 +236,11 @@ bool GuiAppWizard::parametrizeTemplate(const QString &templatePath, const QStrin else contents.replace(QLatin1String("%SHOWMETHOD%"), QString::fromLatin1(mainSourceShowC)); + // Replace include guards with pragma once + if (CppTools::AbstractEditorSupport::usePragmaOnce()) { + contents.replace(QLatin1String("#ifndef %PRE_DEF%\n#define %PRE_DEF%"), "#pragma once"); + contents.replace(QLatin1String("#endif // %PRE_DEF%\n"), QString()); + } const QChar dot = QLatin1Char('.'); diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp index 7660f68a8f..a4b9c81af0 100644 --- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp @@ -31,25 +31,6 @@ #include <QTextStream> #include <QStringList> -// Contents of the header defining the shared library export. -#define GUARD_VARIABLE "<GUARD>" -#define EXPORT_MACRO_VARIABLE "<EXPORT_MACRO>" -#define LIBRARY_MACRO_VARIABLE "<LIBRARY_MACRO>" - -static const char *globalHeaderContentsC = -"#ifndef " GUARD_VARIABLE "\n" -"#define " GUARD_VARIABLE "\n" -"\n" -"#include <QtCore/qglobal.h>\n" -"\n" -"#if defined(" LIBRARY_MACRO_VARIABLE ")\n" -"# define " EXPORT_MACRO_VARIABLE " Q_DECL_EXPORT\n" -"#else\n" -"# define " EXPORT_MACRO_VARIABLE " Q_DECL_IMPORT\n" -"#endif\n" -"\n" -"#endif // " GUARD_VARIABLE "\n"; - namespace QmakeProjectManager { namespace Internal { @@ -60,6 +41,7 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, const QString &exportMacro, const QString &pluginJsonFileName, int indentation, + bool usePragmaOnce, QString *header, QString *source) const { @@ -76,8 +58,10 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, // 1) Header const QString guard = Utils::headerGuard(headerFileName, namespaceList); - headerStr << "#ifndef " << guard - << "\n#define " << guard << '\n' << '\n'; + if (usePragmaOnce) + headerStr << "#pragma once\n\n"; + else + headerStr << "#ifndef " << guard << "\n#define " << guard << "\n\n"; if (!sharedHeader.isEmpty()) Utils::writeIncludeFileDirective(sharedHeader, false, headerStr); @@ -123,7 +107,9 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n"; headerStr << namespaceIndent << "};\n\n"; Utils::writeClosingNameSpaces(namespaceList, indent, headerStr); - headerStr << "#endif // "<< guard << '\n'; + if (!usePragmaOnce) + headerStr << "#endif // " << guard << '\n'; + /// 2) Source QTextStream sourceStr(source); @@ -152,12 +138,28 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, QString LibraryParameters::generateSharedHeader(const QString &globalHeaderFileName, const QString &projectTarget, - const QString &exportMacro) + const QString &exportMacro, + bool usePragmaOnce) { - QString contents = QLatin1String(globalHeaderContentsC); - contents.replace(QLatin1String(GUARD_VARIABLE), Utils::headerGuard(globalHeaderFileName)); - contents.replace(QLatin1String(EXPORT_MACRO_VARIABLE), exportMacro); - contents.replace(QLatin1String(LIBRARY_MACRO_VARIABLE), QtProjectParameters::libraryMacro(projectTarget)); + QString contents; + if (usePragmaOnce) { + contents += "#pragma once\n"; + } else { + contents += "#ifndef " + Utils::headerGuard(globalHeaderFileName) + "\n"; + contents += "#define " + Utils::headerGuard(globalHeaderFileName) + "\n"; + } + contents += "\n"; + contents += "#include <QtCore/qglobal.h>\n"; + contents += "\n"; + contents += "#if defined(" + QtProjectParameters::libraryMacro(projectTarget) + ")\n"; + contents += "# define " + exportMacro + " Q_DECL_EXPORT\n"; + contents += "#else\n"; + contents += "# define " + exportMacro + " Q_DECL_IMPORT\n"; + contents += "#endif\n"; + contents += "\n"; + if (!usePragmaOnce) + contents += "#endif // " + Utils::headerGuard(globalHeaderFileName) + '\n'; + return contents; } diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h index 760bb03365..1f74d780dc 100644 --- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h +++ b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.h @@ -44,13 +44,15 @@ struct LibraryParameters { const QString &exportMacro, const QString &pluginJsonFileName, int indentation, + bool usePragmaOnce, QString *header, QString *source) const; // Generate the code of the shared header containing the export macro static QString generateSharedHeader(const QString &globalHeaderFileName, const QString &projectTarget, - const QString &exportMacro); + const QString &exportMacro, + bool usePragmaOnce); QString className; QString baseClassName; diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp index 20b2c669a7..2db1313a31 100644 --- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp @@ -80,6 +80,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, const QtProjectParameters projectParams = dialog->parameters(); const QString projectPath = projectParams.projectPath(); const LibraryParameters params = dialog->libraryParameters(); + const bool usePragmaOnce = CppTools::AbstractEditorSupport::usePragmaOnce(); const QString sharedLibExportMacro = QtProjectParameters::exportMacro(projectParams.fileName); @@ -107,7 +108,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, Core::GeneratedFile globalHeader(globalHeaderName); globalHeaderFileName = Utils::FileName::fromString(globalHeader.path()).fileName(); globalHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(globalHeaderFileName) - + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro)); + + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro, usePragmaOnce)); rc.push_back(globalHeader); } @@ -115,7 +116,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, QString headerContents, sourceContents; params.generateCode(projectParams.type, projectParams.fileName, headerFileName, globalHeaderFileName, sharedLibExportMacro, pluginJsonFileName, - /* indentation*/ 4, &headerContents, &sourceContents); + /* indentation*/ 4, usePragmaOnce, &headerContents, &sourceContents); source.setContents(CppTools::AbstractEditorSupport::licenseTemplate(sourceFileName, params.className) + sourceContents); |