Commit bdea4309 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Fix warnings

parent 58ab0020
......@@ -472,7 +472,7 @@ void StatesEditorView::selectedNodesChanged(const QList<ModelNode> &/*selectedNo
}
QPixmap StatesEditorView::renderState(int i)
QPixmap StatesEditorView::renderState(int /*i*/)
{
return QPixmap();
......
......@@ -41,7 +41,7 @@ public:
virtual void changeState(const ChangeStateCommand &command) = 0;
virtual void addImport(const AddImportCommand &command) = 0;
virtual void setBlockUpdates(bool block) {}
virtual void setBlockUpdates(bool /*block*/) {}
static void registerCommands();
};
......
......@@ -102,8 +102,6 @@ public:
NodeInstance instanceForId(qint32 id) const;
bool hasInstanceForId(qint32 id) const;
void render(QPainter *painter, const QRectF &target=QRectF(), const QRectF &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio);
QRectF sceneRect() const;
void setBlockUpdates(bool block);
......
......@@ -50,7 +50,7 @@ QDeclarativeComponent *ComponentNodeInstance::component() const
ComponentNodeInstance::Pointer ComponentNodeInstance::create(QObject *object)
{
QDeclarativeComponent *component = component = qobject_cast<QDeclarativeComponent *>(object);
QDeclarativeComponent *component = qobject_cast<QDeclarativeComponent *>(object);
if (component == 0)
throw InvalidNodeInstanceException(__LINE__, __FUNCTION__, __FILE__);
......@@ -69,23 +69,24 @@ bool ComponentNodeInstance::hasContent() const
void ComponentNodeInstance::setPropertyVariant(const QString &name, const QVariant &value)
{
// if (name == "__component_data") {
// QByteArray data(value.toByteArray());
// QByteArray imports;
// foreach(const Import &import, nodeInstanceServer()->imports()) {
// imports.append(import.toString(true).toLatin1());
// }
// data.prepend(imports);
// component()->setData(data, nodeInstanceView()->model()->fileUrl());
// }
// if (component()->isError()) {
// qDebug() << value;
// foreach(const QDeclarativeError &error, component()->errors())
// qDebug() << error;
// }
if (name == "__component_data") {
QByteArray data(value.toByteArray());
QByteArray importArray;
foreach(const QString &import, nodeInstanceServer()->imports()) {
importArray.append(import.toUtf8());
}
data.prepend(importArray);
component()->setData(data, nodeInstanceServer()->fileUrl());
}
if (component()->isError()) {
qDebug() << value;
foreach(const QDeclarativeError &error, component()->errors())
qDebug() << error;
}
}
......
......@@ -6,12 +6,12 @@ CreateSceneCommand::CreateSceneCommand()
{
}
QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &command)
QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &/*command*/)
{
return out;
}
QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command)
QDataStream &operator>>(QDataStream &in, CreateSceneCommand &/*command*/)
{
return in;
}
......
......@@ -234,6 +234,8 @@ void NodeInstanceServer::addImport(const AddImportCommand &command)
if (!command.alias().isEmpty())
importStatement += " as " + command.alias();
m_importList.append(importStatement);
QDeclarativeComponent importComponent(engine(), 0);
QString componentString = QString("import Qt 4.7\n%1\n Item{}\n").arg(importStatement);
......@@ -616,6 +618,11 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto
return ValuesChangedCommand(valueVector);
}
QStringList NodeInstanceServer::imports() const
{
return m_importList;
}
void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const QString &propertyName)
{
if (hasInstanceForId(instanceid))
......
......@@ -3,6 +3,7 @@
#include <QUrl>
#include <QVector>
#include <QStringList>
#include <nodeinstanceserverinterface.h>
#include "servernodeinstance.h"
......@@ -73,6 +74,8 @@ public:
void notifyPropertyChange(qint32 instanceid, const QString &propertyName);
QStringList imports() const;
public slots:
void refreshLocalFileProperty(const QString &path);
void emitParentChanged(QObject *child);
......@@ -120,6 +123,7 @@ private:
int m_timer;
bool m_slowRenderTimer;
QVector<InstancePropertyPair> m_changedPropertyList;
QStringList m_importList;
};
}
......
......@@ -691,21 +691,6 @@ void NodeInstanceView::removeRecursiveChildRelationship(const ModelNode &removed
removeInstanceNodeRelationship(removedNode);
}
void NodeInstanceView::render(QPainter * painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode)
{
// if (m_graphicsView) {
// painter->save();
// painter->setRenderHint(QPainter::Antialiasing, true);
// painter->setRenderHint(QPainter::TextAntialiasing, true);
// painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
// painter->setRenderHint(QPainter::HighQualityAntialiasing, true);
// painter->setRenderHint(QPainter::NonCosmeticDefaultPen, true);
// m_graphicsView->scene()->render(painter, target, source, aspectRatioMode);
// painter->restore();
// }
}
QRectF NodeInstanceView::sceneRect() const
{
if (rootNodeInstance().isValid())
......
......@@ -938,16 +938,6 @@ int ObjectNodeInstance::penWidth() const
return 0;
}
static bool metaObjectHasNotPropertyName(NodeInstanceMetaObject *metaObject, const QString &propertyName)
{
for (int i = 0; i < metaObject->count(); i++) {
if (metaObject->name(i) == propertyName)
return false;
}
return true;
}
void ObjectNodeInstance::createDynamicProperty(const QString &name, const QString &/*typeName*/)
{
if (m_metaObject == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment