Merge remote-tracking branch 'origin/3.2'

Conflicts:
	src/plugins/qmldesigner/designercore/model/plaintexteditmodifier.cpp
	src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp

Change-Id: I1627f6aa98a442413f8b08b579ecaf9647dc887b
This commit is contained in:
Eike Ziller
2014-09-16 15:17:21 +02:00
77 changed files with 3943 additions and 2355 deletions

48
dist/changes-3.2.1 vendored Normal file
View File

@@ -0,0 +1,48 @@
Qt Creator version 3.2.1 is a bugfix release.
The most important changes are listed in this document. For a complete
list of changes, see the Git log for the Qt Creator sources that
you can check out from the public Git repository. For example:
git clone git://gitorious.org/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline v3.2.0..v3.2.1
General
* Fixed freeze when using shortcut for all projects or current project
locator filters (QTCREATORBUG-12875)
* Fixed crash when activating timers by removing the unsupported UpdateInfo
plugin that triggered it (QTCREATORBUG-11262)
Qbs Projects
* Fixed adding and removing files when project file is write protected by VCS
* Fixed crash when removing empty install step
C++ Support
* Fixed crash when opening context menu on macro parameter (QTCREATORBUG-12853)
QML Support
* Added missing members to date objects
* Added templates for Qt Quick 2.3 and Qt Quick Controls 1.2 applications
* Fixed keyboard shortcuts in QML/JS console (QTCREATORBUG-12956)
Qt Quick Designer
* Added option to use fallback QML puppet and set it to be the default
* Fixed updating of color properties (QTCREATORBUG-12841)
* Fixed duplication of ApplicationWindow properties (QTCREATORBUG-12910)
Platform Specific
OS X
* Fixed deployment of Clang library in binary packages
* Fixed deployment of fallback QML puppets in binary packages
* Removed wrong File > Exit menu item
iOS
* Fixed determination of newest SDK version when no version is explicitly stated
Remote Linux
* Fixed mixed QML and C++ debugging (QTCREATORBUG-12928)
* Fixed check for maximum packet size for SSH connections (QTCREATORBUG-12884)
Windows Phone
* Fixed font deployment for Windows Phone 8.0

View File

@@ -75,8 +75,8 @@
\list \list
\li Select \gui {Qt Quick Controls 1.1} or \gui {Qt Quick 2.2} to \li Select \gui {Qt Quick Controls} or \gui {Qt Quick 2.1}, or
develop for platforms that run Qt 5. later, to develop for platforms that run Qt 5.
\li Select \gui {Qt Quick 1.1} to develop for platforms that run \li Select \gui {Qt Quick 1.1} to develop for platforms that run
Qt 4.7.4. To develop for platforms that run Qt 4.7.1, 4.7.2, or Qt 4.7.4. To develop for platforms that run Qt 4.7.1, 4.7.2, or

View File

@@ -17,11 +17,14 @@
****************************************************************************/ ****************************************************************************/
//! [0] //! [0]
\badcode
otool -L /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib otool -L /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib
\endcode
//! [0] //! [0]
//! [1] //! [1]
\badcode
/Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib: /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib:
libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0) libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0)
libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1) libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
@@ -33,14 +36,18 @@ otool -L /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dyli
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
\endcode
//! [1] //! [1]
//! [2] //! [2]
\badcode
otool -L /usr/local/qwt-5.2.1/lib/libqwt.5.dylib otool -L /usr/local/qwt-5.2.1/lib/libqwt.5.dylib
\endcode
//! [2] //! [2]
//! [3] //! [3]
\badcode
/usr/local/qwt-5.2.1/lib/libqwt.5.dylib: /usr/local/qwt-5.2.1/lib/libqwt.5.dylib:
libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1) libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2) QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
@@ -48,18 +55,22 @@ otool -L /usr/local/qwt-5.2.1/lib/libqwt.5.dylib
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
\endcode
//! [3] //! [3]
//! [4] //! [4]
\badcode
sudo cp /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib \ sudo cp /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib \
/Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
sudo cp -R /usr/local/qwt-5.2.1/lib/* \ sudo cp -R /usr/local/qwt-5.2.1/lib/* \
/Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks/ /Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks/
\endcode
//! [4] //! [4]
//! [5] //! [5]
\badcode
cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
sudo install_name_tool -change sudo install_name_tool -change
QtCore.framework/Versions/4/QtCore \ QtCore.framework/Versions/4/QtCore \
@@ -90,4 +101,6 @@ sudo install_name_tool -change \
QtGui.framework/Versions/4/QtGui \ QtGui.framework/Versions/4/QtGui \
@executable_path/../Frameworks/libQtGui.4.dylib \ @executable_path/../Frameworks/libQtGui.4.dylib \
libqwt.5.2.1.dylib libqwt.5.2.1.dylib
\endcode
//! [5] //! [5]

View File

@@ -85,13 +85,13 @@
\li To check the paths used in the Qwt library, enter the following \li To check the paths used in the Qwt library, enter the following
\c otool command: \c otool command:
\snippet doc_src_plugins.qdoc 0 \include doc_src_plugins.qdocinc 0
The output for Qwt 5.2.1 indicates that the plugin uses Qt core The output for Qwt 5.2.1 indicates that the plugin uses Qt core
libraries (QtDesigner, QtScript, QtXml, QtGui and QtCore) and libraries (QtDesigner, QtScript, QtXml, QtGui and QtCore) and
libqwt.5.dylib: libqwt.5.dylib:
\snippet doc_src_plugins.qdoc 1 \include doc_src_plugins.qdocinc 1
\li You must copy the \QD plugin and the Qwt library files to the \li You must copy the \QD plugin and the Qwt library files to the
@@ -108,21 +108,21 @@
Enter the following commands: Enter the following commands:
\snippet doc_src_plugins.qdoc 4 \include doc_src_plugins.qdocinc 4
\li Enter the following \c otool command to check the libraries that are \li Enter the following \c otool command to check the libraries that are
used by the Qwt library: used by the Qwt library:
\snippet doc_src_plugins.qdoc 2 \include doc_src_plugins.qdocinc 2
The command returns the following output: The command returns the following output:
\snippet doc_src_plugins.qdoc 3 \include doc_src_plugins.qdocinc 3
\li Enter the following \c install_name_tool command to fix the \li Enter the following \c install_name_tool command to fix the
references of the libraries: references of the libraries:
\snippet doc_src_plugins.qdoc 5 \include doc_src_plugins.qdocinc 5
\endlist \endlist

View File

@@ -24,12 +24,12 @@ if [ -d "$5" ]; then
fi fi
qmlpuppetapp="$1/Contents/MacOS/qmlpuppet" qmlpuppetapp="$1/Contents/MacOS/qmlpuppet"
if [ -d "$qmlpuppetapp" ]; then if [ -f "$qmlpuppetapp" ]; then
qmlpuppetArgument="-executable=$qmlpuppetapp" qmlpuppetArgument="-executable=$qmlpuppetapp"
fi fi
qml2puppetapp="$1/Contents/MacOS/qml2puppet" qml2puppetapp="$1/Contents/MacOS/qml2puppet"
if [ -d "$qml2puppetapp" ]; then if [ -f "$qml2puppetapp" ]; then
qml2puppetArgument="-executable=$qml2puppetapp" qml2puppetArgument="-executable=$qml2puppetapp"
fi fi

View File

@@ -13,6 +13,12 @@ Rectangle {
onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } } onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } }
onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } } onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } }
property int maximumWidth: 0
property int minimumWidth: 0
property int maximumHeight: 0
property int minimumHeight: 0
Item { Item {
id: contentArea id: contentArea
anchors.top: toolBarArea.bottom anchors.top: toolBarArea.bottom

View File

@@ -475,33 +475,21 @@ PropertyNameList ObjectNodeInstance::ignoredProperties() const
QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name) QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name)
{ {
int idx = object()->metaObject()->indexOfProperty(name); Q_ASSERT(value.canConvert<Enumeration>());
QMetaProperty metaProperty = object()->metaObject()->property(idx); int propertyIndex = object()->metaObject()->indexOfProperty(name);
QMetaProperty metaProperty = object()->metaObject()->property(propertyIndex);
QVariant fixedValue = fixResourcePaths(value); QVariant adjustedValue;
Enumeration enumeration = value.value<Enumeration>();
if (value.canConvert<Enumeration>()) { if (metaProperty.isValid() && metaProperty.isEnumType()) {
Enumeration enumeration = value.value<Enumeration>(); adjustedValue = metaProperty.enumerator().keyToValue(enumeration.name());
if (metaProperty.isValid() && metaProperty.isEnumType()) { } else {
fixedValue = metaProperty.enumerator().keyToValue(enumeration.name()); QQmlExpression expression(context(), object(), enumeration.toString());
} else if (metaProperty.isValid() adjustedValue = expression.evaluate();
&& (QLatin1String(metaProperty.typeName()) == QLatin1String("int"))) { if (expression.hasError())
qDebug() << "Enumeration can not be evaluated:" << object() << name << enumeration;
//If the target property is an integer handle an enum as binding
QQmlExpression expression(context(), object(), enumeration.toString());
fixedValue = expression.evaluate();
if (expression.hasError())
qDebug() << "Enum can not be evaluated:" << object() << name << enumeration;
} else if (!metaProperty.isValid()) { //In this case this is most likely an attached property
QQmlExpression expression(context(), object(), enumeration.toString());
fixedValue = expression.evaluate();
if (expression.hasError())
qDebug() << "Enum can not be evaluated:" << object() << name << enumeration;
}
} }
return adjustedValue;
return fixedValue;
} }
void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value) void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value)
@@ -514,8 +502,12 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
if (!property.isValid()) if (!property.isValid())
return; return;
QVariant fixedValue = fixResourcePaths(value); QVariant adjustedValue;
fixedValue = convertEnumToValue(fixedValue, name); if (value.canConvert<Enumeration>())
adjustedValue = convertEnumToValue(value, name);
else
adjustedValue = fixResourcePaths(value);
QVariant oldValue = property.read(); QVariant oldValue = property.read();
if (oldValue.type() == QVariant::Url) { if (oldValue.type() == QVariant::Url) {
@@ -529,10 +521,10 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
QQmlPropertyPrivate::setBinding(property, 0, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding); QQmlPropertyPrivate::setBinding(property, 0, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
} }
bool isWritten = property.write(convertSpecialCharacter(fixedValue)); bool isWritten = property.write(convertSpecialCharacter(adjustedValue));
if (!isWritten) if (!isWritten)
qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << fixedValue; qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << adjustedValue;
QVariant newValue = property.read(); QVariant newValue = property.read();
if (newValue.type() == QVariant::Url) { if (newValue.type() == QVariant::Url) {

View File

@@ -57,7 +57,8 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.verticalCentered = false; if (anchorBackend.bottomAnchored)
anchorBackend.verticalCentered = false;
anchorBackend.topAnchored = true; anchorBackend.topAnchored = true;
} else { } else {
anchorBackend.topAnchored = false; anchorBackend.topAnchored = false;
@@ -75,7 +76,8 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.verticalCentered = false; if (anchorBackend.topAnchored)
anchorBackend.verticalCentered = false;
anchorBackend.bottomAnchored = true; anchorBackend.bottomAnchored = true;
} else { } else {
anchorBackend.bottomAnchored = false; anchorBackend.bottomAnchored = false;
@@ -94,7 +96,8 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.horizontalCentered = false; if (anchorBackend.rightAnchored)
anchorBackend.horizontalCentered = false;
anchorBackend.leftAnchored = true; anchorBackend.leftAnchored = true;
} else { } else {
anchorBackend.leftAnchored = false; anchorBackend.leftAnchored = false;
@@ -112,7 +115,8 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.horizontalCentered = false; if (anchorBackend.leftAnchored)
anchorBackend.horizontalCentered = false;
anchorBackend.rightAnchored = true; anchorBackend.rightAnchored = true;
} else { } else {
anchorBackend.rightAnchored = false; anchorBackend.rightAnchored = false;
@@ -156,8 +160,10 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.topAnchored = false; if (anchorBackend.topAnchored && anchorBackend.bottomAnchored) {
anchorBackend.bottomAnchored = false; anchorBackend.topAnchored = false;
anchorBackend.bottomAnchored = false;
}
anchorBackend.verticalCentered = true; anchorBackend.verticalCentered = true;
} else { } else {
anchorBackend.verticalCentered = false; anchorBackend.verticalCentered = false;
@@ -175,8 +181,10 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.leftAnchored = false; if (anchorBackend.leftAnchored && anchorBackend.rightAnchored) {
anchorBackend.rightAnchored = false; anchorBackend.leftAnchored = false;
anchorBackend.rightAnchored = false;
}
anchorBackend.horizontalCentered = true; anchorBackend.horizontalCentered = true;
} else { } else {
anchorBackend.horizontalCentered = false; anchorBackend.horizontalCentered = false;

View File

@@ -6,6 +6,7 @@ SpinBox {
maximumValue: 9999999 maximumValue: 9999999
minimumValue: -9999999 minimumValue: -9999999
decimals: 2 decimals: 2
stepSize: 0.1
backendValue: backendValues.%2 backendValue: backendValues.%2
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: 100 Layout.maximumWidth: 100

View File

@@ -22,8 +22,9 @@ AutoTypes {
typeNames: ["bool", "boolean"] typeNames: ["bool", "boolean"]
sourceFile: "BooleanEditorTemplate.template" sourceFile: "BooleanEditorTemplate.template"
} }
Type { Type {
typeNames: ["color", "QColor"] typeNames: ["color", "QColor"]
sourceFile: "ColorEditorTemplate.template" sourceFile: "StringEditorTemplate.template"
} }
} }

View File

@@ -47,8 +47,8 @@ Column {
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.spacing backendValue: backendValues.spacing
minimumValue: 0 minimumValue: -4000
maximumValue: 2000 maximumValue: 4000
decimals: 0 decimals: 0
} }

View File

@@ -78,8 +78,8 @@ Column {
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.spacing backendValue: backendValues.spacing
minimumValue: 0 minimumValue: -4000
maximumValue: 2000 maximumValue: 4000
decimals: 0 decimals: 0
} }

View File

@@ -109,8 +109,8 @@ Column {
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.spacing backendValue: backendValues.spacing
minimumValue: 0 minimumValue: -4000
maximumValue: 2000 maximumValue: 4000
decimals: 0 decimals: 0
} }

View File

@@ -61,8 +61,8 @@ Column {
SecondColumnLayout { SecondColumnLayout {
SpinBox { SpinBox {
backendValue: backendValues.spacing backendValue: backendValues.spacing
minimumValue: 0 minimumValue: -4000
maximumValue: 2000 maximumValue: 4000
decimals: 0 decimals: 0
} }

View File

@@ -1,4 +1,4 @@
/* File generated by Qt Creator, version 2.7.0 */ /* File generated by Qt Creator */
import QmlProject 1.1 import QmlProject 1.1

