Merge remote-tracking branch 'origin/2.7'

Conflicts:
	src/plugins/cpptools/cppchecksymbols.h
	src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp

Change-Id: I887ba071fa637ad44e39bcae581738fa078a6612
This commit is contained in:
Eike Ziller
2013-04-11 18:27:52 +02:00
64 changed files with 961 additions and 304 deletions

View File

@@ -268,16 +268,23 @@
\li \c fieldpagetitle specifies the title of the page.
\li \c field specifies whether the field is mandatory (\c true or
\c false). You can use the value of the \c name field as a
variable in other files (for example, \c {%MESSAGE%}.
\li \c fields specifies the user interface objects on the page.
\li \c fieldcontrol specifies the field. \c class specifies the
field type. You can use interface objects from the QWidget class
to create fields. This example uses QLineEdit to create an input
field.
\li \c field specifies one object. You can use a set of interface objects
from QtWidgets classes, derived from QWidget, to create fields. This example
uses QLineEdit to create an input field. For more information about the objects
that you can add, see \l {Supported Widgets}.
\li \c validator specifies a regular expression to check the
\li \c mandatory specifies whether the field is mandatory (\c true or
\c false). For more information, see QWizardPage::registerField().
\li \c name specifies a name that you can use as a placeholder variable in the
template file (for example, \c {%MESSAGE%}).
\li \c class specifies the type of the \c fieldcontrol. The XML attributes that you
can specify for the field depend on the field type.
\li For a QLineEdit, \c validator specifies a regular expression to check the
characters allowed in the field.
\li \c defaulttext specifies text that appears in the field by
@@ -292,7 +299,7 @@
\section1 Creating Class Wizards
The widget.xml file for a class wizard is very similar to that for a project
The wizard.xml file for a class wizard is very similar to that for a project
wizard. The differences are discussed below.
To create a class wizard:
@@ -360,9 +367,18 @@
<fielddescription xml:lang="de">Klassenname:</fielddescription>
</field>
<field name="Datatype">
<fieldcontrol class="QComboBox" combochoices="QString,int" defaultindex="0" />
<fieldcontrol class="QComboBox" defaultindex="0">
<comboentries>
<comboentry value="QString">
<comboentrytext>class QString</comboentrytext>
<comboentrytext xml:lang="de">Klasse QString</comboentrytext>
</comboentry>
<comboentry value="int">
<comboentrytext>Integer</comboentrytext>
<comboentrytext xml:lang="de">Ganzzahlwert</comboentrytext>
</comboentry>
</comboentries>
</fieldcontrol>
<fielddescription>Data type:</fielddescription>
<fielddescription xml:lang="de">Datentyp:</fielddescription>
</field>
@@ -371,11 +387,85 @@
\endcode
In addition to QLineEdit, QComboBox is used in the class wizard to
create a field. \c combochoices specifies the options in the combobox
and \c defaultindex specifies that QString is the default value.
create a field. Specify the following XML attributes:
\list
\li \c defaultindex specifies which comboentry is displayed by default. In the above
example, "0" means that the first comboentry is the default value.
\li \c comboentries specifies the options in the combobox.
\li \c value specifies the type of each \c comboentry, QString or integer.
\li \c comboentrytext specifies the text of the entry.
\endlist
\endlist
\section1 Supported Widgets
You can use the following interface objects to create fields in the wizards:
\list
\li PathChooser utility to set paths
\li Check boxes with text labels (QCheckBox)
\li Combined button and popup lists (QComboBox)
\li One-line text editors (QLineEdit)
\li Multi-line rich text editors (QTextEdit)
\endlist
Using QLineEdit and QComboBox is described in the previous sections.
The following sections show examples of using the other classes and describe the XML
attributes that you can specify for the \c fieldcontrol element of a field in a particular
\c class.
\section2 Path Choosers
\code
<field mandatory="true" name="QtCreatorSources">
<fieldcontrol class="Utils::PathChooser" defaulttext="" />
<fielddescription>Qt Creator sources:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
\section2 Check Boxes
To make check boxes appear selected by default, set the \c fieldcontrol attribute
\c defaultvalue to \c true. Any other value or omitting the attribute makes the check box
appear not selected.
For example:
\code
<field name="CONSOLE">
<fieldcontrol class="QCheckBox" defaultvalue="true"/>
<fielddescription>Console application</fielddescription>
</field>
\endcode
For more examples about using check boxes, see \l{Processing Template Files}.
\section2 Text Editors
\code
<field name="License">
<fieldcontrol class="QTextEdit" defaulttext="Put your license text here" />
<fielddescription>License:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
\section1 Processing Template Files
When processing a template source file, placeholders specifying the field
@@ -396,9 +486,29 @@
\endlist
In the \c{helloworld} example, the placeholder \c %NETWORK% is used together with the
QCheckBox class. The following line is added to the project file:
\code
%NETWORK%QT += network
\endcode
And the following field is specified in the wizard.xml:
\code
<field name="NETWORK">
<fieldcontrol class="QCheckBox" truevalue="" falsevalue="# "/>
<fielddescription>Include network module</fielddescription>
<fielddescription xml:lang="de">Netzwerk-Modul verwenden</fielddescription>
</field>
\endcode
If the checkbox is checked, the placeholder is replaced by \c truevalue. If it is not
checked, the placeholder is replaced by \c falsevalue.
You can use conditions to add sections of the file depending on field
values. Use a syntax that is similar to C++ preprocessing, as demonstrated
in the profile of the \c{helloworld} example:
in the project file of the \c{helloworld} example:
\code
@@ -412,6 +522,16 @@
whether the script module is added. The expressions must expand to valid
Javascript expressions after field replacement.
For example, the following field is specified in the wizard.xml:
\code
<field name="SCRIPT">
<fieldcontrol class="QCheckBox"/>
<fielddescription>Include script module</fielddescription>
<fielddescription xml:lang="de">Script-Modul verwenden</fielddescription>
</field>
\endcode
\section1 Pre-defined Standard Variables
In addition to the field values entered by the user, you can use

View File

@@ -54,6 +54,17 @@
#include <private/qqmltimer_p.h>
#include <private/qqmlengine_p.h>
static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName)
{
if (propertyName.contains(".") && propertyName.contains("__"))
return true;
if (propertyName.count(".") > 1)
return true;
return false;
}
namespace QmlDesigner {
namespace Internal {
@@ -534,6 +545,9 @@ void ObjectNodeInstance::refreshProperty(const PropertyName &name)
bool ObjectNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const
{
if (isPropertyBlackListed(name))
return false;
QQmlProperty property(object(), name, context());
bool hasBinding = QQmlPropertyPrivate::binding(property);
@@ -602,6 +616,9 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
// TODO: handle model nodes
if (isPropertyBlackListed(name))
return QVariant();
QQmlProperty property(object(), name, context());
if (property.property().isEnumType()) {
QVariant value = property.read();
@@ -664,6 +681,9 @@ PropertyNameList ObjectNodeInstance::propertyNames() const
QString ObjectNodeInstance::instanceType(const PropertyName &name) const
{
if (isPropertyBlackListed(name))
return QLatin1String("undefined");
QQmlProperty property(object(), name, context());
if (!property.isValid())
return QLatin1String("undefined");
@@ -783,7 +803,13 @@ static void disableTiledBackingStore(QObject *object)
Q_UNUSED(object);
}
PropertyNameList propertyNameForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList())
static void addToPropertyNameListIfNotBlackListed(PropertyNameList *propertyNameList, const PropertyName &propertyName)
{
if (!isPropertyBlackListed(propertyName))
propertyNameList->append(propertyName);
}
PropertyNameList propertyNameListForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList())
{
PropertyNameList propertyNameList;
@@ -800,16 +826,16 @@ PropertyNameList propertyNameForWritableProperties(QObject *object, const Proper
if (declarativeProperty.name() != "parent") {
QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read());
if (childObject)
propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects));
propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects));
}
} else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) {
QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType());
valueType->setValue(metaProperty.read(object));
propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects));
propertyNameList.append(propertyNameListForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects));
}
if (metaProperty.isReadable() && metaProperty.isWritable()) {
propertyNameList.append(baseName + PropertyName(metaProperty.name()));
addToPropertyNameListIfNotBlackListed(&propertyNameList, baseName + PropertyName(metaProperty.name()));
}
}
@@ -821,7 +847,7 @@ static void fixResourcePathsForObject(QObject *object)
if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty())
return;
PropertyNameList propertyNameList = propertyNameForWritableProperties(object);
PropertyNameList propertyNameList = propertyNameListForWritableProperties(object);
foreach (const PropertyName &propertyName, propertyNameList) {
QQmlProperty property(object, propertyName, QQmlEngine::contextForObject(object));
@@ -1037,7 +1063,7 @@ void ObjectNodeInstance::deactivateState()
void ObjectNodeInstance::populateResetHashes()
{
PropertyNameList propertyNameList = propertyNameForWritableProperties(object());
PropertyNameList propertyNameList = propertyNameListForWritableProperties(object());
foreach (const PropertyName &propertyName, propertyNameList) {
QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object()));

View File

@@ -278,8 +278,6 @@ static void disableTextCursor(QQuickItem *item)
void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
{
disableTextCursor(quickItem());
if (instanceId() == 0) {
DesignerSupport::setRootItem(nodeInstanceServer()->quickView(), quickItem());
} else {
@@ -448,7 +446,7 @@ void QuickItemNodeInstance::refresh()
repositioning(quickItem());
}
void doComponentCompleteRecursive(QQuickItem *item)
static void doComponentCompleteRecursive(QQuickItem *item)
{
if (item) {
if (DesignerSupport::isComponentComplete(item))
@@ -465,6 +463,8 @@ void QuickItemNodeInstance::doComponentComplete()
{
doComponentCompleteRecursive(quickItem());
disableTextCursor(quickItem());
quickItem()->update();
}

View File

@@ -336,8 +336,14 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
if (name->identifier() != 0 && scope->isBlock()) {
bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ 0, /*binding=*/ 0);
if (! candidates.isEmpty())
break; // it's a local.
if (! candidates.isEmpty()) {
// it's a local.
//for qualified it can be outside of the local scope
if (name->isQualifiedNameId())
continue;
else
break;
}
for (unsigned i = 0; i < scope->memberCount(); ++i) {
if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) {
@@ -353,8 +359,14 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
} else if (Function *fun = scope->asFunction()) {
bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ 0, /*binding=*/ 0);
if (! candidates.isEmpty())
break; // it's an argument or a template parameter.
if (! candidates.isEmpty()) {
// it's an argument or a template parameter.
//for qualified it can be outside of the local scope
if (name->isQualifiedNameId())
continue;
else
break;
}
if (fun->name() && fun->name()->isQualifiedNameId()) {
if (ClassOrNamespace *binding = bindings()->lookupType(fun)) {
@@ -380,8 +392,14 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
} else if (Template *templ = scope->asTemplate()) {
bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ 0, /*binding=*/ 0);
if (! candidates.isEmpty())
return candidates; // it's a template parameter.
if (! candidates.isEmpty()) {
// it's a template parameter.
//for qualified it can be outside of the local scope
if (name->isQualifiedNameId())
continue;
else
break;
}
} else if (scope->asNamespace()
|| scope->asClass()
@@ -624,7 +642,8 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
if (s->asNamespaceAlias() && binding) {
ClassOrNamespace *targetNamespaceBinding = binding->lookupType(name);
if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() == 1) {
//there can be many namespace definitions
if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() > 0) {
Symbol *resolvedSymbol = targetNamespaceBinding->symbols().first();
item.setType(resolvedSymbol->type()); // override the type
}
@@ -1107,29 +1126,26 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c
bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Declaration *declaration) const
{
Type *memberType = declaration->type().type();
NamedType *memberNamedType = findMemberNamedType(memberType);
if (memberNamedType) {
const Name *name = memberNamedType->name();
if (_subst.contains(name))
return true;
}
return false;
NamedType *namedType = findNamedType(memberType);
return namedType && _subst.contains(namedType->name());
}
bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Function * /*function*/) const
bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Function *function) const
{
//TODO: make implementation
return false;
Type *returnType = function->returnType().type();
NamedType *namedType = findNamedType(returnType);
return namedType && _subst.contains(namedType->name());
//TODO: in future we will need also check function arguments, for now returned value is enough
}
NamedType *ClassOrNamespace::NestedClassInstantiator::findMemberNamedType(Type *memberType) const
NamedType *ClassOrNamespace::NestedClassInstantiator::findNamedType(Type *memberType) const
{
if (NamedType *namedType = memberType->asNamedType())
return namedType;
else if (PointerType *pointerType = memberType->asPointerType())
return findMemberNamedType(pointerType->elementType().type());
return findNamedType(pointerType->elementType().type());
else if (ReferenceType *referenceType = memberType->asReferenceType())
return findMemberNamedType(referenceType->elementType().type());
return findNamedType(referenceType->elementType().type());
return 0;
}

View File

@@ -155,7 +155,7 @@ private:
bool isInstantiateNestedClassNeeded(const QList<Symbol *> &symbols) const;
bool containsTemplateType(Declaration *declaration) const;
bool containsTemplateType(Function *function) const;
NamedType *findMemberNamedType(Type *memberType) const;
NamedType *findNamedType(Type *memberType) const;
QSet<ClassOrNamespace *> _alreadyConsideredNestedClassInstantiations;
CreateBindings *_factory;

View File

@@ -125,7 +125,11 @@ public:
QByteArray preprocessedExpression(const QByteArray &utf8code) const;
void setExpandTemplates(bool expandTemplates)
{ m_expandTemplates = expandTemplates; }
{
if (m_bindings)
m_bindings->setExpandTemplates(expandTemplates);
m_expandTemplates = expandTemplates;
}
private:

View File

@@ -1,6 +1,7 @@
DEFINES += NDEBUG
#DEFINES += DEBUG_LOOKUP
unix:QMAKE_CXXFLAGS_DEBUG += -O2
win32:QMAKE_CXXFLAGS_DEBUG += -O2
include(../../qtcreatorlibrary.pri)
include(cplusplus-lib.pri)

View File

@@ -43,14 +43,6 @@ class StaticAnalysisMessages
Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages)
public:
class PrototypeMessageData {
public:
Type type;
Severity severity;
QString message;
int placeholders;
};
void newMsg(Type type, Severity severity, const QString &message, int placeholders = 0)
{
PrototypeMessageData prototype;
@@ -248,7 +240,7 @@ Message::Message(Type type,
: location(location), type(type)
{
QTC_ASSERT(messages()->messages.contains(type), return);
const StaticAnalysisMessages::PrototypeMessageData &prototype = messages()->messages.value(type);
const PrototypeMessageData &prototype = prototypeForMessageType(type);
severity = prototype.severity;
message = prototype.message;
if (prototype.placeholders == 0) {
@@ -299,3 +291,11 @@ QRegExp Message::suppressionPattern()
{
return QRegExp(QLatin1String("@disable-check M(\\d+)"));
}
const PrototypeMessageData Message::prototypeForMessageType(Type type)
{
QTC_CHECK(messages()->messages.contains(type));
const PrototypeMessageData &prototype = messages()->messages.value(type);
return prototype;
}

View File

@@ -131,6 +131,14 @@ enum Type
ErrInvalidArrayValueLength = 323
};
class QMLJS_EXPORT PrototypeMessageData {
public:
Type type;
Severity severity;
QString message;
int placeholders;
};
class QMLJS_EXPORT Message
{
public:
@@ -152,6 +160,8 @@ public:
QString message;
Type type;
Severity severity;
static const PrototypeMessageData prototypeForMessageType(Type type);
};
} // namespace StaticAnalysis

View File

@@ -58,7 +58,7 @@ public:
static bool isMacHost() { return hostOs() == HostOsMac; }
static inline bool isAnyUnixHost();
static QString appendExecutableSuffix(const QString &executable)
static QString withExecutableSuffix(const QString &executable)
{
QString finalName = executable;
if (isWindowsHost())

View File

@@ -226,6 +226,7 @@ QString PathChooserPrivate::expandedPath(const QString &input) const
case PathChooser::Directory:
case PathChooser::ExistingDirectory:
case PathChooser::File:
case PathChooser::SaveFile:
if (!m_baseDirectory.isEmpty() && QFileInfo(path).isRelative())
return QFileInfo(m_baseDirectory + QLatin1Char('/') + path).absoluteFilePath();
break;
@@ -377,6 +378,11 @@ void PathChooser::slotBrowse()
makeDialogTitle(tr("Choose File")), predefined,
d->m_dialogFilter);
break;
case PathChooser::SaveFile:
newPath = QFileDialog::getSaveFileName(this,
makeDialogTitle(tr("Choose File")), predefined,
d->m_dialogFilter);
break;
case PathChooser::Any: {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::AnyFile);
@@ -464,6 +470,13 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage)
return false;
}
break;
case PathChooser::SaveFile:
if (!fi.absoluteDir().exists()) {
if (errorMessage)
*errorMessage = tr("The directory '%1' does not exist.").arg(QDir::toNativeSeparators(fi.absolutePath()));
return false;
}
break;
case PathChooser::ExistingCommand:
if (!fi.exists()) {
if (errorMessage)
@@ -513,6 +526,14 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage)
}
break;
case PathChooser::SaveFile:
if (fi.exists() && fi.isDir()) {
if (errorMessage)
*errorMessage = tr("The path <b>%1</b> is not a file.").arg(QDir::toNativeSeparators(fi.absolutePath()));
return false;
}
break;
case PathChooser::ExistingCommand:
if (!fi.isFile() || !fi.isExecutable()) {
if (errorMessage)

View File

@@ -70,6 +70,7 @@ public:
ExistingDirectory,
Directory, // A directory, doesn't need to exist
File,
SaveFile,
ExistingCommand, // A command that must exist at the time of selection
Command, // A command that may or may not exist at the time of selection (e.g. result of a build)
Any

View File

@@ -81,6 +81,7 @@ namespace {
const QLatin1String KeystoreLocationKey("KeystoreLocation");
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
const QLatin1String PartitionSizeKey("PartitionSize");
const QLatin1String ToolchainHostKey("ToolchainHost");
const QLatin1String ArmToolchainPrefix("arm-linux-androideabi");
const QLatin1String X86ToolchainPrefix("x86");
const QLatin1String MipsToolchainPrefix("mipsel-linux-android");
@@ -152,6 +153,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
antLocation = FileName::fromString(settings.value(AntLocationKey).toString());
openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
toolchainHost = settings.value(ToolchainHostKey).toString();
automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
PersistentSettingsReader reader;
@@ -163,6 +165,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
antLocation = FileName::fromString(reader.restoreValue(AntLocationKey).toString());
openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
toolchainHost = reader.restoreValue(ToolchainHostKey).toString();
QVariant v = reader.restoreValue(AutomaticKitCreationKey);
if (v.isValid())
automaticKitCreation = v.toBool();
@@ -190,11 +193,16 @@ void AndroidConfig::save(QSettings &settings) const
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
settings.setValue(PartitionSizeKey, partitionSize);
settings.setValue(AutomaticKitCreationKey, automaticKitCreation);
settings.setValue(ToolchainHostKey, toolchainHost);
}
void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
{
m_config = devConfigs;
if (m_config.toolchainHost.isEmpty())
detectToolchainHost();
save();
updateAvailablePlatforms();
updateAutomaticKitList();
@@ -278,7 +286,7 @@ FileName AndroidConfigurations::toolPath(Abi::Architecture architecture, const Q
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4")
.arg(toolchainPrefix(architecture))
.arg(ndkToolChainVersion)
.arg(ToolchainHost)
.arg(m_config.toolchainHost)
.arg(toolsPrefix(architecture)));
}
@@ -292,6 +300,11 @@ FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture, cons
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::gccPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
{
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
{
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX));
@@ -302,6 +315,30 @@ FileName AndroidConfigurations::openJDKPath() const
return m_config.openJDKLocation;
}
void AndroidConfigurations::detectToolchainHost()
{
QStringList hostPatterns;
switch (HostOsInfo::hostOs()) {
case HostOsInfo::HostOsLinux:
hostPatterns << QLatin1String("linux*");
break;
case HostOsInfo::HostOsWindows:
hostPatterns << QLatin1String("windows*");
break;
case HostOsInfo::HostOsMac:
hostPatterns << QLatin1String("darwin*");
break;
default: /* unknown host */ return;
}
FileName path = m_config.ndkLocation;
QDirIterator it(path.appendPath(QLatin1String("prebuilt")).toString(), hostPatterns, QDir::Dirs);
if (it.hasNext()) {
it.next();
m_config.toolchainHost = it.fileName();
}
}
FileName AndroidConfigurations::openJDKBinPath() const
{
FileName path = m_config.openJDKLocation;

View File

@@ -43,21 +43,6 @@ QT_END_NAMESPACE
namespace Android {
namespace Internal {
#ifdef Q_OS_LINUX
const QLatin1String ToolchainHost("linux-x86");
#else
# ifdef Q_OS_DARWIN
const QLatin1String ToolchainHost("darwin-x86");
# else
# ifdef Q_OS_WIN32
const QLatin1String ToolchainHost("windows");
# else
# warning No Android supported OSs found
const QLatin1String ToolchainHost("linux-x86");
# endif
# endif
#endif
class AndroidConfig
{
public:
@@ -70,6 +55,7 @@ public:
Utils::FileName antLocation;
Utils::FileName openJDKLocation;
Utils::FileName keystoreLocation;
QString toolchainHost;
unsigned partitionSize;
bool automaticKitCreation;
};
@@ -96,6 +82,7 @@ public:
Utils::FileName androidToolPath() const;
Utils::FileName antToolPath() const;
Utils::FileName emulatorToolPath() const;
Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName openJDKPath() const;
Utils::FileName keytoolPath() const;
@@ -128,6 +115,7 @@ public slots:
private:
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
Utils::FileName openJDKBinPath() const;
void detectToolchainHost();
AndroidConfigurations(QObject *parent);
void load();

View File

@@ -103,13 +103,8 @@ QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
{
QString ndk_host = QLatin1String(
Utils::HostOsInfo::isLinuxHost() ? "linux-x86" :
Utils::HostOsInfo::isWindowsHost() ? "windows" :
Utils::HostOsInfo::isMacHost() ? "darwin-x86" : "");
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
env.set(QLatin1String("ANDROID_NDK_HOST"), ndk_host);
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::instance().config().toolchainHost);
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput());
Qt4Project *qt4pro = qobject_cast<Qt4ProjectManager::Qt4Project *>(ProjectExplorerPlugin::instance()->currentProject());

View File

@@ -286,6 +286,7 @@ void AndroidSettingsWidget::sdkLocationEditingFinished()
void AndroidSettingsWidget::ndkLocationEditingFinished()
{
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->NDKLocationLineEdit->text());
m_androidConfig.toolchainHost.clear(); // force toolchain host detection
if (!checkNDK(location))
return;
saveSettings(true);

View File

@@ -109,21 +109,7 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
// TODO this vars should be configurable in projects -> build tab
// TODO invalidate all .pro files !!!
QString ndkHost;
switch (HostOsInfo::hostOs()) {
case HostOsInfo::HostOsLinux:
ndkHost = QLatin1String("linux-x86");
break;
case HostOsInfo::HostOsWindows:
ndkHost = QLatin1String("windows");
break;
case HostOsInfo::HostOsMac:
ndkHost = QLatin1String("darwin-x86");
break;
default:
break;
}
env.set(QLatin1String("ANDROID_NDK_HOST"), ndkHost);
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::instance().config().toolchainHost);
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion);
@@ -300,12 +286,7 @@ QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFact
if (ati.architecture == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
continue;
// AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
ati.compilerCommand = ndkPath;
ati.compilerCommand.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4")
.arg(fileName)
.arg(ToolchainHost)
.arg(AndroidConfigurations::toolsPrefix(ati.architecture)));
ati.compilerCommand.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
ati.compilerCommand = AndroidConfigurations::instance().gccPath(ati.architecture, ati.version);
// tc->setCompilerCommand(compilerPath);
result.append(ati);
}
@@ -332,12 +313,7 @@ QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::
if (arch == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
continue;
AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
FileName compilerPath = ndkPath;
compilerPath.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4")
.arg(fileName)
.arg(ToolchainHost)
.arg(AndroidConfigurations::toolsPrefix(arch)));
compilerPath.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
FileName compilerPath = AndroidConfigurations::instance().gccPath(arch, version);
tc->setCompilerCommand(compilerPath);
result.append(tc);
}

View File

@@ -555,21 +555,40 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const
return response.stdOut;
}
//! Get a list of paths to active VOBs.
//! Paths are relative to topLevel
QStringList ClearCasePlugin::ccGetActiveVobs() const
{
QStringList res;
QStringList args(QLatin1String("lsvob"));
args << QLatin1String("-short");
QString topLevel = currentState().topLevel();
const QString topLevel = currentState().topLevel();
const ClearCaseResponse response =
runCleartool(topLevel, args, m_settings.timeOutMS(), SilentRun);
if (response.error)
return res;
foreach (QString dir, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) {
dir = dir.mid(1); // omit first slash
QFileInfo fi(topLevel, dir);
if (fi.exists())
res.append(dir);
// format of output unix:
// * /path/to/vob /path/to/vob/storage.vbs <and some text omitted here>
// format of output windows:
// * \vob \\share\path\to\vob\storage.vbs <and some text omitted here>
QString prefix = topLevel;
if (!prefix.endsWith(QLatin1Char('/')))
prefix += QLatin1Char('/');
foreach (const QString &line, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) {
const bool isActive = line.at(0) == QLatin1Char('*');
if (!isActive)
continue;
const QString dir =
QDir::fromNativeSeparators(line.mid(3, line.indexOf(QLatin1Char(' '), 3) - 3));
const QString relativeDir = QDir(topLevel).relativeFilePath(dir);
// Snapshot views does not necessarily have all active VOBs loaded, so we'll have to
// check if the dirs exists as well. Else the command will work, but the output will
// complain about the element not being loaded.
if (QFile::exists(prefix + relativeDir))
res.append(relativeDir);
}
return res;
}

View File

@@ -283,6 +283,7 @@ struct CanonicalSymbol
: editor(editor), info(info)
{
typeOfExpression.init(info.doc, info.snapshot);
typeOfExpression.setExpandTemplates(true);
}
const LookupContext &context() const

View File

@@ -1227,6 +1227,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
{
unsigned startToken = ast->firstToken();
bool isDestructor = false;
bool isConstructor = false;
if (DestructorNameAST *dtor = ast->asDestructorName()) {
isDestructor = true;
if (dtor->unqualified_name)
@@ -1251,6 +1252,8 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
if (isDestructor != c->name()->isDestructorNameId())
continue;
isConstructor = isConstructorDeclaration(c);
Function *funTy = c->type()->asFunctionType();
if (! funTy) {
//Try to find a template function
@@ -1283,7 +1286,9 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
}
if (matchType != Match_None) {
// decide how constructor and destructor should be highlighted
if (highlightCtorDtorAsType
&& (isConstructor || isDestructor)
&& maybeType(ast->name)
&& kind == SemanticInfo::FunctionUse) {
return false;
@@ -1386,3 +1391,12 @@ void CheckSymbols::flush()
_usages.clear();
_usages.reserve(cap);
}
bool CheckSymbols::isConstructorDeclaration(Symbol *declaration)
{
Class *clazz = declaration->enclosingClass();
if (clazz && clazz->name())
return declaration->name()->isEqualTo(clazz->name());
return false;
}

View File

@@ -166,6 +166,8 @@ protected:
void flush();
private:
bool isConstructorDeclaration(CPlusPlus::Symbol *declaration);
CPlusPlus::Document::Ptr _doc;
CPlusPlus::LookupContext _context;
CPlusPlus::TypeOfExpression typeOfExpression;

View File

@@ -1796,3 +1796,50 @@ void CppToolsPlugin::test_completion_typedef_using_templates2()
QVERIFY(completions.contains(QLatin1String("Foo")));
QVERIFY(completions.contains(QLatin1String("bar")));
}
void CppToolsPlugin::test_completion_namespace_alias_with_many_namespace_declarations()
{
TestData data;
data.srcText =
"namespace NS1\n"
"{\n"
"namespace NS2\n"
"{\n"
"struct Foo1\n"
"{\n"
" int bar1;\n"
"};\n"
"}\n"
"}\n"
"namespace NS1\n"
"{\n"
"namespace NS2\n"
"{\n"
"struct Foo2\n"
"{\n"
" int bar2;\n"
"};\n"
"}\n"
"}\n"
"namespace NS = NS1::NS2;\n"
"int main()\n"
"{\n"
" @\n"
" // padding so we get the scope right\n"
"}\n"
;
setup(&data);
Utils::ChangeSet change;
QString txt = QLatin1String("NS::");
change.insert(data.pos, txt);
QTextCursor cursor(data.doc);
change.apply(&cursor);
data.pos += txt.length();
QStringList completions = getCompletions(data);
QCOMPARE(completions.size(), 2);
QVERIFY(completions.contains(QLatin1String("Foo1")));
QVERIFY(completions.contains(QLatin1String("Foo2")));
}

View File

@@ -502,7 +502,9 @@ public:
BasicProposalItem *operator()(Symbol *symbol)
{
if (! symbol || ! symbol->name() || symbol->name()->isQualifiedNameId())
//using declaration can be qualified
if (! symbol || ! symbol->name() || (symbol->name()->isQualifiedNameId()
&& ! symbol->asUsingDeclaration()))
return 0;
BasicProposalItem *previousItem = switchCompletionItem(0);

View File

@@ -122,6 +122,7 @@ private slots:
void test_completion_template_specialization_with_pointer();
void test_completion_typedef_using_templates1();
void test_completion_typedef_using_templates2();
void test_completion_namespace_alias_with_many_namespace_declarations();
void test_format_pointerdeclaration_in_simpledeclarations();
void test_format_pointerdeclaration_in_simpledeclarations_data();

View File

@@ -381,8 +381,10 @@ void QmlEngine::tryToConnect(quint16 port)
if (state() == EngineRunRequested) {
if (isSlaveEngine()) {
// Probably cpp is being debugged and hence we did not get the output yet.
if (!masterEngine()->isDying())
if (!masterEngine()->isDying()) {
m_noDebugOutputTimer.setInterval(4000);
m_noDebugOutputTimer.start();
}
else
appStartupFailed(tr("No application output received in time"));
} else {

View File

@@ -158,6 +158,11 @@ ResizeController::ResizeController(const ResizeController &other)
}
ResizeController::ResizeController(const WeakResizeController &resizeController)
: m_data(resizeController.m_data.toStrongRef())
{
}
ResizeController::~ResizeController()
{
}
@@ -263,11 +268,6 @@ FormEditorItem* ResizeController::formEditorItem() const
return m_data->formEditorItem.data();
}
QWeakPointer<ResizeControllerData> ResizeController::weakPointer() const
{
return m_data;
}
bool ResizeController::isTopLeftHandle(const ResizeHandleItem *handle) const
{
return handle == m_data->topLeftItem;
@@ -308,4 +308,41 @@ bool ResizeController::isBottomHandle(const ResizeHandleItem *handle) const
return handle == m_data->bottomItem;
}
WeakResizeController ResizeController::toWeakResizeController() const
{
return WeakResizeController(*this);
}
WeakResizeController::WeakResizeController()
{
}
WeakResizeController::WeakResizeController(const WeakResizeController &resizeController)
: m_data(resizeController.m_data)
{
}
WeakResizeController::WeakResizeController(const ResizeController &resizeController)
: m_data(resizeController.m_data.toWeakRef())
{
}
WeakResizeController::~WeakResizeController()
{
}
WeakResizeController &WeakResizeController::operator =(const WeakResizeController &other)
{
if (m_data != other.m_data)
m_data = other.m_data;
return *this;
}
ResizeController WeakResizeController::toResizeController() const
{
return ResizeController(*this);
}
}

View File

@@ -41,15 +41,17 @@ class LayerItem;
class ResizeHandleItem;
class ResizeControllerData;
class WeakResizeController;
class ResizeController
{
friend class WeakResizeController;
public:
friend class ResizeHandleItem;
ResizeController();
ResizeController(LayerItem *layerItem, FormEditorItem *formEditorItem);
ResizeController(const ResizeController &resizeController);
ResizeController(const WeakResizeController &resizeController);
~ResizeController();
ResizeController& operator=(const ResizeController &other);
@@ -73,13 +75,32 @@ public:
bool isRightHandle(const ResizeHandleItem *handle) const;
bool isBottomHandle(const ResizeHandleItem *handle) const;
WeakResizeController toWeakResizeController() const;
private: // functions
ResizeController(const QSharedPointer<ResizeControllerData> &data);
QWeakPointer<ResizeControllerData> weakPointer() const;
private: // variables
QSharedPointer<ResizeControllerData> m_data;
};
class WeakResizeController
{
friend class ResizeController;
public:
WeakResizeController();
WeakResizeController(const WeakResizeController &resizeController);
WeakResizeController(const ResizeController &resizeController);
~WeakResizeController();
WeakResizeController& operator=(const WeakResizeController &other);
ResizeController toResizeController() const;
private: // variables
QWeakPointer<ResizeControllerData> m_data;
};
}
#endif // RESIZECONTROLLER_H

View File

@@ -36,7 +36,7 @@ namespace QmlDesigner {
ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController &resizeController)
: QGraphicsPixmapItem(QPixmap(":/icon/handle/resize_handle.png"), parent),
m_resizeControllerData(resizeController.weakPointer())
m_weakResizeController(resizeController.toWeakResizeController())
{
setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
setOffset(-pixmap().rect().center());
@@ -44,6 +44,10 @@ ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController
setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
}
ResizeHandleItem::~ResizeHandleItem()
{
}
void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition)
{
m_itemSpacePosition = itemSpacePosition;
@@ -62,8 +66,7 @@ QPainterPath ResizeHandleItem::shape() const
ResizeController ResizeHandleItem::resizeController() const
{
Q_ASSERT(!m_resizeControllerData.isNull());
return ResizeController(m_resizeControllerData.toStrongRef());
return ResizeController(m_weakResizeController.toResizeController());
}
ResizeHandleItem* ResizeHandleItem::fromGraphicsItem(QGraphicsItem *item)

View File

@@ -48,7 +48,7 @@ public:
ResizeHandleItem(QGraphicsItem *parent, const ResizeController &resizeController);
~ResizeHandleItem();
void setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition);
int type() const;
@@ -72,7 +72,7 @@ public:
QPointF itemSpacePosition() const;
private:
QWeakPointer<ResizeControllerData> m_resizeControllerData;
WeakResizeController m_weakResizeController;
QPointF m_itemSpacePosition;
};

