From a1e9064df37b4d82a239d86d1c4822b37d47f4d6 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 19 Aug 2009 13:47:26 +0200 Subject: make Qt Designer compile when Qt is configured with -no-script --- mkspecs/features/designer.prf | 3 ++- tools/designer/src/components/lib/lib.pro | 5 ++++- tools/designer/src/designer/designer.pro | 3 ++- tools/designer/src/lib/shared/qdesigner_formbuilder.cpp | 6 ++++++ tools/designer/src/lib/shared/qsimpleresource.cpp | 2 ++ tools/designer/src/lib/shared/scriptdialog.cpp | 6 ++++++ tools/designer/src/lib/shared/shared.pri | 2 +- tools/designer/src/lib/uilib/uilib.pri | 1 + 8 files changed, 24 insertions(+), 4 deletions(-) diff --git a/mkspecs/features/designer.prf b/mkspecs/features/designer.prf index 61a30cf..fa40caa 100644 --- a/mkspecs/features/designer.prf +++ b/mkspecs/features/designer.prf @@ -1,4 +1,5 @@ -QT += xml script +QT += xml +contains(QT_CONFIG, script): QT += script qt:load(qt) plugin:DEFINES += QDESIGNER_EXPORT_WIDGETS diff --git a/tools/designer/src/components/lib/lib.pro b/tools/designer/src/components/lib/lib.pro index 92cf387..8d0e692 100644 --- a/tools/designer/src/components/lib/lib.pro +++ b/tools/designer/src/components/lib/lib.pro @@ -64,7 +64,10 @@ PRECOMPILED_HEADER= lib_pch.h include(../../sharedcomponents.pri) include(../component.pri) -unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtDesigner QtGui QtScript QtXml +unix { + QMAKE_PKGCONFIG_REQUIRES = QtCore QtDesigner QtGui QtXml + contains(QT_CONFIG, script): QMAKE_PKGCONFIG_REQUIRES += QtScript +} target.path=$$[QT_INSTALL_LIBS] INSTALLS += target diff --git a/tools/designer/src/designer/designer.pro b/tools/designer/src/designer/designer.pro index aa6850c..2050c72 100644 --- a/tools/designer/src/designer/designer.pro +++ b/tools/designer/src/designer/designer.pro @@ -1,6 +1,7 @@ DESTDIR = ../../../../bin -QT += xml network script +QT += xml network +contains(QT_CONFIG, script): QT += script build_all:!build_pass { CONFIG -= build_all CONFIG += release diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp index 454439e..5e3a9b6 100644 --- a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp +++ b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp @@ -83,6 +83,7 @@ QT_BEGIN_NAMESPACE +#ifndef QT_FORMBUILDER_NO_SCRIPT static QString summarizeScriptErrors(const QFormScriptRunner::Errors &errors) { QString rc = QCoreApplication::translate("QDesignerFormBuilder", "Script errors occurred:"); @@ -92,6 +93,7 @@ static QString summarizeScriptErrors(const QFormScriptRunner::Errors &errors) } return rc; } +#endif namespace qdesigner_internal { @@ -108,6 +110,7 @@ QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core, m_mainWidget(true) { Q_ASSERT(m_core); +#ifndef QT_FORMBUILDER_NO_SCRIPT // Disable scripting in the editors. QFormScriptRunner::Options options = formScriptRunner()->options(); switch (m_mode) { @@ -120,6 +123,7 @@ QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core, break; } formScriptRunner()-> setOptions(options); +#endif } QString QDesignerFormBuilder::systemStyle() const @@ -400,6 +404,7 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface WidgetFactory::applyStyleToTopLevel(wf->getStyle(styleToUse), widget); } } +#ifndef QT_FORMBUILDER_NO_SCRIPT // Check for script errors *scriptErrors = builder.formScriptRunner()->errors(); if (!scriptErrors->empty()) { @@ -407,6 +412,7 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface delete widget; return 0; } +#endif // Fake application style sheet by prepending. (If this doesn't work, fake by nesting // into parent widget). if (!appStyleSheet.isEmpty()) { diff --git a/tools/designer/src/lib/shared/qsimpleresource.cpp b/tools/designer/src/lib/shared/qsimpleresource.cpp index 64e690f..3c7f032 100644 --- a/tools/designer/src/lib/shared/qsimpleresource.cpp +++ b/tools/designer/src/lib/shared/qsimpleresource.cpp @@ -81,8 +81,10 @@ QSimpleResource::QSimpleResource(QDesignerFormEditorInterface *core) : workingDirectory += QDir::separator(); workingDirectory += QLatin1String(".designer"); setWorkingDirectory(QDir(workingDirectory)); +#ifndef QT_FORMBUILDER_NO_SCRIPT // Disable scripting in the editors. formScriptRunner()-> setOptions(QFormScriptRunner::DisableScripts); +#endif } QSimpleResource::~QSimpleResource() diff --git a/tools/designer/src/lib/shared/scriptdialog.cpp b/tools/designer/src/lib/shared/scriptdialog.cpp index f46c40a..340bc82 100644 --- a/tools/designer/src/lib/shared/scriptdialog.cpp +++ b/tools/designer/src/lib/shared/scriptdialog.cpp @@ -49,7 +49,9 @@ #include #include #include +#ifdef QT_SCRIPT_LIB #include +#endif QT_BEGIN_NAMESPACE @@ -112,12 +114,16 @@ variables widget and childWidgets, respectively."); const QString script = trimmedScript(); if (script.isEmpty()) return true; +#ifdef QT_SCRIPT_LIB QScriptEngine scriptEngine; if (scriptEngine.canEvaluate(script)) return true; m_dialogGui->message(this, QDesignerDialogGuiInterface::ScriptDialogMessage, QMessageBox::Warning, windowTitle(), tr("Syntax error"), QMessageBox::Ok); return false; +#else + return true; +#endif } } // namespace qdesigner_internal diff --git a/tools/designer/src/lib/shared/shared.pri b/tools/designer/src/lib/shared/shared.pri index 8ed051a..570b208 100644 --- a/tools/designer/src/lib/shared/shared.pri +++ b/tools/designer/src/lib/shared/shared.pri @@ -1,6 +1,6 @@ INCLUDEPATH += $$PWD -QT += script +contains(QT_CONFIG, script): QT += script include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri) include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri) diff --git a/tools/designer/src/lib/uilib/uilib.pri b/tools/designer/src/lib/uilib/uilib.pri index cbf415b..2072fbc 100644 --- a/tools/designer/src/lib/uilib/uilib.pri +++ b/tools/designer/src/lib/uilib/uilib.pri @@ -2,6 +2,7 @@ INCLUDEPATH += $$PWD DEFINES += QT_DESIGNER +!contains(QT_CONFIG, script): DEFINES += QT_FORMBUILDER_NO_SCRIPT # Input HEADERS += \ -- cgit v0.12