View File

@@ -1,4 +1,4 @@
/* File generated by Qt Creator, version 2.7.0 */ /* File generated by Qt Creator */
import QmlProject 1.1 import QmlProject 1.1

View File

@@ -1,4 +1,4 @@
/* File generated by Qt Creator, version 2.7.0 */ /* File generated by Qt Creator */
import QmlProject 1.1 import QmlProject 1.1

View File

@@ -1,4 +1,4 @@
/* File generated by Qt Creator, version 2.7.0 */ /* File generated by Qt Creator */
import QmlProject 1.1 import QmlProject 1.1

View File

@@ -1,4 +1,4 @@
/* File generated by Qt Creator, version 2.7.0 */ /* File generated by Qt Creator */
import QmlProject 1.1 import QmlProject 1.1

File diff suppressed because it is too large Load Diff

View File

@@ -525,10 +525,24 @@ public:
} }
}; };
class UnsupportedRootObjectTypesByVisualDesigner : public QStringList
{
public:
UnsupportedRootObjectTypesByVisualDesigner()
{
(*this) << QLatin1String("QtObject") << QLatin1String("ListModel")
<< QLatin1String("Component") << QLatin1String("Timer")
<< QLatin1String("Package");
}
};
} // end of anonymous namespace } // end of anonymous namespace
Q_GLOBAL_STATIC(VisualAspectsPropertyBlackList, visualAspectsPropertyBlackList) Q_GLOBAL_STATIC(VisualAspectsPropertyBlackList, visualAspectsPropertyBlackList)
Q_GLOBAL_STATIC(UnsupportedTypesByVisualDesigner, unsupportedTypesByVisualDesigner) Q_GLOBAL_STATIC(UnsupportedTypesByVisualDesigner, unsupportedTypesByVisualDesigner)
Q_GLOBAL_STATIC(UnsupportedRootObjectTypesByVisualDesigner, unsupportedRootObjectTypesByVisualDesigner)
Check::Check(Document::Ptr doc, const ContextPtr &context) Check::Check(Document::Ptr doc, const ContextPtr &context)
: _doc(doc) : _doc(doc)
@@ -559,6 +573,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
disableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner); disableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner);
disableMessage(WarnUndefinedValueForVisualDesigner); disableMessage(WarnUndefinedValueForVisualDesigner);
disableMessage(WarnStatesOnlyInRootItemForVisualDesigner); disableMessage(WarnStatesOnlyInRootItemForVisualDesigner);
disableMessage(ErrUnsupportedRootTypeInVisualDesigner);
} }
Check::~Check() Check::~Check()
@@ -729,6 +744,13 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State")) if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State"))
addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation); addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation);
const QString typeName = getRightMostIdentifier(typeId)->name.toString();
if (m_typeStack.isEmpty()
&& unsupportedRootObjectTypesByVisualDesigner()->contains(typeName))
addMessage(ErrUnsupportedRootTypeInVisualDesigner,
locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()), typeName);
bool typeError = false; bool typeError = false;
if (_importsOk) { if (_importsOk) {
const ObjectValue *prototype = _context->lookupType(_doc.data(), typeId); const ObjectValue *prototype = _context->lookupType(_doc.data(), typeId);

View File

@@ -1361,6 +1361,8 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
res.maybeAddPath(pAndL.path().toString()); res.maybeAddPath(pAndL.path().toString());
} }
} }
foreach (const QString &path, environmentImportPaths())
res.maybeAddPath(path);
break; break;
} }
case Dialect::NoLanguage: case Dialect::NoLanguage:
@@ -1385,6 +1387,11 @@ ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
|| res.language == Dialect::QmlQtQuick1) || res.language == Dialect::QmlQtQuick1)
res.maybeAddPath(info.qtQmlPath); res.maybeAddPath(info.qtQmlPath);
if (res.language == Dialect::AnyLanguage || res.language == Dialect::Qml
|| res.language == Dialect::QmlQtQuick1 || res.language == Dialect::QmlQtQuick2) {
foreach (const QString &path, environmentImportPaths())
res.maybeAddPath(path);
}
break; break;
} }
res.flags = ViewerContext::Complete; res.flags = ViewerContext::Complete;

View File

@@ -221,6 +221,8 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("Qt Quick Designer only supports states in the root item.")); tr("Qt Quick Designer only supports states in the root item."));
newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning, newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning,
tr("Using Qt Quick 1 code model instead of Qt Quick 2.")); tr("Using Qt Quick 1 code model instead of Qt Quick 2."));
newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error,
tr("This type is not supported as a root element by Qt Quick Designer %1."), 1);
} }
} // anonymous namespace } // anonymous namespace

View File

@@ -97,6 +97,7 @@ enum Type
WarnReferenceToParentItemNotSupportedByVisualDesigner = 205, WarnReferenceToParentItemNotSupportedByVisualDesigner = 205,
WarnUndefinedValueForVisualDesigner = 206, WarnUndefinedValueForVisualDesigner = 206,
WarnStatesOnlyInRootItemForVisualDesigner = 207, WarnStatesOnlyInRootItemForVisualDesigner = 207,
ErrUnsupportedRootTypeInVisualDesigner = 208,
ErrUnknownComponent = 300, ErrUnknownComponent = 300,
ErrCouldNotResolvePrototypeOf = 301, ErrCouldNotResolvePrototypeOf = 301,
ErrCouldNotResolvePrototype = 302, ErrCouldNotResolvePrototype = 302,

View File

@@ -302,6 +302,9 @@ void SftpChannelPrivate::handleExitStatus(const SshChannelExitStatus &exitStatus
qDebug("Remote SFTP service exited with exit code %d", exitStatus.exitStatus); qDebug("Remote SFTP service exited with exit code %d", exitStatus.exitStatus);
#endif #endif
if (channelState() == CloseRequested || channelState() == Closed)
return;
emit channelError(tr("The SFTP server finished unexpectedly with exit code %1.") emit channelError(tr("The SFTP server finished unexpectedly with exit code %1.")
.arg(exitStatus.exitStatus)); .arg(exitStatus.exitStatus));

View File

@@ -39,7 +39,10 @@
namespace QSsh { namespace QSsh {
namespace Internal { namespace Internal {
const quint32 MinMaxPacketSize = 32768; // "Payload length" (RFC 4253, 6.1), i.e. minus packet type, channel number
// and length field for string.
const quint32 MinMaxPacketSize = 32768 - sizeof(quint32) - sizeof(quint32) - 1;
const quint32 NoChannel = 0xffffffffu; const quint32 NoChannel = 0xffffffffu;
AbstractSshChannel::AbstractSshChannel(quint32 channelId, AbstractSshChannel::AbstractSshChannel(quint32 channelId,
@@ -151,8 +154,7 @@ void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
#endif #endif
m_remoteChannel = remoteChannelId; m_remoteChannel = remoteChannelId;
m_remoteWindowSize = remoteWindowSize; m_remoteWindowSize = remoteWindowSize;
m_remoteMaxPacketSize = remoteMaxPacketSize - sizeof(quint32) - sizeof m_remoteChannel - 1; m_remoteMaxPacketSize = remoteMaxPacketSize;
// Original value includes packet type, channel number and length field for string.
setChannelState(SessionEstablished); setChannelState(SessionEstablished);
handleOpenSuccessInternal(); handleOpenSuccessInternal();
} }

View File

@@ -239,6 +239,8 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
} }
} }
cursor.endEditBlock();
// adjust selection when commenting out // adjust selection when commenting out
if (hasSelection && !doMultiLineStyleUncomment && !doSingleLineStyleUncomment) { if (hasSelection && !doMultiLineStyleUncomment && !doSingleLineStyleUncomment) {
cursor = edit->textCursor(); cursor = edit->textCursor();
@@ -254,6 +256,4 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
} }
edit->setTextCursor(cursor); edit->setTextCursor(cursor);
} }
cursor.endEditBlock();
} }

View File

@@ -1562,11 +1562,6 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
QFileInfo fi(workingDir, fileName); QFileInfo fi(workingDir, fileName);
QString topLevel = currentState().topLevel(); QString topLevel = currentState().topLevel();
QString absPath = fi.absoluteFilePath(); QString absPath = fi.absoluteFilePath();
const QString relFile = QDir(topLevel).relativeFilePath(absPath);
const QString file = QDir::toNativeSeparators(relFile);
const QString title = QString::fromLatin1("Checkout %1").arg(file);
CheckOutDialog coDialog(title, m_viewData.isUcm);
if (!m_settings.disableIndexer && if (!m_settings.disableIndexer &&
(fi.isWritable() || vcsStatus(absPath).status == FileStatus::Unknown)) (fi.isWritable() || vcsStatus(absPath).status == FileStatus::Unknown))
@@ -1575,6 +1570,12 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
QMessageBox::information(0, tr("ClearCase Checkout"), tr("File is already checked out.")); QMessageBox::information(0, tr("ClearCase Checkout"), tr("File is already checked out."));
return true; return true;
} }
const QString relFile = QDir(topLevel).relativeFilePath(absPath);
const QString file = QDir::toNativeSeparators(relFile);
const QString title = QString::fromLatin1("Checkout %1").arg(file);
CheckOutDialog coDialog(title, m_viewData.isUcm);
// Only snapshot views can have hijacked files // Only snapshot views can have hijacked files
bool isHijacked = (!m_viewData.isDynamic && (vcsStatus(absPath).status & FileStatus::Hijacked)); bool isHijacked = (!m_viewData.isDynamic && (vcsStatus(absPath).status & FileStatus::Hijacked));
if (!isHijacked) if (!isHijacked)
@@ -1591,9 +1592,11 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
else else
args << QLatin1String("-c") << comment; args << QLatin1String("-c") << comment;
args << QLatin1String("-query"); args << QLatin1String("-query");
if (coDialog.isReserved()) const bool reserved = coDialog.isReserved();
const bool unreserved = !reserved || coDialog.isUnreserved();
if (reserved)
args << QLatin1String("-reserved"); args << QLatin1String("-reserved");
if (coDialog.isUnreserved()) if (unreserved)
args << QLatin1String("-unreserved"); args << QLatin1String("-unreserved");
if (coDialog.isPreserveTime()) if (coDialog.isPreserveTime())
args << QLatin1String("-ptime"); args << QLatin1String("-ptime");

View File

@@ -287,7 +287,8 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
QStringList views = settings->value(viewsKey).toStringList(); QStringList views = settings->value(viewsKey).toStringList();
if (views.count()) { if (views.count()) {
foreach (const QString &id, views) foreach (const QString &id, views)
insertSideBarWidget(d->m_widgets.count(), id); if (availableItemIds().contains(id))
insertSideBarWidget(d->m_widgets.count(), id);
} else { } else {
insertSideBarWidget(0); insertSideBarWidget(0);

View File

@@ -190,11 +190,11 @@ static void collectFilesForProject(const qbs::ProjectData &project, QSet<QString
QStringList QbsProject::files(Project::FilesMode fileMode) const QStringList QbsProject::files(Project::FilesMode fileMode) const
{ {
Q_UNUSED(fileMode); Q_UNUSED(fileMode);
if (!m_rootProjectNode || !m_rootProjectNode->qbsProjectData().isValid()) if (!m_qbsProject.isValid() || isParsing())
return QStringList(); return QStringList();
QSet<QString> result; QSet<QString> result;
collectFilesForProject(m_rootProjectNode->qbsProjectData(), result); collectFilesForProject(m_projectData, result);
result.unite(qbsProject().buildSystemFiles()); result.unite(m_qbsProject.buildSystemFiles());
return result.toList(); return result.toList();
} }

View File

@@ -302,7 +302,8 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
if (project) { if (project) {
const qbs::ProductData product = findProduct(project->qbsProjectData(), m_qbsProduct); const qbs::ProductData product = findProduct(project->qbsProjectData(), m_qbsProduct);
if (product.isValid()) { if (product.isValid()) {
qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product, env.toProcessEnvironment(), QbsManager::settings()); qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product, installOptions(),
env.toProcessEnvironment(), QbsManager::settings());
QProcessEnvironment procEnv = qbsRunEnv.runEnvironment(); QProcessEnvironment procEnv = qbsRunEnv.runEnvironment();
if (!procEnv.isEmpty()) { if (!procEnv.isEmpty()) {
env = Utils::Environment(); env = Utils::Environment();

View File

@@ -363,33 +363,6 @@ static void findTargetItem(const NodeListProperty &listProperty,
} }
} }
static void moveItemRow(QStandardItem *targetItem ,
int currentRowNumber,
int newRowNumber)
{
if (targetItem && currentRowNumber != newRowNumber) {//### Items without a parent should not exist
QList<QStandardItem*> items = targetItem->takeRow(currentRowNumber);
targetItem->insertRow(newRowNumber, items);
}
}
/**
Updates the sibling position of the item, depending on the position in the model.
*/
void NavigatorTreeModel::updateItemRowOrder(const NodeListProperty &listProperty, const ModelNode &modelNode, int /*oldIndex*/)
{
if (isInTree(modelNode)) {
ItemRow currentItemRow = itemRowForNode(modelNode);
int currentRowNumber = currentItemRow.idItem->row();
int newRowNumber = listProperty.indexOf(modelNode);
QStandardItem *targetItem = 0;
findTargetItem(listProperty, currentItemRow, this, &newRowNumber, &targetItem);
moveItemRow(targetItem, currentRowNumber, newRowNumber);
}
}
static void handleWrongId(QStandardItem *item, const ModelNode &modelNode, const QString &errorTitle, const QString &errorMessage, NavigatorTreeModel *treeModel) static void handleWrongId(QStandardItem *item, const ModelNode &modelNode, const QString &errorTitle, const QString &errorMessage, NavigatorTreeModel *treeModel)
{ {
QMessageBox::warning(Core::ICore::dialogParent(), errorTitle, errorMessage); QMessageBox::warning(Core::ICore::dialogParent(), errorTitle, errorMessage);
@@ -551,8 +524,10 @@ static QList<QStandardItem*> takeWholeRow(const ItemRow &itemRow)
{ {
if (itemRow.idItem->parent()) if (itemRow.idItem->parent())
return itemRow.idItem->parent()->takeRow(itemRow.idItem->row()); return itemRow.idItem->parent()->takeRow(itemRow.idItem->row());
else else if (itemRow.idItem->model())
return itemRow.idItem->model()->takeRow(itemRow.idItem->row()); return itemRow.idItem->model()->takeRow(itemRow.idItem->row());
else
return itemRow.toList();
} }
void NavigatorTreeModel::removeSubTree(const ModelNode &node) void NavigatorTreeModel::removeSubTree(const ModelNode &node)

View File

@@ -114,7 +114,6 @@ public:
void addSubTree(const ModelNode &node); void addSubTree(const ModelNode &node);
void removeSubTree(const ModelNode &node); void removeSubTree(const ModelNode &node);
void updateItemRow(const ModelNode &node); void updateItemRow(const ModelNode &node);
void updateItemRowOrder(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
void setId(const QModelIndex &index, const QString &id); void setId(const QModelIndex &index, const QString &id);
void setVisible(const QModelIndex &index, bool visible); void setVisible(const QModelIndex &index, bool visible);

View File

@@ -296,8 +296,13 @@ void NavigatorView::instancesToken(const QString &/*tokenName*/, int /*tokenNumb
void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex) void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex)
{ {
if (m_treeModel->isInTree(node)) if (m_treeModel->isInTree(node)) {
m_treeModel->updateItemRowOrder(listProperty, node, oldIndex); m_treeModel->removeSubTree(listProperty.parentModelNode());
if (node.isInHierarchy())
m_treeModel->addSubTree(listProperty.parentModelNode());
}
} }
void NavigatorView::changeToComponent(const QModelIndex &index) void NavigatorView::changeToComponent(const QModelIndex &index)

View File

@@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.1
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
ComboBox {
backendValue: backendValues.orientation
implicitWidth: 180
model: [ "Horizontal", "Vertical" ]
scope: "Qt"
}

View File

@@ -0,0 +1,147 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import HelperWidgets 2.0
import QtQuick 2.1
import QtQuick.Layouts 1.1
Section {
caption: "Slider"
SectionLayout {
Label {
text: qsTr("Value")
toolTip: qsTr("Current value of the Slider. The default value is 0.0.")
}
SecondColumnLayout {
SpinBox {
maximumValue: backendValues.maximumValue.value
minimumValue: backendValues.minimumValue.value
decimals: 2
stepSize: backendValues.stepSize.value
backendValue: backendValues.value
implicitWidth: 180
}
ExpandingSpacer {}
}
Label {
text: qsTr("Maximum value")
toolTip: qsTr("Maximum value of the slider. The default value is 1.0.")
}
SecondColumnLayout {
SpinBox {
maximumValue: 9999999
minimumValue: -9999999
decimals: 2
backendValue: backendValues.maximumValue
implicitWidth: 180
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Minimum value")
toolTip: qsTr("Minimum value of the slider. The default value is 0.0.")
}
SecondColumnLayout {
SpinBox {
maximumValue: 9999999
minimumValue: -9999999
decimals: 2
backendValue: backendValues.minimumValue
implicitWidth: 180
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Orientation")
toolTip: qsTr("Layout orientation of the slider.")
}
SecondColumnLayout {
OrientationCombobox {
}
ExpandingSpacer {
}
}
Label {
text: qsTr("Step size")
toolTip: qsTr("Indicates the slider step size.")
}
SecondColumnLayout {
SpinBox {
maximumValue: 9999999
minimumValue: -9999999
decimals: 2
backendValue: backendValues.stepSize
implicitWidth: 180
}
ExpandingSpacer {}
}
Label {
text: qsTr("Active focus on press")
toolTip: qsTr("Indicates whether the slider should receive active focus when pressed.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.activeFocusOnPress.valueToString
backendValue: backendValues.activeFocusOnPress
implicitWidth: 180
}
ExpandingSpacer {}
}
Label {
text: qsTr("Tick marks enabled")
toolTip: qsTr("Indicates whether the slider should display tick marks at step intervals.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.tickmarksEnabled.valueToString
backendValue: backendValues.tickmarksEnabled
implicitWidth: 180
}
ExpandingSpacer {}
}
Label {
text: qsTr("Update value while dragging")
toolTip: qsTr("Determines whether the current value should be updated while the user is moving the slider handle, or only when the button has been released.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.updateValueWhileDragging.valueToString
backendValue: backendValues.updateValueWhileDragging
implicitWidth: 180
}
}
}
}

View File

@@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.1
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
Column {
anchors.left: parent.left
anchors.right: parent.right
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Split View")
SectionLayout {
Label {
text: qsTr("Orientation")
toolTip: qsTr("Orientation of the split view.")
}
SecondColumnLayout {
OrientationCombobox {
}
ExpandingSpacer {
}
}
}
}
}

View File

@@ -171,7 +171,7 @@ MetaInfo {
libraryIcon: ":/componentsplugin/images/sliderh.png" libraryIcon: ":/componentsplugin/images/sliderh.png"
version: "1.0" version: "1.0"
requiredImport: "QtQuick.Controls" requiredImport: "QtQuick.Controls"
Property { name: "orientation"; type: "int"; value: "0"; } Property { name: "orientation"; type: "Enumeration"; value: "Qt.Vertical"; }
} }
} }

View File

@@ -46,5 +46,8 @@
<file>Controls/TabViewSpecifics.qml</file> <file>Controls/TabViewSpecifics.qml</file>
<file>Controls/TabPositionComboBox.qml</file> <file>Controls/TabPositionComboBox.qml</file>
<file>Controls/CurrentIndexComboBox.qml</file> <file>Controls/CurrentIndexComboBox.qml</file>
<file>Controls/SplitViewSpecifics.qml</file>
<file>Controls/SliderSpecifics.qml</file>
<file>Controls/OrientationCombobox.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -58,8 +58,6 @@ public:
virtual void deactivateChangeSignals(); virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals(); virtual void reactivateChangeSignals();
virtual QStringList importPaths() const;
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; } virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }
public slots: public slots:

View File

@@ -73,8 +73,6 @@ public:
virtual void deactivateChangeSignals(); virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals(); virtual void reactivateChangeSignals();
virtual QStringList importPaths() const;
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; } virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }
protected: protected:

View File

@@ -41,7 +41,6 @@ namespace PropertyParser {
QVariant read(const QString &typeStr, const QString &str, const MetaInfo &metaInfo); QVariant read(const QString &typeStr, const QString &str, const MetaInfo &metaInfo);
QVariant read(const QString &typeStr, const QString &str); QVariant read(const QString &typeStr, const QString &str);
QVariant read(int variantType, const QString &str); QVariant read(int variantType, const QString &str);
QString write(const QVariant &variant, const MetaInfo &metaInfo);
QVariant variantFromString(const QString &s); QVariant variantFromString(const QString &s);
} // namespace PropertyParser } // namespace PropertyParser

View File

@@ -203,6 +203,8 @@ public:
QString pathForImport(const Import &import); QString pathForImport(const Import &import);
QStringList importDirectories() const;
signals: signals:
void errorsChanged(const QList<RewriterView::Error> &errors); void errorsChanged(const QList<RewriterView::Error> &errors);

View File

@@ -84,7 +84,6 @@ public:
virtual void reactivateChangeSignals() = 0; virtual void reactivateChangeSignals() = 0;
static QmlJS::Snapshot qmljsSnapshot(); static QmlJS::Snapshot qmljsSnapshot();
virtual QStringList importPaths() const = 0;
virtual bool renameId(const QString &oldId, const QString &newId) = 0; virtual bool renameId(const QString &oldId, const QString &newId) = 0;

View File

@@ -331,7 +331,8 @@ QString PuppetCreator::qmlPuppetPath(PuppetType puppetType) const
QProcessEnvironment PuppetCreator::processEnvironment() const QProcessEnvironment PuppetCreator::processEnvironment() const
{ {
Utils::Environment environment = Utils::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
m_kit->addToEnvironment(environment); if (!useOnlyFallbackPuppet())
m_kit->addToEnvironment(environment);
environment.set("QML_BAD_GUI_RENDER_LOOP", "true"); environment.set("QML_BAD_GUI_RENDER_LOOP", "true");
environment.set("QML_USE_MOCKUPS", "true"); environment.set("QML_USE_MOCKUPS", "true");
environment.set("QML_PUPPET_MODE", "true"); environment.set("QML_PUPPET_MODE", "true");

View File

@@ -128,6 +128,3 @@ void ComponentTextModifier::reactivateChangeSignals()
void ComponentTextModifier::contentsChange(int /*position*/, int /*charsRemoved*/, int /*charsAdded*/) void ComponentTextModifier::contentsChange(int /*position*/, int /*charsRemoved*/, int /*charsAdded*/)
{ {
} }
QStringList ComponentTextModifier::importPaths() const
{ return m_originalModifier->importPaths(); }

View File

@@ -61,6 +61,8 @@
#include "invalididexception.h" #include "invalididexception.h"
#include "textmodifier.h" #include "textmodifier.h"
#include <qmljs/qmljsmodelmanagerinterface.h>
/*! /*!
\defgroup CoreModel \defgroup CoreModel
*/ */
@@ -1823,6 +1825,9 @@ QString Model::pathForImport(const Import &import)
QStringList Model::importPaths() const QStringList Model::importPaths() const
{ {
if (rewriterView())
return rewriterView()->importDirectories();
QStringList importPathList; QStringList importPathList;
QString documentDirectoryPath = QFileInfo(fileUrl().toLocalFile()).absolutePath(); QString documentDirectoryPath = QFileInfo(fileUrl().toLocalFile()).absolutePath();
@@ -1830,10 +1835,6 @@ QStringList Model::importPaths() const
if (!documentDirectoryPath.isEmpty()) if (!documentDirectoryPath.isEmpty())
importPathList.append(documentDirectoryPath); importPathList.append(documentDirectoryPath);
if (textModifier()) {
importPathList.append(textModifier()->importPaths());
}
return importPathList; return importPathList;
} }

View File

@@ -196,17 +196,3 @@ void PlainTextEditModifier::reactivateChangeSignals()
emit textChanged(); emit textChanged();
} }
} }
QStringList PlainTextEditModifier::importPaths() const
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager && textDocument()) {
QString documentFilePath = textDocument()->baseUrl().toLocalFile();
if (!documentFilePath.isEmpty()) {
QmlJS::Document::Ptr qmljsDocument = modelManager->snapshot().document(documentFilePath);
return modelManager->defaultVContext(QmlJS::Dialect::Qml, qmljsDocument, true).paths;
}
}
return QStringList();
}

View File

@@ -28,6 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "propertyparser.h" #include "propertyparser.h"
#include "enumeration.h"
#include <modelnode.h> #include <modelnode.h>
#include <metainfo.h> #include <metainfo.h>
@@ -178,6 +179,15 @@ QVector3D vector3DFromString(const QString &s, bool *ok)
return QVector3D(xCoord, yCoord, zCoord); return QVector3D(xCoord, yCoord, zCoord);
} }
QmlDesigner::Enumeration enumerationFromString(const QString &string, bool *ok)
{
QmlDesigner::Enumeration tEnumeration(string);
if (ok)
*ok = !tEnumeration.scope().isEmpty() && !tEnumeration.name().isEmpty();
return tEnumeration;
}
} //namespace } //namespace
namespace QmlDesigner { namespace QmlDesigner {
@@ -238,8 +248,12 @@ QVariant read(int variantType, const QString &str)
value = vector3DFromString(str, &conversionOk); value = vector3DFromString(str, &conversionOk);
break; break;
default: { default: {
value = QVariant(str); if (variantType == QMetaType::type("Enumeration")) {
value.convert(static_cast<QVariant::Type>(variantType)); value = QVariant::fromValue<Enumeration>(enumerationFromString(str, &conversionOk));
} else {
value = QVariant(str);
value.convert(static_cast<QVariant::Type>(variantType));
}
break; break;
} }
} }
@@ -251,7 +265,6 @@ QVariant read(int variantType, const QString &str)
} }
return value; return value;
return QVariant();
} }
QVariant variantFromString(const QString &s) QVariant variantFromString(const QString &s)
@@ -273,63 +286,6 @@ QVariant variantFromString(const QString &s)
return QVariant(s); return QVariant(s);
} }
QString write(const QVariant &variant)
{
if (!variant.isValid()) {
qWarning() << "Trying to serialize invalid QVariant";
return QString();
}
QString value;
switch (variant.type()) {
case QMetaType::QPoint:
{
QPoint p = variant.toPoint();
value = QString("%1,%2").arg(QString::number(p.x()), QString::number(p.y()));
break;
}
case QMetaType::QPointF:
{
QPointF p = variant.toPointF();
value = QString("%1,%2").arg(QString::number(p.x(), 'f'), QString::number(p.y(), 'f'));
break;
}
case QMetaType::QSize:
{
QSize s = variant.toSize();
value = QString("%1x%2").arg(QString::number(s.width()), QString::number(s.height()));
break;
}
case QMetaType::QSizeF:
{
QSizeF s = variant.toSizeF();
value = QString("%1x%2").arg(QString::number(s.width(), 'f'), QString::number(s.height(), 'f'));
break;
}
case QMetaType::QRect:
{
QRect r = variant.toRect();
value = QString("%1,%2,%3x%4").arg(QString::number(r.x()), QString::number(r.y()),
QString::number(r.width()), QString::number(r.height()));
break;
}
case QMetaType::QRectF:
{
QRectF r = variant.toRectF();
value = QString("%1,%2,%3x%4").arg(QString::number(r.x(), 'f'), QString::number(r.y(), 'f'),
QString::number(r.width(), 'f'), QString::number(r.height(), 'f'));
break;
}
default:
QVariant strVariant = variant;
strVariant.convert(QVariant::String);
if (!strVariant.isValid())
qWarning() << Q_FUNC_INFO << "cannot serialize type " << QMetaType::typeName(variant.type());
value = strVariant.toString();
}
return value;
}
} // namespace PropertyParser } // namespace PropertyParser
} // namespace Internal } // namespace Internal
} // namespace Designer } // namespace Designer

View File

@@ -745,6 +745,11 @@ QString RewriterView::pathForImport(const Import &import)
return QString(); return QString();
} }
QStringList RewriterView::importDirectories() const
{
return m_textToModelMerger->vContext().paths;
}
void RewriterView::qmlTextChanged() void RewriterView::qmlTextChanged()
{ {
if (inErrorState()) if (inErrorState())

View File

@@ -671,6 +671,8 @@ static inline bool smartVeryFuzzyCompare(QVariant value1, QVariant value2)
static inline bool equals(const QVariant &a, const QVariant &b) static inline bool equals(const QVariant &a, const QVariant &b)
{ {
if (a.canConvert<Enumeration>() && b.canConvert<Enumeration>())
return a.value<Enumeration>().toString() == b.value<Enumeration>().toString();
if (a == b) if (a == b)
return true; return true;
if (smartVeryFuzzyCompare(a, b)) if (smartVeryFuzzyCompare(a, b))
@@ -715,7 +717,7 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
if (!import->fileName.isEmpty()) { if (!import->fileName.isEmpty()) {
const QString strippedFileName = stripQuotes(import->fileName.toString()); const QString strippedFileName = stripQuotes(import->fileName.toString());
const Import newImport = Import::createFileImport(strippedFileName, const Import newImport = Import::createFileImport(strippedFileName,
version, as, m_rewriterView->textModifier()->importPaths()); version, as, m_rewriterView->importDirectories());
if (!existingImports.removeOne(newImport)) if (!existingImports.removeOne(newImport))
differenceHandler.modelMissesImport(newImport); differenceHandler.modelMissesImport(newImport);
@@ -727,7 +729,7 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
} }
const Import newImport = const Import newImport =
Import::createLibraryImport(importUri, version, as, m_rewriterView->textModifier()->importPaths()); Import::createLibraryImport(importUri, version, as, m_rewriterView->importDirectories());
if (!existingImports.removeOne(newImport)) if (!existingImports.removeOne(newImport))
differenceHandler.modelMissesImport(newImport); differenceHandler.modelMissesImport(newImport);
@@ -833,9 +835,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
// qDebug() << "TextToModelMerger::load with data:" << data; // qDebug() << "TextToModelMerger::load with data:" << data;
const QUrl url = m_rewriterView->model()->fileUrl(); const QUrl url = m_rewriterView->model()->fileUrl();
const QStringList importPaths = m_rewriterView->textModifier()->importPaths();
setActive(true);
setActive(true);
try { try {
Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot(); Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot();
@@ -853,8 +854,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
return false; return false;
} }
snapshot.insert(doc); snapshot.insert(doc);
QmlJS::ViewerContext vContext = QmlJS::ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, doc, true); m_vContext = QmlJS::ModelManagerInterface::instance()->defaultVContext(Dialect::Qml, doc, true);
ReadingContext ctxt(snapshot, doc, vContext); ReadingContext ctxt(snapshot, doc, m_vContext);
m_scopeChain = QSharedPointer<const ScopeChain>( m_scopeChain = QSharedPointer<const ScopeChain>(
new ScopeChain(ctxt.scopeChain())); new ScopeChain(ctxt.scopeChain()));
m_document = doc; m_document = doc;
@@ -867,7 +868,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
} }
setupImports(doc, differenceHandler); setupImports(doc, differenceHandler);
setupPossibleImports(snapshot, vContext); setupPossibleImports(snapshot, m_vContext);
if (m_rewriterView->model()->imports().isEmpty()) { if (m_rewriterView->model()->imports().isEmpty()) {
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found")); const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found"));
@@ -901,6 +902,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
check.enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); check.enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner);
check.enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); check.enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner);
check.enableMessage(StaticAnalysis::WarnAboutQtQuick1InsteadQtQuick2); check.enableMessage(StaticAnalysis::WarnAboutQtQuick1InsteadQtQuick2);
check.enableMessage(StaticAnalysis::ErrUnsupportedRootTypeInVisualDesigner);
//## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner); //## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner);
foreach (const StaticAnalysis::Message &message, check()) { foreach (const StaticAnalysis::Message &message, check()) {

View File

@@ -72,6 +72,9 @@ public:
const QmlJS::Document *document() const const QmlJS::Document *document() const
{ return m_document.data(); } { return m_document.data(); }
const QmlJS::ViewerContext &vContext() const
{ return m_vContext; }
protected: protected:
void setActive(bool active); void setActive(bool active);
@@ -145,6 +148,7 @@ private:
QTimer m_setupTimer; QTimer m_setupTimer;
QSet<ModelNode> m_setupComponentList; QSet<ModelNode> m_setupComponentList;
QSet<ModelNode> m_setupCustomParserList; QSet<ModelNode> m_setupCustomParserList;
QmlJS::ViewerContext m_vContext;
}; };
class DifferenceHandler class DifferenceHandler

View File

@@ -44,7 +44,7 @@ DesignerSettings::DesignerSettings()
showDebugView(false), showDebugView(false),
enableDebugView(false), enableDebugView(false),
alwaysSaveInCrumbleBar(false), alwaysSaveInCrumbleBar(false),
useOnlyFallbackPuppet(false) useOnlyFallbackPuppet(true)
{} {}
void DesignerSettings::fromSettings(QSettings *settings) void DesignerSettings::fromSettings(QSettings *settings)
@@ -68,7 +68,7 @@ void DesignerSettings::fromSettings(QSettings *settings)
alwaysSaveInCrumbleBar = settings->value( alwaysSaveInCrumbleBar = settings->value(
QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool();
useOnlyFallbackPuppet = settings->value( useOnlyFallbackPuppet = settings->value(
QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), QVariant(true)).toBool();
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();

View File

@@ -58,6 +58,7 @@ DesignerSettings SettingsPageWidget::settings() const
designerSettings.designerWarningsInEditor = m_ui.designerWarningsInEditorCheckBox->isChecked(); designerSettings.designerWarningsInEditor = m_ui.designerWarningsInEditorCheckBox->isChecked();
designerSettings.showDebugView = m_ui.designerShowDebuggerCheckBox->isChecked(); designerSettings.showDebugView = m_ui.designerShowDebuggerCheckBox->isChecked();
designerSettings.enableDebugView = m_ui.designerEnableDebuggerCheckBox->isChecked(); designerSettings.enableDebugView = m_ui.designerEnableDebuggerCheckBox->isChecked();
designerSettings.useOnlyFallbackPuppet = m_ui.designerDefaultPuppetCheckBox->isChecked();
return designerSettings; return designerSettings;
} }
@@ -72,6 +73,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &designerSettings)
m_ui.designerWarningsInEditorCheckBox->setChecked(designerSettings.designerWarningsInEditor); m_ui.designerWarningsInEditorCheckBox->setChecked(designerSettings.designerWarningsInEditor);
m_ui.designerShowDebuggerCheckBox->setChecked(designerSettings.showDebugView); m_ui.designerShowDebuggerCheckBox->setChecked(designerSettings.showDebugView);
m_ui.designerEnableDebuggerCheckBox->setChecked(designerSettings.enableDebugView); m_ui.designerEnableDebuggerCheckBox->setChecked(designerSettings.enableDebugView);
m_ui.designerDefaultPuppetCheckBox->setChecked(designerSettings.useOnlyFallbackPuppet);
} }
void SettingsPageWidget::debugViewEnabledToggled(bool b) void SettingsPageWidget::debugViewEnabledToggled(bool b)

View File

@@ -14,6 +14,19 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="title"> <property name="title">
@@ -132,7 +145,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="title"> <property name="title">
<string>Debugging</string> <string>Debugging</string>
@@ -160,6 +173,28 @@
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Subcomponents</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Always save when leaving subcomponent in bread crumb</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -198,35 +233,19 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="groupBox_5"> <widget class="QGroupBox" name="groupBox_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title"> <property name="title">
<string>Subcomponents</string> <string>QML Emulation Layer</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QCheckBox" name="checkBox"> <widget class="QCheckBox" name="designerDefaultPuppetCheckBox">
<property name="toolTip">
<string>If you do not select this checkbox, Qt Quick Designer uses the QML emulation layer (QML Puppet) built with the Qt configured in the build and run kit for the project.</string>
</property>
<property name="text"> <property name="text">
<string>Always save when leaving subcomponent in bread crumb</string> <string>Always use the QML emulation layer provided by Qt Creator</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -317,7 +317,12 @@ protected:
} }
if (ast->identifierToken.isValid()) if (ast->identifierToken.isValid())
addUse(ast->identifierToken, SemanticHighlighter::BindingNameType); addUse(ast->identifierToken, SemanticHighlighter::BindingNameType);
scopedAccept(ast, ast->statement); if (ast->statement)
scopedAccept(ast, ast->statement);
if (ast->binding)
// this is not strictly correct for Components, as their context depends from where they
// are instantiated, but normally not too bad as approximation
scopedAccept(ast, ast->binding);
return false; return false;
} }

View File

@@ -102,7 +102,9 @@ void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
case Qt::Key_Home: { case Qt::Key_Home: {
QTextCursor c(textCursor()); QTextCursor c(textCursor());
c.setPosition(m_startOfEditableArea); bool select = e->modifiers() & Qt::ShiftModifier;
c.setPosition(m_startOfEditableArea,
select ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
setTextCursor(c); setTextCursor(c);
keyConsumed = true; keyConsumed = true;
break; break;
@@ -124,7 +126,9 @@ void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
if (textCursor().position() <= m_startOfEditableArea if (textCursor().position() <= m_startOfEditableArea
|| e->modifiers() & Qt::ControlModifier) { || e->modifiers() & Qt::ControlModifier) {
QTextCursor c(textCursor()); QTextCursor c(textCursor());
c.setPosition(m_startOfEditableArea); bool select = e->modifiers() & Qt::ShiftModifier;
c.setPosition(m_startOfEditableArea,
select ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
setTextCursor(c); setTextCursor(c);
keyConsumed = true; keyConsumed = true;
} }

View File

@@ -3455,25 +3455,6 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
qreal lineX = 0; qreal lineX = 0;
if (d->m_visibleWrapColumn > 0) {
// Don't use QFontMetricsF::averageCharWidth here, due to it returning
// a fractional size even when this is not supported by the platform.
lineX = QFontMetricsF(font()).width(QLatin1Char('x')) * d->m_visibleWrapColumn + offset.x() + 4;
if (lineX < viewportRect.width()) {
const QBrush background = ifdefedOutFormat.background();
painter.fillRect(QRectF(lineX, er.top(), viewportRect.width() - lineX, er.height()),
background);
const QColor col = (palette().base().color().value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
painter.setPen(blendColors(background.isOpaque() ? background.color() : palette().base().color(),
col, 32));
painter.drawLine(QPointF(lineX, er.top()), QPointF(lineX, er.bottom()));
painter.setPen(pen);
}
}
// Set a brush origin so that the WaveUnderline knows where the wave started // Set a brush origin so that the WaveUnderline knows where the wave started
painter.setBrushOrigin(offset); painter.setBrushOrigin(offset);
@@ -3617,6 +3598,26 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
} }
} }
// draw wrap column after ifdefed out blocks
if (d->m_visibleWrapColumn > 0) {
// Don't use QFontMetricsF::averageCharWidth here, due to it returning
// a fractional size even when this is not supported by the platform.
lineX = QFontMetricsF(font()).width(QLatin1Char('x')) * d->m_visibleWrapColumn + offset.x() + 4;
if (lineX < viewportRect.width()) {
const QBrush background = ifdefedOutFormat.background();
painter.fillRect(QRectF(lineX, er.top(), viewportRect.width() - lineX, er.height()),
background);
const QColor col = (palette().base().color().value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
painter.setPen(blendColors(background.isOpaque() ? background.color() : palette().base().color(),
col, 32));
painter.drawLine(QPointF(lineX, er.top()), QPointF(lineX, er.bottom()));
painter.setPen(pen);
}
}
// possible extra pass for the block selection find scope // possible extra pass for the block selection find scope
if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn >= 0) { if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn >= 0) {
QTextBlock blockFS = block; QTextBlock blockFS = block;

View File

@@ -88,6 +88,8 @@ bool WinRtPackageDeploymentStep::init()
m_targetFilePath.append(QLatin1String(".exe")); m_targetFilePath.append(QLatin1String(".exe"));
m_targetDirPath = appTargetFilePath.parentDir().toString(); m_targetDirPath = appTargetFilePath.parentDir().toString();
if (!m_targetDirPath.endsWith(QLatin1Char('/')))
m_targetDirPath += QLatin1Char('/');
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit()); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (!qt) if (!qt)
@@ -98,18 +100,19 @@ bool WinRtPackageDeploymentStep::init()
m_manifestFileName = QStringLiteral("AppxManifest"); m_manifestFileName = QStringLiteral("AppxManifest");
if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT) if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT)) {
&& qt->mkspec().toString().contains(QLatin1String("msvc2012"))) {
m_createMappingFile = true; m_createMappingFile = true;
m_manifestFileName = QStringLiteral("WMAppManifest"); if (qt->mkspec().toString().contains(QLatin1String("msvc2012")))
m_manifestFileName = QStringLiteral("WMAppManifest");
} }
if (m_createMappingFile) { if (m_createMappingFile) {
args += QLatin1String(" -list mapping"); args += QLatin1String(" -list mapping");
m_mappingFileContent = QLatin1String("[Files]\n\"") m_mappingFileContent = QLatin1String("[Files]\n");
+ QDir::toNativeSeparators(m_targetDirPath) if (qt->mkspec().toString().contains(QLatin1String("msvc2012"))) {
+ m_manifestFileName + QLatin1String(".xml\" \"") + m_manifestFileName m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(m_targetDirPath) + m_manifestFileName
+ QLatin1String(".xml\"\n"); + QLatin1String(".xml\" \"") + m_manifestFileName + QLatin1String(".xml\"\n");
}
QDir assetDirectory(m_targetDirPath + QLatin1String("assets")); QDir assetDirectory(m_targetDirPath + QLatin1String("assets"));
if (assetDirectory.exists()) { if (assetDirectory.exists()) {
@@ -156,11 +159,12 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt
installableFilesList.append(QPair<QString, QString>(localFilePath, remoteFilePath)); installableFilesList.append(QPair<QString, QString>(localFilePath, remoteFilePath));
} }
// if there are no INSTALLS set we just deploy the files from windeployqt, the manifest // if there are no INSTALLS set we just deploy the files from windeployqt, the manifest (in case of 2012)
// and the icons referenced in there and the actual build target // and the icons referenced in there and the actual build target
QString baseDir; QString baseDir;
if (targetInstallationPath.isEmpty()) { if (targetInstallationPath.isEmpty()) {
m_targetFilePath += QLatin1String(".exe"); if (!m_targetFilePath.endsWith(QLatin1String(".exe")))
m_targetFilePath.append(QLatin1String(".exe"));
m_mappingFileContent m_mappingFileContent
+= QLatin1Char('"') + QDir::toNativeSeparators(m_targetFilePath) += QLatin1Char('"') + QDir::toNativeSeparators(m_targetFilePath)
+ QLatin1String("\" \"") + QLatin1String("\" \"")
@@ -178,6 +182,28 @@ bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitSt
relativeRemotePath = pair.second; relativeRemotePath = pair.second;
else else
relativeRemotePath = QDir(baseDir).relativeFilePath(pair.second); relativeRemotePath = QDir(baseDir).relativeFilePath(pair.second);
if (QDir(relativeRemotePath).isAbsolute() || relativeRemotePath.startsWith(QLatin1String(".."))) {
// special case for winphone 8.0 font deployment
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (!qt)
return false;
if (qt->mkspec().toString().contains(QLatin1String("msvc2012"))) {
const QString fileName = relativeRemotePath.mid(relativeRemotePath.lastIndexOf(QLatin1Char('/')) + 1);
if (QFile::exists(m_targetDirPath + QLatin1String("fonts/") + fileName)) {
relativeRemotePath = QLatin1String("fonts/") + fileName;
} else {
// for 3.3?
// raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath));
continue;
}
} else {
// for 3.3?
// raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath));
continue;
}
}
m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(pair.first) m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(pair.first)
+ QLatin1String("\" \"") + QDir::toNativeSeparators(relativeRemotePath) + QLatin1String("\" \"") + QDir::toNativeSeparators(relativeRemotePath)
+ QLatin1String("\"\n"); + QLatin1String("\"\n");
@@ -267,7 +293,8 @@ bool WinRtPackageDeploymentStep::parseIconsAndExecutableFromManifest(QString man
icons->append(icon); icons->append(icon);
} }
QRegularExpression executablePattern(QStringLiteral("ImagePath=\"([a-zA-Z0-9_-]*\\.exe)\"")); const QLatin1String executablePrefix(manifestFileName.contains(QLatin1String("AppxManifest")) ? "Executable=" : "ImagePath=");
QRegularExpression executablePattern(executablePrefix + QStringLiteral("\"([a-zA-Z0-9_-]*\\.exe)\""));
QRegularExpressionMatch match = executablePattern.match(contents); QRegularExpressionMatch match = executablePattern.match(contents);
if (!match.hasMatch()) if (!match.hasMatch())
return false; return false;

View File

@@ -62,6 +62,42 @@ bool GetOperation::setArguments(const QStringList &args)
return !m_file.isEmpty() && !m_keys.isEmpty(); return !m_file.isEmpty() && !m_keys.isEmpty();
} }
static QString toString(const QVariant &variant, int indentation = 0)
{
const QString indent(indentation, QLatin1Char(' '));
switch (variant.type()) {
case QVariant::Map: {
QVariantMap map = variant.toMap();
QString res;
for (auto item = map.begin(); item != map.end(); ++item) {
res += indent + item.key() + QLatin1String(": ");
QVariant value = item.value();
switch (value.type()) {
case QVariant::Map:
case QVariant::List:
res += QLatin1Char('\n') + toString(value, indentation + 1);
break;
default:
res += value.toString();
break;
}
res += QLatin1Char('\n');
}
return res;
}
case QVariant::List: {
QVariantList list = variant.toList();
QString res;
int counter = 0;
foreach (const QVariant &item, list)
res += indent + QString::number(counter++) + QLatin1String(":\n") + toString(item, indentation + 1);
return res;
}
default:
return indent + variant.toString();
}
}
int GetOperation::execute() const int GetOperation::execute() const
{ {
Q_ASSERT(!m_keys.isEmpty()); Q_ASSERT(!m_keys.isEmpty());
@@ -72,7 +108,7 @@ int GetOperation::execute() const
if (!result.isValid()) if (!result.isValid())
std::cout << "<invalid>" << std::endl; std::cout << "<invalid>" << std::endl;
else else
std::cout << qPrintable(result.toString()) << std::endl; std::cout << qPrintable(toString(result)) << std::endl;
} }
return 0; return 0;

View File

@@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.0
Rectangle {
width: 60
height: 60
color: "green"
property alias text: text.text
Text {
id: text
anchors.centerIn: parent
}
}

View File

@@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.0
Item {
property alias text: text.text
property alias color: rect.color
property alias radius: rect.radius
Rectangle {
id: rect
anchors.fill: parent
color: "green"
Text {
id: text
anchors.centerIn: parent
}
}
}

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.0
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
Column {
anchors.left: parent.left
anchors.right: parent.right
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Color")
ColorEditor {
caption: qsTr("Color")
backendValue: backendValues.color
supportGradient: true
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: "Rectangle"
SectionLayout {
rows: 2
Label {
text: qsTr("Text")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.text
Layout.fillWidth: true
}
}
Label {
text: qsTr("Radius")
}
SecondColumnLayout {
SpinBox {
backendValue: backendValues.radius
hasSlider: true
Layout.preferredWidth: 80
minimumValue: 0
maximumValue: Math.min(backendValues.height.value, backendValues.width.value) / 2
}
ExpandingSpacer {
}
}
}
}
}

