forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/qds/dev'
Conflicts: src/plugins/updateinfo/updateinfoplugin.cpp Change-Id: Ie1bf2ad434f0224fb91caf91b443daae3d5b5ec0
This commit is contained in:
@@ -567,6 +567,15 @@ void ObjectNodeInstance::doResetProperty(const PropertyName &propertyName)
|
||||
QmlPrivateGate::doResetProperty(object(), context(), propertyName);
|
||||
}
|
||||
|
||||
static bool isPropertyBlackListed(const PropertyName &propertyName)
|
||||
{
|
||||
if (propertyName.contains(".") && propertyName.contains("__"))
|
||||
return true;
|
||||
if (propertyName.count(".") > 2)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant ObjectNodeInstance::property(const PropertyName &name) const
|
||||
{
|
||||
if (ignoredProperties().contains(name))
|
||||
@@ -574,7 +583,7 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const
|
||||
|
||||
// TODO: handle model nodes
|
||||
|
||||
if (QmlPrivateGate::isPropertyBlackListed(name))
|
||||
if (isPropertyBlackListed(name))
|
||||
return QVariant();
|
||||
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
@@ -612,6 +621,37 @@ void ObjectNodeInstance::ensureVector3DDotProperties(PropertyNameList &list) con
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::ensureValueTypeProperties(PropertyNameList &list) const
|
||||
{
|
||||
const PropertyNameList pointDotProperties = {"x", "y"};
|
||||
const PropertyNameList sizeDotProperties = {"width", "height"};
|
||||
const PropertyNameList rectDotProperties = {"x", "y", "width", "height"};
|
||||
|
||||
PropertyNameList valueTypeProperties;
|
||||
|
||||
for (const auto &property : list) {
|
||||
const QString name = instanceType(property);
|
||||
PropertyNameList dotProperties;
|
||||
|
||||
if (name == "QPoint" || name == "QPointF")
|
||||
dotProperties = pointDotProperties;
|
||||
|
||||
if (name == "QSize" || name == "QSizeF")
|
||||
dotProperties = sizeDotProperties;
|
||||
|
||||
if (name == "QRect" || name == "QRectF")
|
||||
dotProperties = rectDotProperties;
|
||||
|
||||
for (const auto &dotProperty : dotProperties)
|
||||
valueTypeProperties.append(property + "." + dotProperty);
|
||||
}
|
||||
|
||||
for (const auto &valueTypeProperty : valueTypeProperties) {
|
||||
if (!list.contains(valueTypeProperty))
|
||||
list.append(valueTypeProperty);
|
||||
}
|
||||
}
|
||||
|
||||
PropertyNameList ObjectNodeInstance::propertyNames() const
|
||||
{
|
||||
PropertyNameList list;
|
||||
@@ -619,13 +659,14 @@ PropertyNameList ObjectNodeInstance::propertyNames() const
|
||||
list = QmlPrivateGate::allPropertyNames(object());
|
||||
|
||||
ensureVector3DDotProperties(list);
|
||||
ensureValueTypeProperties(list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QString ObjectNodeInstance::instanceType(const PropertyName &name) const
|
||||
{
|
||||
if (QmlPrivateGate::isPropertyBlackListed(name))
|
||||
if (isPropertyBlackListed(name))
|
||||
return QLatin1String("undefined");
|
||||
|
||||
QQmlProperty property(object(), QString::fromUtf8(name), context());
|
||||
|
||||
@@ -199,6 +199,7 @@ protected:
|
||||
|
||||
void initializePropertyWatcher(const ObjectNodeInstance::Pointer &objectNodeInstance);
|
||||
void ensureVector3DDotProperties(PropertyNameList &list) const;
|
||||
void ensureValueTypeProperties(PropertyNameList &list) const;
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
|
||||
@@ -345,7 +345,7 @@ void Qt5InformationNodeInstanceServer::updateRotationBlocks(
|
||||
if (helper) {
|
||||
QSet<QQuick3DNode *> blockedNodes;
|
||||
QSet<QQuick3DNode *> unblockedNodes;
|
||||
const PropertyName rotBlocked = "rotBlocked";
|
||||
const PropertyName rotBlocked = "rotBlock";
|
||||
for (const auto &container : valueChanges) {
|
||||
if (container.name() == rotBlocked
|
||||
&& container.auxiliaryDataType() == AuxiliaryDataType::NodeInstanceAuxiliary) {
|
||||
|
||||
@@ -40,18 +40,22 @@ public:
|
||||
, m_args({argc, argv})
|
||||
{
|
||||
m_argParser.setApplicationDescription("QML Runtime Provider for QDS");
|
||||
m_argParser.addOptions(
|
||||
{{"qml-puppet", "Run QML Puppet (default)"},
|
||||
{"qml-runtime", "Run QML Runtime"},
|
||||
{"appinfo", "Print build information"},
|
||||
{"test", "Run test mode"}
|
||||
});
|
||||
m_argParser.addOptions({{"qml-puppet", "Run QML Puppet (default)"},
|
||||
{"qml-runtime", "Run QML Runtime"},
|
||||
{"appinfo", "Print build information"},
|
||||
{"test", "Run test mode"}});
|
||||
}
|
||||
|
||||
int run()
|
||||
{
|
||||
populateParser();
|
||||
initCoreApp();
|
||||
|
||||
if (!m_coreApp) { //default to QGuiApplication
|
||||
createCoreApp<QGuiApplication>();
|
||||
qWarning() << "CoreApp is not initialized! Falling back to QGuiApplication!";
|
||||
}
|
||||
|
||||
initParser();
|
||||
initQmlRunner();
|
||||
return m_coreApp->exec();
|
||||
@@ -88,11 +92,6 @@ private:
|
||||
QCommandLineOption optHelp = m_argParser.addHelpOption();
|
||||
QCommandLineOption optVers = m_argParser.addVersionOption();
|
||||
|
||||
if (!m_coreApp) {
|
||||
qCritical() << "Cannot initialize coreapp!";
|
||||
m_argParser.showHelp();
|
||||
}
|
||||
|
||||
if (!m_argParser.parse(m_coreApp->arguments())) {
|
||||
std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl
|
||||
<< std::endl;
|
||||
|
||||
@@ -241,7 +241,8 @@ void QmlRuntime::initQmlRunner()
|
||||
loadConf(confFile, !m_verboseMode);
|
||||
|
||||
// Load files
|
||||
QScopedPointer<LoadWatcher> lw(new LoadWatcher(m_qmlEngine.data(), files.size(), m_conf.data()));
|
||||
LoadWatcher *lw = new LoadWatcher(m_qmlEngine.data(), files.size(), m_conf.data());
|
||||
lw->setParent(this);
|
||||
|
||||
for (const QString &path : std::as_const(files)) {
|
||||
QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile);
|
||||
|
||||
@@ -4,22 +4,46 @@ import QtQuick.Window 2.0
|
||||
import QtQuick 2.0
|
||||
|
||||
Window {
|
||||
id: window
|
||||
property Item containedObject: null
|
||||
property bool __resizeGuard: false
|
||||
|
||||
readonly property Item firstChild: window.contentItem.children.length > 0 ? window.contentItem.children[0] : null
|
||||
|
||||
property bool writeGuard: false
|
||||
|
||||
onFirstChildChanged: {
|
||||
window.writeGuard = true
|
||||
window.containedObject = window.firstChild
|
||||
window.writeGuard = false
|
||||
}
|
||||
|
||||
onContainedObjectChanged: {
|
||||
if (window.writeGuard)
|
||||
return
|
||||
|
||||
if (containedObject == undefined || containedObject == null) {
|
||||
visible = false
|
||||
return
|
||||
}
|
||||
__resizeGuard = true
|
||||
width = containedObject.width
|
||||
height = containedObject.height
|
||||
|
||||
window.width = containedObject.width
|
||||
window.height = containedObject.height
|
||||
|
||||
containedObject.parent = contentItem
|
||||
visible = true
|
||||
__resizeGuard = false
|
||||
window.visible = true
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: window.firstChild
|
||||
when: window.firstChild
|
||||
property: "height"
|
||||
value: window.height
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: window.firstChild
|
||||
when: window.firstChild
|
||||
property: "width"
|
||||
value: window.width
|
||||
}
|
||||
onWidthChanged: if (!__resizeGuard && containedObject)
|
||||
containedObject.width = width
|
||||
onHeightChanged: if (!__resizeGuard && containedObject)
|
||||
containedObject.height = height
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user