View File

@@ -618,6 +618,7 @@ PropertyNameList NavigatorTreeModel::visibleProperties(const ModelNode &node) co
if (!propertyName.contains('.') && //do not show any dot properties, since they are tricky and unlikely to make sense
node.metaInfo().propertyIsWritable(propertyName) && !m_hiddenProperties.contains(propertyName) &&
!node.metaInfo().propertyIsEnumType(propertyName) && //Some enums have the same name as Qml types (e. g. Flow)
!node.metaInfo().propertyIsPrivate(propertyName) && //Do not show private properties
propertyName != node.metaInfo().defaultPropertyName()) { // TODO: ask the node instances
TypeName qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName));

View File

@@ -35,13 +35,6 @@ GroupBox {
caption: "Combo Box"
layout: VerticalLayout {
ColorGroupBox {
text: qsTr("Text")
toolTip: qsTr("The text shown on the combobox")
finished: finishedNotify
backendColor: backendValues.textColor
}
QWidget {
layout: HorizontalLayout {
Label {

View File

@@ -1,94 +1,107 @@
MetaInfo {
Type {
name: "QtDesktop.Button"
name: "QtQuick.Controls.Button"
icon: ":/componentsplugin/images/button16.png"
ItemLibraryEntry {
name: "Button"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/button.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "text"; type: "QString"; value: "Button"; }
}
}
Type {
name: "QtDesktop.CheckBox"
name: "QtQuick.Controls.SpinBox"
icon: ":/componentsplugin/images/window16.png"
ItemLibraryEntry {
name: "SpinBox"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/window.png"
version: "1.0"
requiredImport: "QtQuick.Controls"
}
}
Type {
name: "QtQuick.Controls.CheckBox"
icon: ":/componentsplugin/images/checkbox16.png"
ItemLibraryEntry {
name: "Check Box"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/checkbox.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "text"; type: "QString"; value: "Check Box"; }
}
}
Type {
name: "QtDesktop.RadioButton"
name: "QtQuick.Controls.RadioButton"
icon: ":/componentsplugin/images/radiobutton16.png"
ItemLibraryEntry {
name: "Radio Button"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/radiobutton.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "text"; type: "QString"; value: "Radio Button"; }
}
}
Type {
name: "QtDesktop.ComboBox"
name: "QtQuick.Controls.ComboBox"
icon: ":/componentsplugin/images/combobox16.png"
ItemLibraryEntry {
name: "Combo Box"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/combobox.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
}
}
Type {
name: "QtDesktop.ButtonRow"
name: "QtQuick.Controls.ButtonRow"
icon: ":/componentsplugin/images/buttonrow16.png"
ItemLibraryEntry {
name: "Button Row"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/buttonrow.png"
version: "1.0"
}
}
Type {
name: "QtDesktop.ButtonColumn"
name: "QtQuick.Controls.ButtonColumn"
icon: ":/componentsplugin/images/buttoncolumn16.png"
ItemLibraryEntry {
name: "Button Column"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/buttoncolumn.png"
version: "1.0"
}
}
Type {
name: "QtDesktop.Label"
name: "QtQuick.Controls.Label"
icon: ":/componentsplugin/images/label16.png"
ItemLibraryEntry {
name: "Label"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/label.png"
version: "1.0"
@@ -97,12 +110,12 @@ MetaInfo {
}
Type {
name: "QtDesktop.TextField"
name: "QtQuick.Controls.TextField"
icon: ":/componentsplugin/images/textfield16.png"
ItemLibraryEntry {
name: "Text Field"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/textfield.png"
version: "1.0"
@@ -111,43 +124,43 @@ MetaInfo {
}
Type {
name: "QtDesktop.TextArea"
name: "QtQuick.Controls.TextArea"
icon: ":/componentsplugin/images/textarea16.png"
ItemLibraryEntry {
name: "Text Area"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/textarea.png"
version: "1.0"
}
}
Type {
name: "QtDesktop.ProgressBar"
name: "QtQuick.Controls.ProgressBar"
icon: ":/componentsplugin/images/progressbar16.png"
ItemLibraryEntry {
name: "Progress Bar"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/progressbar.png"
version: "1.0"
}
}
Type {
name: "QtDesktop.Slider"
name: "QtQuick.Controls.Slider"
icon: ":/componentsplugin/images/sliderh16.png"
ItemLibraryEntry {
name: "Slider (Horizontal)"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/sliderh.png"
version: "1.0"
}
ItemLibraryEntry {
name: "Slider (Vertical)"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/sliderh.png"
version: "1.0"
Property { name: "orientation"; type: "int"; value: "0"; }
@@ -155,19 +168,19 @@ MetaInfo {
}
Type {
name: "QtDesktop.ScrollBar"
name: "QtQuick.Controls.ScrollBar"
icon: ":/componentsplugin/images/scrollbar16.png"
ItemLibraryEntry {
name: "Scroll Bar (Horizontal)"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/scrollbarh.png"
version: "1.0"
}
ItemLibraryEntry {
name: "Scroll Bar (Vertical)"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/scrollbarv.png"
version: "1.0"
Property { name: "orientation"; type: "int"; value: "0"; }
@@ -175,15 +188,15 @@ MetaInfo {
}
Type {
name: "QtDesktop.ScrollArea"
icon: ":/desktopplugin//images/window16.png"
name: "QtQuick.Controls.ScrollArea"
icon: ":/componentsplugin/images/window16.png"
ItemLibraryEntry {
name: "Scroll Area"
category: "Qt Quick - Components"
libraryIcon: ":/desktopplugin/images/window.png"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/window.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 360; }
Property { name: "height"; type: "int"; value: 300; }
@@ -191,15 +204,15 @@ MetaInfo {
}
Type {
name: "QtDesktop.GroupBox"
icon: ":/desktopplugin//images/window16.png"
name: "QtQuick.Controls.GroupBox"
icon: ":/componentsplugin/images/window16.png"
ItemLibraryEntry {
name: "Group Box"
category: "Qt Quick - Components"
libraryIcon: ":/desktopplugin/images/window.png"
category: "Qt Quick - Controls"
libraryIcon: ":/componentsplugin/images/window.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 360; }
Property { name: "height"; type: "int"; value: 300; }
@@ -207,15 +220,15 @@ MetaInfo {
}
Type {
name: "QtDesktop.Frame"
name: "QtQuick.Controls.Frame"
icon: ":/desktopplugin//images/window16.png"
ItemLibraryEntry {
name: "Frame"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/desktopplugin/images/window.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 360; }
Property { name: "height"; type: "int"; value: 300; }
@@ -223,15 +236,15 @@ MetaInfo {
}
Type {
name: "QtDesktop.ToolBar"
name: "QtQuick.Controls.ToolBar"
icon: ":/desktopplugin/images/toolbar16.png"
ItemLibraryEntry {
name: "Tool Bar"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
libraryIcon: ":/desktopplugin/images/toolbar.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 360; }
Property { name: "height"; type: "int"; value: 50; }
@@ -239,15 +252,15 @@ MetaInfo {
}
Type {
name: "QtDesktop.Dial"
name: "QtQuick.Controls.Dial"
//icon: ":/desktopplugin/images/progressbar16.png"
ItemLibraryEntry {
name: "Dial"
category: "Qt Quick - Components"
category: "Qt Quick - Controls"
//libraryIcon: ":/desktopplugin/images/progressbar.png"
version: "1.0"
requiredImport: "QtDesktop"
requiredImport: "QtQuick.Controls"
Property { name: "width"; type: "int"; value: 100; }
Property { name: "height"; type: "int"; value: 100; }

View File

@@ -36,12 +36,12 @@
<file>images/window.png</file>
<file>images/window16.png</file>
</qresource>
<qresource prefix="/propertyeditor">
<file>QtDesktop/ButtonSpecifics.qml</file>
<file>QtDesktop/TextFieldSpecifics.qml</file>
<file>QtDesktop/TextAreaSpecifics.qml</file>
<file>QtDesktop/ComboBoxSpecifics.qml</file>
<file>QtDesktop/CheckBoxSpecifics.qml</file>
<file>QtDesktop/RadioButtonSpecifics.qml</file>
<qresource prefix="/propertyeditor/QtQuick">
<file>Controls/ButtonSpecifics.qml</file>
<file>Controls/TextFieldSpecifics.qml</file>
<file>Controls/TextAreaSpecifics.qml</file>
<file>Controls/ComboBoxSpecifics.qml</file>
<file>Controls/CheckBoxSpecifics.qml</file>
<file>Controls/RadioButtonSpecifics.qml</file>
</qresource>
</RCC>

View File

@@ -42,13 +42,15 @@ AddPropertyVisitor::AddPropertyVisitor(QmlDesigner::TextModifier &modifier,
const QmlDesigner::PropertyName &name,
const QString &value,
QmlRefactoring::PropertyType propertyType,
const PropertyNameList &propertyOrder):
const PropertyNameList &propertyOrder,
const QmlDesigner::TypeName &dynamicTypeName) :
QMLRewriter(modifier),
m_parentLocation(parentLocation),
m_name(name),
m_value(value),
m_propertyType(propertyType),
m_propertyOrder(propertyOrder)
m_propertyOrder(propertyOrder),
m_dynamicTypeName(dynamicTypeName)
{
}
@@ -147,6 +149,9 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ
Q_ASSERT(!"unknown property type");
}
if (!m_dynamicTypeName.isEmpty())
newPropertyTemplate.prepend(QString(QLatin1String("property %1 ")).arg(QString::fromUtf8(m_dynamicTypeName)));
if (isOneLiner) {
if (needsPreceedingSemicolon)
newPropertyTemplate.prepend(QLatin1Char(';'));

View File

@@ -45,7 +45,8 @@ public:
const QmlDesigner::PropertyName &name,
const QString &value,
QmlDesigner::QmlRefactoring::PropertyType propertyType,
const PropertyNameList &propertyOrder);
const PropertyNameList &propertyOrder,
const QmlDesigner::TypeName &dynamicTypeName);
protected:
virtual bool visit(QmlJS::AST::UiObjectDefinition *ast);
@@ -60,6 +61,7 @@ private:
QString m_value;
QmlRefactoring::PropertyType m_propertyType;
PropertyNameList m_propertyOrder;
QmlDesigner::TypeName m_dynamicTypeName;
};
} // namespace Internal

View File

@@ -103,12 +103,16 @@ bool QmlRefactoring::addToObjectMemberList(int parentLocation, const QString &co
return visit(qmlDocument->qmlProgram());
}
bool QmlRefactoring::addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType)
bool QmlRefactoring::addProperty(int parentLocation,
const PropertyName &name,
const QString &value,
PropertyType propertyType,
const TypeName &dynamicTypeName)
{
if (parentLocation < 0)
return false;
AddPropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType, m_propertyOrder);
AddPropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType, m_propertyOrder, dynamicTypeName);
return visit(qmlDocument->qmlProgram());
}

View File

@@ -60,7 +60,11 @@ public:
bool addToArrayMemberList(int parentLocation, const PropertyName &propertyName, const QString &content);
bool addToObjectMemberList(int parentLocation, const QString &content);
bool addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType);
bool addProperty(int parentLocation,
const PropertyName &name,
const QString &value,
PropertyType propertyType,
const TypeName &dynamicTypeName = TypeName());
bool changeProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType);
bool changeObjectType(int nodeLocation, const QString &newType);

View File

@@ -79,6 +79,7 @@ public:
bool propertyIsWritable(const PropertyName &propertyName) const;
bool propertyIsListProperty(const PropertyName &propertyName) const;
bool propertyIsEnumType(const PropertyName &propertyName) const;
bool propertyIsPrivate(const PropertyName &propertyName) const;
QString propertyEnumScope(const PropertyName &propertyName) const;
QStringList propertyKeysForEnum(const PropertyName &propertyName) const;
QVariant propertyCastedValue(const PropertyName &propertyName, const QVariant &value) const;

View File

@@ -593,7 +593,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
return cppValue;
}
return 0;
return value_cast<CppComponentValue>(getObjectValue());
}
const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const
@@ -1129,6 +1129,11 @@ bool NodeMetaInfo::propertyIsEnumType(const PropertyName &propertyName) const
return m_privateData->isPropertyEnum(propertyName);
}
bool NodeMetaInfo::propertyIsPrivate(const PropertyName &propertyName) const
{
return propertyName.startsWith("__");
}
QString NodeMetaInfo::propertyEnumScope(const PropertyName &propertyName) const
{
return m_privateData->propertyEnumScope(propertyName);

View File

@@ -62,6 +62,9 @@ void BindingProperty::setExpression(const QString &expression)
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (isDynamic())
qWarning() << "Calling BindingProperty::setExpression on dynamic property.";
if (name() == "id") { // the ID for a node is independent of the state, so it has to be set with ModelNode::setId
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name());
}

View File

@@ -124,7 +124,7 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c
}
}
if (!model()->imports().contains(newImport))
if (!model()->hasImport(newImport, true, true))
model()->changeImports(QList<Import>() << newImport, QList<Import>());
QList<QPair<PropertyName, QVariant> > propertyPairList;
@@ -140,8 +140,13 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c
}
propertyPairList.append(qMakePair(PropertyName("source"), QVariant(relativeImageName)));
newNode = createQmlItemNode("QtQuick.Image", -1, -1, propertyPairList);
parentNode.nodeAbstractProperty("data").reparentHere(newNode);
NodeMetaInfo metaInfo = model()->metaInfo("QtQuick.Image");
if (metaInfo.isValid()) {
int minorVersion = metaInfo.minorVersion();
int majorVersion = metaInfo.majorVersion();
newNode = createQmlItemNode("QtQuick.Image", majorVersion, minorVersion, propertyPairList);
parentNode.nodeAbstractProperty("data").reparentHere(newNode);
}
Q_ASSERT(newNode.isValid());

View File

@@ -230,10 +230,21 @@ QString QmlTextGenerator::propertyToQml(const AbstractProperty &property, int in
{
QString result;
if (property.isDefaultProperty())
if (property.isDefaultProperty()) {
result = toQml(property, indentDepth);
else
result = QString(indentDepth, QLatin1Char(' ')) + property.name() + QLatin1String(": ") + toQml(property, indentDepth);
} else {
if (property.isDynamic()) {
result = QString(indentDepth, QLatin1Char(' '))
+ QLatin1String("property ")
+ property.dynamicTypeName()
+ QLatin1String(" ")
+ property.name()
+ QLatin1String(": ")
+ toQml(property, indentDepth);
} else {
result = QString(indentDepth, QLatin1Char(' ')) + property.name() + QLatin1String(": ") + toQml(property, indentDepth);
}
}
result += QLatin1Char('\n');

View File

@@ -107,7 +107,7 @@ bool AddPropertyRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePos
<< info();
}
} else {
result = refactoring.addProperty(nodeLocation, m_property.name(), m_valueText, m_propertyType);
result = refactoring.addProperty(nodeLocation, m_property.name(), m_valueText, m_propertyType, m_property.dynamicTypeName());
if (!result) {
qDebug() << "*** AddPropertyRewriteAction::execute failed in addProperty("

View File

@@ -69,7 +69,7 @@ namespace {
static inline QStringList supportedVersionsList()
{
QStringList list;
list << QLatin1String("1.0") << QLatin1String("1.1") << QLatin1String("2.0");
list << QLatin1String("1.0") << QLatin1String("1.1") << QLatin1String("2.0") << QLatin1String("2.1");
return list;
}
@@ -776,9 +776,9 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
check.disableMessage(StaticAnalysis::ErrCouldNotResolvePrototypeOf);
foreach (StaticAnalysis::Type type, StaticAnalysis::Message::allMessageTypes()) {
StaticAnalysis::Message message(type, AST::SourceLocation());
if (message.severity == StaticAnalysis::MaybeWarning
|| message.severity == StaticAnalysis::Warning) {
StaticAnalysis::PrototypeMessageData prototypeMessageData = StaticAnalysis::Message::prototypeForMessageType(type);
if (prototypeMessageData.severity == StaticAnalysis::MaybeWarning
|| prototypeMessageData.severity == StaticAnalysis::Warning) {
check.disableMessage(type);
}
}
@@ -1358,10 +1358,9 @@ void ModelValidator::signalHandlerSourceDiffer(SignalHandlerProperty &modelPrope
Q_ASSERT(0);
}
void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString &javascript)
void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString & /*javascript*/)
{
Q_UNUSED(modelProperty)
Q_UNUSED(javascript)
Q_ASSERT(modelProperty.isSignalHandlerProperty());
Q_ASSERT(0);
}

View File

@@ -61,6 +61,9 @@ void VariantProperty::setValue(const QVariant &value)
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (isDynamic())
qWarning() << "Calling VariantProperty::setValue on dynamic property.";
if (value.isNull())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name());

View File

@@ -51,7 +51,7 @@ BlackBerryDebugTokenRequestDialog::BlackBerryDebugTokenRequestDialog(
m_ui->setupUi(this);
m_ui->progressBar->hide();
m_ui->status->clear();
m_ui->debugTokenPath->setExpectedKind(Utils::PathChooser::Any);
m_ui->debugTokenPath->setExpectedKind(Utils::PathChooser::SaveFile);
m_ui->debugTokenPath->setPromptDialogTitle(tr("Request Debug Token"));
m_ui->debugTokenPath->setPromptDialogFilter(tr("BAR Files (*.bar)"));
@@ -67,8 +67,12 @@ BlackBerryDebugTokenRequestDialog::BlackBerryDebugTokenRequestDialog(
this, SLOT(requestDebugToken()));
connect(m_ui->debugTokenPath, SIGNAL(changed(QString)),
this, SLOT(validate()));
connect(m_ui->debugTokenPath, SIGNAL(beforeBrowsing()),
this, SLOT(setDefaultPath()));
connect(m_ui->debugTokenPath, SIGNAL(editingFinished()),
this, SLOT(appendExtension()));
connect(m_ui->debugTokenPath, SIGNAL(editingFinished()),
this, SLOT(expandPath()));
connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)),
this, SLOT(validate()));
connect(m_ui->cskPassword, SIGNAL(textChanged(QString)),
@@ -133,16 +137,47 @@ void BlackBerryDebugTokenRequestDialog::requestDebugToken()
m_ui->keystorePassword->text(), m_ui->devicePin->text());
}
void BlackBerryDebugTokenRequestDialog::setDefaultPath()
{
const QString path = m_ui->debugTokenPath->path();
const QString defaultFileName = QLatin1String("/debugToken.bar");
if (path.isEmpty()) {
m_ui->debugTokenPath->setPath(QDir::homePath() + defaultFileName);
return;
}
const QFileInfo fileInfo(path);
if (fileInfo.isDir())
m_ui->debugTokenPath->setPath(path + defaultFileName);
}
void BlackBerryDebugTokenRequestDialog::appendExtension()
{
QString path = m_ui->debugTokenPath->path();
if (path.isEmpty())
return;
if (!path.endsWith(QLatin1String(".bar"))) {
path += QLatin1String(".bar");
m_ui->debugTokenPath->setPath(path);
}
}
void BlackBerryDebugTokenRequestDialog::expandPath()
{
const QString path = m_ui->debugTokenPath->path();
if (path.isEmpty() || path.startsWith(QLatin1String("/")))
return;
const QFileInfo fileInfo(path);
m_ui->debugTokenPath->setPath(fileInfo.absoluteFilePath());
}
void BlackBerryDebugTokenRequestDialog::checkBoxChanged(int state)
{
if (state == Qt::Checked) {

View File

@@ -57,7 +57,9 @@ public:
private slots:
void validate();
void requestDebugToken();
void setDefaultPath();
void appendExtension();
void expandPath();
void checkBoxChanged(int state);
void debugTokenArrived(int status);

View File

@@ -2154,7 +2154,7 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
result.executable = QDir::cleanPath(destDir + QLatin1Char('/') + result.target);
//qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable;
Utils::HostOsInfo::appendExecutableSuffix(result.executable);
result.executable = Utils::HostOsInfo::withExecutableSuffix(result.executable);
result.valid = true;
if (readerBP)
@@ -2234,7 +2234,7 @@ QString Qt4ProFileNode::buildDir(Qt4BuildConfiguration *bc) const
bc = static_cast<Qt4BuildConfiguration *>(m_project->activeTarget()->activeBuildConfiguration());
if (!bc)
return QString();
return QDir(bc->buildDirectory()).absoluteFilePath(relativeDir);
return QDir::cleanPath(QDir(bc->buildDirectory()).absoluteFilePath(relativeDir));
}
void Qt4ProFileNode::updateCodeModelSupportFromBuild()

View File

@@ -108,7 +108,7 @@ void TodoItemsProvider::createScanners()
void TodoItemsProvider::setItemsListWithinStartupProject()
{
QHashIterator<QString, QList<TodoItem> > it(m_itemsHash);
QStringList fileNames = m_startupProject->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
QSet<QString> fileNames = QSet<QString>::fromList(m_startupProject->files(ProjectExplorer::Project::ExcludeGeneratedFiles));
while (it.hasNext()) {
it.next();
if (fileNames.contains(it.key()))

View File

@@ -176,9 +176,14 @@ private slots:
void test_checksymbols_StaticUse();
void test_checksymbols_VariableHasTheSameNameAsEnumUse();
void test_checksymbols_NestedClassOfEnclosingTemplateUse();
void test_checksymbols_8902_staticFunctionHighlightingAsMember_localVariable();
void test_checksymbols_8902_staticFunctionHighlightingAsMember_functionArgument();
void test_checksymbols_8902_staticFunctionHighlightingAsMember_templateParameter();
void test_checksymbols_8902_staticFunctionHighlightingAsMember_struct();
void test_checksymbols_QTCREATORBUG8890_danglingPointer();
void test_checksymbols_QTCREATORBUG8974_danglingPointer();
void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006();
};
void tst_CheckSymbols::test_checksymbols_TypeUse()
@@ -445,6 +450,112 @@ void tst_CheckSymbols::test_checksymbols_NestedClassOfEnclosingTemplateUse()
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_localVariable()
{
const QByteArray source =
"struct Foo\n"
"{\n"
" static int foo();\n"
"};\n"
"\n"
"void bar()\n"
"{\n"
" int foo = Foo::foo();\n"
"}\n"
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 3, SemanticInfo::TypeUse)
<< Use(3, 16, 3, SemanticInfo::FunctionUse)
<< Use(6, 6, 3, SemanticInfo::FunctionUse)
<< Use(8, 9, 3, SemanticInfo::LocalUse)
<< Use(8, 15, 3, SemanticInfo::TypeUse)
<< Use(8, 20, 3, SemanticInfo::FunctionUse)
;
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_functionArgument()
{
const QByteArray source =
"struct Foo\n"
"{\n"
" static int foo();\n"
"};\n"
"\n"
"void bar(int foo)\n"
"{\n"
" Foo::foo();\n"
"}\n"
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 3, SemanticInfo::TypeUse)
<< Use(3, 16, 3, SemanticInfo::FunctionUse)
<< Use(6, 6, 3, SemanticInfo::FunctionUse)
<< Use(6, 14, 3, SemanticInfo::LocalUse)
<< Use(8, 5, 3, SemanticInfo::TypeUse)
<< Use(8, 10, 3, SemanticInfo::FunctionUse)
;
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_templateParameter()
{
const QByteArray source =
"struct Foo\n"
"{\n"
" static int foo();\n"
"};\n"
"\n"
"template <class foo>\n"
"void bar()\n"
"{\n"
" Foo::foo();\n"
"}\n"
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 3, SemanticInfo::TypeUse)
<< Use(3, 16, 3, SemanticInfo::FunctionUse)
<< Use(6, 17, 3, SemanticInfo::TypeUse)
<< Use(7, 6, 3, SemanticInfo::FunctionUse)
<< Use(9, 5, 3, SemanticInfo::TypeUse)
<< Use(9, 10, 3, SemanticInfo::FunctionUse)
;
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_struct()
{
const QByteArray source =
"struct Foo\n"
"{\n"
" static int foo();\n"
"};\n"
"\n"
"struct foo {};\n"
"void bar()\n"
"{\n"
" Foo::foo();\n"
"}\n"
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 3, SemanticInfo::TypeUse)
<< Use(3, 16, 3, SemanticInfo::FunctionUse)
<< Use(6, 8, 3, SemanticInfo::TypeUse)
<< Use(7, 6, 3, SemanticInfo::FunctionUse)
<< Use(9, 5, 3, SemanticInfo::TypeUse)
<< Use(9, 10, 3, SemanticInfo::FunctionUse)
;
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_QTCREATORBUG8890_danglingPointer()
{
const QByteArray source =
@@ -1233,5 +1344,51 @@ void tst_CheckSymbols::test_checksymbols_QTCREATORBUG8974_danglingPointer()
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006()
{
const QByteArray source =
"struct Foo { int foo; };\n"
"\n"
"template<class T>\n"
"struct Outer\n"
"{\n"
" struct Nested\n"
" {\n"
" const T &operator*() { return t; }\n"
" T t;\n"
" };\n"
"};\n"
"\n"
"void bug()\n"
"{\n"
" Outer<Foo>::Nested nested;\n"
" (*nested).foo;\n"
"}\n"
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 3, SemanticInfo::TypeUse)
<< Use(1, 18, 3, SemanticInfo::FieldUse)
<< Use(3, 16, 1, SemanticInfo::TypeUse)
<< Use(4, 8, 5, SemanticInfo::TypeUse)
<< Use(6, 10, 6, SemanticInfo::TypeUse)
<< Use(8, 11, 1, SemanticInfo::TypeUse)
<< Use(8, 14, 8, SemanticInfo::FunctionUse)
<< Use(8, 35, 1, SemanticInfo::FieldUse)
<< Use(9, 5, 1, SemanticInfo::TypeUse)
<< Use(9, 7, 1, SemanticInfo::FieldUse)
<< Use(13, 6, 3, SemanticInfo::FunctionUse)
<< Use(15, 3, 5, SemanticInfo::TypeUse)
<< Use(15, 9, 3, SemanticInfo::TypeUse)
<< Use(15, 15, 6, SemanticInfo::TypeUse)
<< Use(15, 22, 6, SemanticInfo::LocalUse)
<< Use(16, 5, 6, SemanticInfo::LocalUse)
<< Use(16, 13, 3, SemanticInfo::FieldUse)
;
TestData::check(source, expectedUses);
}
QTEST_APPLESS_MAIN(tst_CheckSymbols)
#include "tst_checksymbols.moc"

View File

@@ -94,6 +94,8 @@ private Q_SLOTS:
// templates
void instantiateTemplateWithNestedClass();
void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006();
void operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005();
};
void tst_FindUsages::inlineMethod()
@@ -444,5 +446,94 @@ void tst_FindUsages::instantiateTemplateWithNestedClass()
QCOMPARE(findUsages.usages().size(), 2);
}
void tst_FindUsages::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006()
{
const QByteArray src = "\n"
"struct Foo { int foo; };\n"
"\n"
"template<class T>\n"
"struct Outer\n"
"{\n"
" struct Nested\n"
" {\n"
" const T &operator*() { return t; }\n"
" T t;\n"
" };\n"
"};\n"
"\n"
"void bug()\n"
"{\n"
" Outer<Foo>::Nested nested;\n"
" (*nested).foo;\n"
"}\n"
;
Document::Ptr doc = Document::create("operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006");
doc->setUtf8Source(src);
doc->parse();
doc->check();
QVERIFY(doc->diagnosticMessages().isEmpty());
QCOMPARE(doc->globalSymbolCount(), 3U);
Snapshot snapshot;
snapshot.insert(doc);
Class *classFoo = doc->globalSymbolAt(0)->asClass();
QVERIFY(classFoo);
QCOMPARE(classFoo->memberCount(), 1U);
Declaration *fooDeclaration = classFoo->memberAt(0)->asDeclaration();
QVERIFY(fooDeclaration);
QCOMPARE(fooDeclaration->name()->identifier()->chars(), "foo");
FindUsages findUsages(src, doc, snapshot);
findUsages(fooDeclaration);
QCOMPARE(findUsages.usages().size(), 2);
}
void tst_FindUsages::operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005()
{
const QByteArray src = "\n"
"struct Foo { int foo; };\n"
"\n"
"template<class T>\n"
"struct Outer\n"
"{\n"
" struct Nested\n"
" {\n"
" T *operator->() { return 0; }\n"
" };\n"
"};\n"
"\n"
"void bug()\n"
"{\n"
" Outer<Foo>::Nested nested;\n"
" nested->foo;\n"
"}\n"
;
Document::Ptr doc = Document::create("operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005");
doc->setUtf8Source(src);
doc->parse();
doc->check();
QVERIFY(doc->diagnosticMessages().isEmpty());
QCOMPARE(doc->globalSymbolCount(), 3U);
Snapshot snapshot;
snapshot.insert(doc);
Class *classFoo = doc->globalSymbolAt(0)->asClass();
QVERIFY(classFoo);
QCOMPARE(classFoo->memberCount(), 1U);
Declaration *fooDeclaration = classFoo->memberAt(0)->asDeclaration();
QVERIFY(fooDeclaration);
QCOMPARE(fooDeclaration->name()->identifier()->chars(), "foo");
FindUsages findUsages(src, doc, snapshot);
findUsages(fooDeclaration);
QCOMPARE(findUsages.usages().size(), 2);
}
QTEST_APPLESS_MAIN(tst_FindUsages)
#include "tst_findusages.moc"

View File

@@ -1,53 +1,37 @@
# for easier re-usage (because Python hasn't an enum type)
class QtQuickConstants:
class Components:
BUILTIN = 1
MEEGO_HARMATTAN = 2
EXISTING_QML = 4
import operator
class Targets:
DESKTOP_474_GCC = 1
SIMULATOR = 2
MAEMO5 = 4
HARMATTAN = 8
EMBEDDED_LINUX = 16
DESKTOP_474_MSVC2008 = 32
DESKTOP_501_DEFAULT = 64
# for easier re-usage (because Python hasn't an enum type)
class Targets:
DESKTOP_474_GCC = 1
SIMULATOR = 2
MAEMO5 = 4
HARMATTAN = 8
EMBEDDED_LINUX = 16
DESKTOP_474_MSVC2008 = 32
DESKTOP_501_DEFAULT = 64
@staticmethod
def desktopTargetClasses():
desktopTargets = QtQuickConstants.Targets.DESKTOP_474_GCC \
| QtQuickConstants.Targets.DESKTOP_501_DEFAULT
desktopTargets = Targets.DESKTOP_474_GCC | Targets.DESKTOP_501_DEFAULT
if platform.system() in ('Windows', 'Microsoft'):
desktopTargets |= QtQuickConstants.Targets.DESKTOP_474_MSVC2008
desktopTargets |= Targets.DESKTOP_474_MSVC2008
return desktopTargets
@staticmethod
def getStringForComponents(components):
if components==QtQuickConstants.Components.BUILTIN:
return "Built-in elements only (for all platforms)"
elif components==QtQuickConstants.Components.MEEGO_HARMATTAN:
return "Qt Quick Components for Meego/Harmattan"
elif components==QtQuickConstants.Components.EXISTING_QML:
return "Use an existing .qml file"
else:
return None
@staticmethod
def getStringForTarget(target):
if target==QtQuickConstants.Targets.DESKTOP_474_GCC:
if target == Targets.DESKTOP_474_GCC:
return "Desktop 474 GCC"
elif target==QtQuickConstants.Targets.MAEMO5:
elif target == Targets.MAEMO5:
return "Fremantle"
elif target==QtQuickConstants.Targets.SIMULATOR:
elif target == Targets.SIMULATOR:
return "Qt Simulator"
elif target==QtQuickConstants.Targets.HARMATTAN:
elif target == Targets.HARMATTAN:
return "Harmattan"
elif target==QtQuickConstants.Targets.EMBEDDED_LINUX:
elif target == Targets.EMBEDDED_LINUX:
return "Embedded Linux"
elif target==QtQuickConstants.Targets.DESKTOP_474_MSVC2008:
elif target == Targets.DESKTOP_474_MSVC2008:
return "Desktop 474 MSVC2008"
elif target==QtQuickConstants.Targets.DESKTOP_501_DEFAULT:
elif target == Targets.DESKTOP_501_DEFAULT:
return "Desktop 501 default"
else:
return None
@@ -57,11 +41,22 @@ class QtQuickConstants:
if not isinstance(targets, (tuple,list)):
test.fatal("Wrong usage... This function handles only tuples or lists.")
return None
result = map(QtQuickConstants.getStringForTarget, targets)
result = map(Targets.getStringForTarget, targets)
if None in result:
test.fatal("You've passed at least one unknown target!")
return result
@staticmethod
def intToArray(targets):
available = [Targets.DESKTOP_474_GCC, Targets.SIMULATOR, Targets.MAEMO5, Targets.HARMATTAN,
Targets.EMBEDDED_LINUX, Targets.DESKTOP_474_MSVC2008,
Targets.DESKTOP_501_DEFAULT]
return filter(lambda x: x & targets == x, available)
@staticmethod
def arrayToInt(targetArr):
return reduce(operator.or_, targetArr, 0)
# this class holds some constants for easier usage inside the Projects view
class ProjectSettings:
BUILD = 1

View File

@@ -12,7 +12,7 @@ def __handleProcessExited__(object, exitCode):
global processExited
processExited = True
def openQmakeProject(projectPath, targets=QtQuickConstants.desktopTargetClasses(), fromWelcome=False):
def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWelcome=False):
cleanUpUserFiles(projectPath)
if fromWelcome:
mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
@@ -112,7 +112,7 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
# param checks turns tests in the function on if set to True
# param available a list holding the available targets
def __selectQtVersionDesktop__(checks, available=None):
checkedTargets = __chooseTargets__(QtQuickConstants.desktopTargetClasses(), available)
checkedTargets = __chooseTargets__(Targets.desktopTargetClasses(), available)
if checks:
cbObject = ("{type='QCheckBox' text='%s' unnamed='1' visible='1' "
"container={type='Utils::DetailsWidget' visible='1' unnamed='1'}}")
@@ -204,7 +204,7 @@ def createProject_Qt_Console(path, projectName, checks = True):
return checkedTargets
def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None,
targets=QtQuickConstants.desktopTargetClasses(), qtQuickVersion=1,
targets=Targets.desktopTargetClasses(), qtQuickVersion=1,
fromWelcome=False):
if templateFile:
available = __createProjectOrFileSelectType__(" Applications", "Qt Quick %d Application (from Existing QML File)"
@@ -240,7 +240,7 @@ def createNewQmlExtension(workingDir):
if workingDir == None:
workingDir = tempDir()
__createProjectSetNameAndPath__(workingDir)
checkedTargets = __chooseTargets__(QtQuickConstants.Targets.DESKTOP_474_GCC, available)
checkedTargets = __chooseTargets__(Targets.DESKTOP_474_GCC, available)
nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton)
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} "
@@ -253,51 +253,39 @@ def createNewQmlExtension(workingDir):
__createProjectHandleLastPage__()
return checkedTargets
# parameter components can only be one of the Constants defined in QtQuickConstants.Components
def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN):
rbComponentToChoose = waitForObject("{type='QRadioButton' text='%s' visible='1'}"
% QtQuickConstants.getStringForComponents(components))
if rbComponentToChoose.checked:
test.passes("Selected QRadioButton is '%s'" % QtQuickConstants.getStringForComponents(components))
else:
clickButton(rbComponentToChoose)
test.verify(rbComponentToChoose.checked, "Selected QRadioButton is '%s'"
% QtQuickConstants.getStringForComponents(components))
# parameter target can be an OR'd value of QtQuickConstants.Targets
# parameter target can be an OR'd value of Targets
# parameter availableTargets should be the result of __createProjectSelectType__()
# or use None as a fallback
def __chooseTargets__(targets=QtQuickConstants.Targets.DESKTOP_474_GCC, availableTargets=None,
def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None,
isMaddeDisabled=True):
if availableTargets != None:
available = availableTargets
else:
# following targets depend on the build environment - added for further/later tests
available = [QtQuickConstants.Targets.DESKTOP_474_GCC, QtQuickConstants.Targets.DESKTOP_501_DEFAULT,
QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.EMBEDDED_LINUX,
QtQuickConstants.Targets.SIMULATOR, QtQuickConstants.Targets.HARMATTAN]
available = [Targets.DESKTOP_474_GCC, Targets.DESKTOP_501_DEFAULT, Targets.MAEMO5,
Targets.EMBEDDED_LINUX, Targets.SIMULATOR, Targets.HARMATTAN]
if platform.system() in ('Windows', 'Microsoft'):
available.remove(QtQuickConstants.Targets.EMBEDDED_LINUX)
available.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008)
available.remove(Targets.EMBEDDED_LINUX)
available.append(Targets.DESKTOP_474_MSVC2008)
if isMaddeDisabled:
for target in filter(lambda x: x in available,
(QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.HARMATTAN)):
(Targets.MAEMO5, Targets.HARMATTAN)):
available.remove(target)
checkedTargets = []
for current in available:
mustCheck = targets & current == current
try:
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % QtQuickConstants.getStringForTarget(current),
ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current),
mustCheck, 3000)
if (mustCheck):
checkedTargets.append(current)
except LookupError:
if mustCheck:
test.fail("Failed to check target '%s'." % QtQuickConstants.getStringForTarget(current))
test.fail("Failed to check target '%s'." % Targets.getStringForTarget(current))
else:
# Simulator has been added without knowing whether configured or not - so skip warning here?
if current != QtQuickConstants.Targets.SIMULATOR:
test.warning("Target '%s' is not set up correctly." % QtQuickConstants.getStringForTarget(current))
if current != Targets.Targets.SIMULATOR:
test.warning("Target '%s' is not set up correctly." % Targets.getStringForTarget(current))
return checkedTargets
# run and close an application
@@ -453,7 +441,7 @@ def resetApplicationContextToCreator():
# Simulator must be handled in a special way, because this depends on the
# configured Qt versions and Toolchains and cannot be looked up the same way
# if you set getAsStrings to True this function returns a list of strings instead
# of the constants defined in QtQuickConstants.Targets
# of the constants defined in Targets
def __getSupportedPlatforms__(text, getAsStrings=False):
reqPattern = re.compile("requires qt (?P<version>\d+\.\d+(\.\d+)?)", re.IGNORECASE)
res = reqPattern.search(text)
@@ -465,31 +453,30 @@ def __getSupportedPlatforms__(text, getAsStrings=False):
supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split(" ")
result = []
if 'Desktop' in supports:
result.append(QtQuickConstants.Targets.DESKTOP_474_GCC)
result.append(QtQuickConstants.Targets.DESKTOP_501_DEFAULT)
result.append(Targets.DESKTOP_474_GCC)
result.append(Targets.DESKTOP_501_DEFAULT)
if platform.system() in ("Linux", "Darwin"):
result.append(QtQuickConstants.Targets.EMBEDDED_LINUX)
result.append(Targets.EMBEDDED_LINUX)
elif platform.system() in ('Windows', 'Microsoft'):
result.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008)
result.append(Targets.DESKTOP_474_MSVC2008)
if 'MeeGo/Harmattan' in supports:
result.append(QtQuickConstants.Targets.HARMATTAN)
result.append(Targets.HARMATTAN)
if 'Maemo/Fremantle' in supports:
result.append(QtQuickConstants.Targets.MAEMO5)
result.append(Targets.MAEMO5)
if not re.search("custom Qt Creator plugin", text):
result.append(QtQuickConstants.Targets.SIMULATOR)
result.append(Targets.SIMULATOR)
elif 'Platform independent' in text:
# MAEMO5 and HARMATTAN could be wrong here - depends on having Madde plugin enabled or not
result = [QtQuickConstants.Targets.DESKTOP_474_GCC, QtQuickConstants.Targets.DESKTOP_501_DEFAULT,
QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.SIMULATOR,
QtQuickConstants.Targets.HARMATTAN]
result = [Targets.DESKTOP_474_GCC, Targets.DESKTOP_501_DEFAULT, Targets.MAEMO5,
Targets.SIMULATOR, Targets.HARMATTAN]
if platform.system() in ('Windows', 'Microsoft'):
result.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008)
result.append(Targets.DESKTOP_474_MSVC2008)
else:
test.warning("Returning None (__getSupportedPlatforms__())",
"Parsed text: '%s'" % text)
return None, None
if getAsStrings:
result = QtQuickConstants.getTargetsAsStrings(result)
result = Targets.getTargetsAsStrings(result)
return result, version
# copy example project (sourceExample is path to project) to temporary directory inside repository

View File

@@ -344,8 +344,7 @@ def getConfiguredKits(isMaddeDisabled=True):
targetInfo = result[targetName]
if targetInfo[0] == "Maemo":
result.update({targetName:
(QtQuickConstants.getStringForTarget(QtQuickConstants.Targets.MAEMO5),
targetInfo[1])})
(Targets.getStringForTarget(Targets.MAEMO5), targetInfo[1])})
test.log("Configured kits: %s" % str(result))
return result
@@ -409,7 +408,7 @@ def checkDebuggingLibrary(kitIDs):
# end of internal function for iterateQtVersions
kits, qtv = iterateKits(True, False, __getQtVersionForKit__)
qtVersionsOfKits = zip(kits, qtv)
wantedKits = QtQuickConstants.getTargetsAsStrings(kitIDs)
wantedKits = Targets.getTargetsAsStrings(kitIDs)
kitsQtV = dict([i for i in qtVersionsOfKits if i[0] in wantedKits])
tv, builtAndFailedList = iterateQtVersions(False, True, __checkDebugLibsInternalFunc__, kitsQtV)
built = failed = 0

View File

@@ -7,16 +7,14 @@ def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
targets = [QtQuickConstants.Targets.DESKTOP_474_GCC]
if platform.system() in ('Windows', 'Microsoft'):
targets.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008)
if not checkDebuggingLibrary(targets):
targets = Targets.desktopTargetClasses()
if not checkDebuggingLibrary(Targets.intToArray(targets)):
test.fatal("Error while checking debugging libraries - leaving this test.")
invokeMenuItem("File", "Exit")
return
# using a temporary directory won't mess up a potentially existing
workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir)
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if placeCursorToLine(editor, "MouseArea.*", True):
type(editor, '<Up>')