View File

@@ -0,0 +1,44 @@
MetaInfo {
Type {
name: "MyPlugin.MyComponent"
icon: ":/qtquickplugin/images/item-icon16.png"
ItemLibraryEntry {
name: "My Component"
category: "My Test Plugin"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "1.0"
requiredImport: "MyPlugin"
Property {
name: "text"
type: "binding"
value: "qsTr(\"This is text\")"
}
}
}
Type {
name: "MyPlugin.MyComponent2"
icon: ":/qtquickplugin/images/item-icon16.png"
ItemLibraryEntry {
name: "My Component 2"
category: "My Test Plugin"
libraryIcon: ":/qtquickplugin/images/item-icon.png"
version: "1.0"
requiredImport: "MyPlugin"
Property {
name: "text"
type: "binding"
value: "qsTr(\"This is text\")"
}
Property { name: "width"; type: "int"; value: 200; }
Property { name: "height"; type: "int"; value: 200; }
Property { name: "color"; type: "QColor"; value: "red"; }
}
}
}

View File

@@ -0,0 +1,2 @@
MyComponent 1.0 MyComponent.qml
MyComponent2 1.0 MyComponent2.qml

View File

@@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
import MyPlugin 1.0
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
MyComponent {
text: qsTr("Some Text")
}
}

View File

@@ -0,0 +1,20 @@
/* File generated by Qt Creator */
import QmlProject 1.1
Project {
mainFile: "plugins.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
importPaths: [ "imports" ]
}

View File

@@ -80,7 +80,7 @@ void SftpTest::handleConnected()
m_channel = m_connection->createSftpChannel(); m_channel = m_connection->createSftpChannel();
connect(m_channel.data(), SIGNAL(initialized()), this, connect(m_channel.data(), SIGNAL(initialized()), this,
SLOT(handleChannelInitialized())); SLOT(handleChannelInitialized()));
connect(m_channel.data(), SIGNAL(initializationFailed(QString)), this, connect(m_channel.data(), SIGNAL(channelError(QString)), this,
SLOT(handleChannelInitializationFailure(QString))); SLOT(handleChannelInitializationFailure(QString)));
connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId,QString)), connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId,QString)),
this, SLOT(handleJobFinished(QSsh::SftpJobId,QString))); this, SLOT(handleJobFinished(QSsh::SftpJobId,QString)));

View File

@@ -42,8 +42,9 @@ int main(int argc, char *argv[])
{ {
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
bool parseSuccess; bool parseSuccess;
const QSsh::SshConnectionParameters &parameters QSsh::SshConnectionParameters parameters
= ArgumentsCollector(app.arguments()).collect(parseSuccess); = ArgumentsCollector(app.arguments()).collect(parseSuccess);
parameters.host = QLatin1String("127.0.0.1");
if (!parseSuccess) if (!parseSuccess)
return EXIT_FAILURE; return EXIT_FAILURE;
Tunnel tunnel(parameters); Tunnel tunnel(parameters);

View File

@@ -28,6 +28,8 @@ Fifth - you'll have to make sure that some needed tools are available (no matter
* wget or curl, capable of HTTPS * wget or curl, capable of HTTPS
Normally it should be okay to just install them as usual and add their executables' path(s) to the PATH variable. Normally it should be okay to just install them as usual and add their executables' path(s) to the PATH variable.
Sixth - Qt Creator should be built with ClangCodeModel plugin.
How to do so, see QTCREATOR_REPO/src/plugins/clangcodemodel/README.
Attention! If any of these prerequisites cannot be satisfied the tests will likely fail (or not run at all). Attention! If any of these prerequisites cannot be satisfied the tests will likely fail (or not run at all).

View File

@@ -1,3 +1,4 @@
:*Qt Creator.Add Kit_QPushButton {text='Add Kit' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.Build Project_Core::Internal::FancyToolButton {text='Build Project' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Build Project_Core::Internal::FancyToolButton {text='Build Project' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.Cancel Build_QToolButton {text='Cancel Build' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Cancel Build_QToolButton {text='Cancel Build' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}

View File

@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0 IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
OBJECTMAP=../objects.map OBJECTMAP=../objects.map
TEST_CASES=tst_CSUP01 tst_CSUP02 tst_CSUP03 tst_CSUP04 tst_CSUP05 TEST_CASES=tst_CSUP01 tst_CSUP02 tst_CSUP03 tst_CSUP04 tst_CSUP05 tst_CSUP06
VERSION=2 VERSION=2
WRAPPERS=Qt WRAPPERS=Qt

View File

@@ -0,0 +1,218 @@
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and Digia. For licensing terms and
## conditions see http://qt.digia.com/licensing. For further information
## use the contact form at http://qt.digia.com/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Digia gives you certain additional
## rights. These rights are described in the Digia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
#############################################################################
source("../../shared/qtcreator.py")
def makeClangDefaultCodeModel(pluginAvailable):
invokeMenuItem("Tools", "Options...")
waitForObjectItem(":Options_QListView", "C++")
clickItem(":Options_QListView", "C++", 14, 15, 0, Qt.LeftButton)
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Code Model")
expectedObjNames = ['cChooser', 'cppChooser', 'objcChooser', 'objcppChooser', 'hChooser']
for exp in expectedObjNames:
test.verify(checkIfObjectExists("{type='QComboBox' name='%s' visible='1'}" % exp),
"Verifying whether combobox '%s' exists." % exp)
combo = findObject("{type='QComboBox' name='%s' visible='1'}" % exp)
if test.verify(combo.enabled == pluginAvailable, "Verifying whether combobox is enabled."):
if test.compare(combo.currentText, "Qt Creator Built-in",
"Verifying whether default is Qt Creator's builtin code model"):
items = dumpItems(combo.model())
if (pluginAvailable and
test.verify("Clang" in items,
"Verifying whether clang code model can be chosen.")):
selectFromCombo(combo, "Clang")
test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"),
"Verifying whether 'Ignore pre-compiled headers' is checked by default.")
clickButton(waitForObject(":Options.OK_QPushButton"))
def moveDownToNextNonEmptyLine(editor):
currentLine = "" # there's no do-while in python - so use empty line which fails
while not currentLine:
type(editor, "<Down>")
currentLine = str(lineUnderCursor(editor)).strip()
return currentLine
def performAutoCompletionTest(editor, lineToStartRegEx, linePrefix, testFunc, *funcArgs):
if platform.system() == "Darwin":
bol = "<Ctrl+Left>"
eol = "<Ctrl+Right>"
autoComp = "<Meta+Space>"
else:
bol = "<Home>"
eol = "<End>"
autoComp = "<Ctrl+Space>"
if not placeCursorToLine(editor, lineToStartRegEx, True):
return
type(editor, bol)
# place cursor onto the first statement to be tested
while not str(lineUnderCursor(editor)).strip().startswith(linePrefix):
type(editor, "<Down>")
currentLine = str(lineUnderCursor(editor)).strip()
while currentLine.startswith(linePrefix):
type(editor, eol)
type(editor, "<Ctrl+/>") # uncomment current line
type(editor, autoComp) # invoke auto-completion
testFunc(currentLine, *funcArgs)
type(editor, "<Ctrl+/>") # comment current line again
type(editor, bol)
currentLine = moveDownToNextNonEmptyLine(editor)
def checkIncludeCompletion(editor):
test.log("Check auto-completion of include statements.")
# define special handlings
noProposal = ["vec", "detail/hea", "dum"]
specialHandling = {"ios":"iostream", "cstd":"cstdio"}
if platform.system() in ('Microsoft', 'Windows'):
missing = ["lin"]
elif platform.system() == "Darwin":
missing = ["lin", "Win"]
noProposal.remove("vec")
else:
missing = ["Win"]
# define test function to perform the _real_ auto completion test on the current line
def testIncl(currentLine, *args):
missing, noProposal, specialHandling = args
inclSnippet = currentLine.split("//#include")[-1].strip().strip('<"')
propShown = waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 2500)
test.compare(not propShown, inclSnippet in missing or inclSnippet in noProposal,
"Proposal widget is (not) shown as expected (%s)" % inclSnippet)
if propShown:
proposalListView = waitForObject(':popupFrame_Proposal_QListView')
if inclSnippet in specialHandling:
doubleClickItem(':popupFrame_Proposal_QListView', specialHandling[inclSnippet],
5, 5, 0, Qt.LeftButton)
else:
type(proposalListView, "<Return>")
changedLine = str(lineUnderCursor(editor)).strip()
if inclSnippet in missing:
test.compare(changedLine, currentLine.lstrip("/"), "Include has not been modified.")
else:
test.verify(changedLine.endswith('>') or changedLine.endswith('"'),
"'%s' has been completed to '%s'" % (currentLine.lstrip("/"), changedLine))
performAutoCompletionTest(editor, ".*Complete includes.*", "//#include",
testIncl, missing, noProposal, specialHandling)
def checkSymbolCompletion(editor, isClangCodeModel):
test.log("Check auto-completion of symbols.")
# define special handlings
expectedSuggestion = {"in":["internal", "int", "INT_MAX", "INT_MIN"],
"Dum":["Dummy", "dummy"], "Dummy::O":["ONE","one"],
"dummy.":["foo", "bla", "ONE", "one", "PI", "sfunc", "v1", "v2", "v3"],
"dummy.o":["one", "ONE"], "Dummy::In":["Internal", "INT"],
"Dummy::Internal::":["DOUBLE", "one"]
}
missing = ["Dummy::s", "Dummy::P", "dummy.b", "dummy.bla(", "internal.o", "freefunc2",
"using namespace st", "afun"]
expectedResults = {"dummy.":"dummy.foo(", "Dummy::s":"Dummy::sfunc()",
"Dummy::P":"Dummy::PI", "dummy.b":"dummy.bla(", "dummy.bla(":"dummy.bla(",
"internal.o":"internal.one", "freefunc2":"freefunc2(",
"using namespace st":"using namespace std", "afun":"afunc()"}
if not isClangCodeModel:
expectedSuggestion["using namespace st"] = ["std", "st"]
missing.remove("using namespace st")
elif platform.system() in ('Microsoft', 'Windows'):
expectedSuggestion["using namespace st"] = ["std", "stdext"]
missing.remove("using namespace st")
# define test function to perform the _real_ auto completion test on the current line
def testSymb(currentLine, *args):
missing, expectedSug, expectedRes = args
symbol = currentLine.lstrip("/").strip()
propShown = waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 2500)
test.compare(not propShown, symbol in missing,
"Proposal widget is (not) shown as expected (%s)" % symbol)
if propShown:
proposalListView = waitForObject(':popupFrame_Proposal_QListView')
found = dumpItems(proposalListView.model())
diffShownExp = set(expectedSug.get(symbol, [])) - set(found)
if not test.verify(len(diffShownExp) == 0,
"Verify if all expected suggestions could be found"):
test.log("Expected but not found suggestions: %s" % diffShownExp,
"%s | %s" % (expectedSug[symbol], str(found)))
# select first item of the expected suggestion list
doubleClickItem(':popupFrame_Proposal_QListView', expectedSug.get(symbol, found)[0],
5, 5, 0, Qt.LeftButton)
changedLine = str(lineUnderCursor(editor)).strip()
if symbol in expectedRes:
exp = expectedRes[symbol]
else:
exp = (symbol[:max(symbol.rfind(":"), symbol.rfind(".")) + 1]
+ expectedSug.get(symbol, found)[0])
test.compare(changedLine, exp, "Verify completion matches.")
performAutoCompletionTest(editor, ".*Complete symbols.*", "//",
testSymb, missing, expectedSuggestion, expectedResults)
def main():
examplePath = os.path.join(srcPath, "creator", "tests", "manual", "cplusplus-tools")
if not neededFilePresent(os.path.join(examplePath, "cplusplus-tools.pro")):
return
try:
# start Qt Creator with enabled ClangCodeModel plugin (without modifying settings)
startApplication("qtcreator -load ClangCodeModel" + SettingsPath)
errorMsg = "{type='QMessageBox' unnamed='1' visible='1' windowTitle='Qt Creator'}"
errorOK = "{text='OK' type='QPushButton' unnamed='1' visible='1' window=%s}" % errorMsg
if waitFor("object.exists(errorOK)", 5000):
clickButton(errorOK) # Error message
clickButton(errorOK) # Help message
raise Exception("ClangCodeModel not found.")
clangCodeModelPluginAvailable = True
models = ["builtin", "clang"]
except:
# ClangCodeModel plugin has not been built - start without it
test.warning("ClangCodeModel plugin not available - performing test without.")
startApplication("qtcreator" + SettingsPath)
clangCodeModelPluginAvailable = False
models = ["builtin"]
if not startedWithoutPluginError():
return
templateDir = prepareTemplate(examplePath)
examplePath = os.path.join(templateDir, "cplusplus-tools.pro")
openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT)
for current in models:
test.log("Testing code model: %s" % current)
if not openDocument("cplusplus-tools.Sources.main\\.cpp"):
earlyExit("Failed to open main.cpp.")
return
editor = getEditorForFileSuffix("main.cpp")
if editor:
checkIncludeCompletion(editor)
checkSymbolCompletion(editor, current != "builtin")
invokeMenuItem('File', 'Revert "main.cpp" to Saved')
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
if current == "builtin":
makeClangDefaultCodeModel(clangCodeModelPluginAvailable)
snooze(1) # 'Close "main.cpp"' might still be disabled
# editor must be closed to get the second code model applied on re-opening the file
invokeMenuItem('File', 'Close "main.cpp"')
invokeMenuItem("File", "Exit")

View File

@@ -33,7 +33,7 @@ import re
def main(): def main():
global tmpSettingsDir global tmpSettingsDir
quickCombinations = ["1.1", "2.1", "2.2", "Controls 1.0", "Controls 1.1"] quickCombinations = ["1.1", "2.1", "2.2", "2.3", "Controls 1.0", "Controls 1.1", "Controls 1.2"]
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return

View File

@@ -34,8 +34,9 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
for targ, qVer in [[Targets.DESKTOP_480_GCC, "1.1"], [Targets.DESKTOP_521_DEFAULT, "2.1"], for targ, qVer in [[Targets.DESKTOP_480_GCC, "1.1"], [Targets.DESKTOP_521_DEFAULT, "2.1"],
[Targets.DESKTOP_521_DEFAULT, "2.2"], [Targets.DESKTOP_521_DEFAULT, "Controls 1.0"], [Targets.DESKTOP_521_DEFAULT, "2.2"], [Targets.DESKTOP_531_DEFAULT, "2.3"],
[Targets.DESKTOP_521_DEFAULT, "Controls 1.1"]]: [Targets.DESKTOP_521_DEFAULT, "Controls 1.0"], [Targets.DESKTOP_521_DEFAULT, "Controls 1.1"],
[Targets.DESKTOP_531_DEFAULT, "Controls 1.2"]]:
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ, checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targ,

View File

@@ -33,12 +33,20 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
for quickVersion in ["1.1", "2.1", "2.2", "Controls 1.0", "Controls 1.1"]: for quickVersion in ["1.1", "2.1", "2.2", "2.3", "Controls 1.0", "Controls 1.1", "Controls 1.2"]:
# using a temporary directory won't mess up a potentially existing # using a temporary directory won't mess up a potentially existing
workingDir = tempDir() workingDir = tempDir()
projectName = createNewQtQuickUI(workingDir, quickVersion) projectName = createNewQtQuickUI(workingDir, quickVersion)
switchViewTo(ViewConstants.PROJECTS)
clickButton(waitForObject(":*Qt Creator.Add Kit_QPushButton"))
menuItem = Targets.getStringForTarget(Targets.DESKTOP_531_DEFAULT)
if platform.system() == 'Darwin':
waitFor("macHackActivateContextMenuItem(menuItem)", 5000)
else:
activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", menuItem))
test.log("Running project Qt Quick %s UI" % quickVersion) test.log("Running project Qt Quick %s UI" % quickVersion)
qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, 0, workingDir, projectName, 11223, quickVersion) qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(2, 1, workingDir, projectName, 11223, quickVersion)
if qmlViewer!=None: if qmlViewer!=None:
qmlViewerPath = os.path.dirname(qmlViewer) qmlViewerPath = os.path.dirname(qmlViewer)
qmlViewer = os.path.basename(qmlViewer) qmlViewer = os.path.basename(qmlViewer)