View File

@@ -17,9 +17,9 @@ def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
suitableKits = QtQuickConstants.Targets.DESKTOP_474_GCC
suitableKits = Targets.DESKTOP_474_GCC
if platform.system() in ('Windows', 'Microsoft'):
suitableKits |= QtQuickConstants.Targets.DESKTOP_474_MSVC2008
suitableKits |= Targets.DESKTOP_474_MSVC2008
checkedTargets = openQmakeProject(SpeedCrunchPath, suitableKits)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")

View File

@@ -38,8 +38,7 @@ def performTest(templateDir, qmlFile, isMaddeDisabled):
comboBox = findObject("{name='comboBox' type='QComboBox' visible='1' "
"window=':New_Core::Internal::NewDialog'}")
targets = zip(*kits.values())[0]
maddeTargets = QtQuickConstants.getTargetsAsStrings([QtQuickConstants.Targets.MAEMO5,
QtQuickConstants.Targets.HARMATTAN])
maddeTargets = Targets.getTargetsAsStrings([Targets.MAEMO5, Targets.HARMATTAN])
maddeInTargets = len(set(targets) & set(maddeTargets)) > 0
test.compare(comboBox.enabled, maddeInTargets, "Verifying whether combox is enabled.")
test.compare(maddeInTargets, not isMaddeDisabled, "Verifying if kits are configured.")

View File

@@ -7,7 +7,7 @@ def main():
# using a temporary directory won't mess up a potentially existing
workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir,
targets = QtQuickConstants.Targets.DESKTOP_474_GCC)
targets = Targets.DESKTOP_474_GCC)
test.log("Building project")
result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
invokeMenuItem("Build", "Build All")

View File

@@ -12,7 +12,7 @@ def main():
workingDir = tempDir()
checkedTargets, projectName = createNewQtQuickApplication(workingDir, None,
os.path.join(prepareTemplate(sourceExample), qmlFile),
QtQuickConstants.Targets.DESKTOP_474_GCC)
Targets.DESKTOP_474_GCC)
test.log("Building project")
result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223)
invokeMenuItem("Build","Build All")