Commit 58057882 authored by hjk's avatar hjk
Browse files

Merge remote branch 'origin/2.0'

Conflicts:
	src/plugins/projectexplorer/miniprojecttargetselector.cpp
	src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp
	src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp
	src/plugins/qt4projectmanager/qt-maemo/maemosshthread.cpp
	src/plugins/qt4projectmanager/qt-maemo/maemosshthread.h
	tests/manual/gdbdebugger/simple/app.cpp
parents 125aaf86 0b52a873
......@@ -7,8 +7,8 @@ equals(QMAKE_DIR_SEP, /) { # unix, mingw+msys
# The lack of spaces in front of the && is necessary!
QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& $$QDOC_BIN
} else { # nmake
QDOC = set SRCDIR=$$PWD $$escape_expand(\n\t) \
set OUTDIR=$$OUT_PWD/doc/html $$escape_expand(\n\t) \
QDOC = set SRCDIR=$$PWD $$escape_expand(\\n\\t) \
set OUTDIR=$$OUT_PWD/doc/html $$escape_expand(\\n\\t) \
$$QDOC_BIN
}
......
#version check qt
contains(QT_VERSION, ^4\.[0-6]\..*) {
contains(QT_VERSION, ^4\\.[0-6]\\..*) {
message("Cannot build Qt Creator with Qt version $${QT_VERSION}.")
error("Use at least Qt 4.7.")
}
......
......@@ -1384,7 +1384,8 @@ class Dumper:
if len(fields) == 1 and fields[0].name is None:
innerType = value.type.target()
with Children(self, 1, innerType):
self.putFields(item)
child = Item(value, item.iname, None, item.name)
self.putFields(child)
def putFields(self, item, innerType = None):
value = item.value
......
......@@ -2053,7 +2053,7 @@ Sollen sie überschrieben werden?</translation>
<message>
<location line="+5"/>
<source>&amp;Options...</source>
<translation>&amp;Einstellungen</translation>
<translation>&amp;Einstellungen...</translation>
</message>
<message>
<location line="+11"/>
......@@ -2433,7 +2433,7 @@ Sollen sie überschrieben werden?</translation>
<message>
<location line="+3"/>
<source>&lt;h3&gt;Qt Creator %1 %8&lt;/h3&gt;Based on Qt %2 (%3 bit)&lt;br/&gt;&lt;br/&gt;Built on %4 at %5&lt;br /&gt;&lt;br/&gt;%9&lt;br/&gt;Copyright 2008-%6 %7. All rights reserved.&lt;br/&gt;&lt;br/&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;br/&gt;</source>
<translation>&lt;h3&gt;Qt Creator %1&lt;/h3&gt;Basierend auf Qt %2 (%3 bit)&lt;br/&gt;&lt;br/&gt;Erstellt am %4 um %5&lt;br /&gt;&lt;br/&gt;%8&lt;br/&gt;Copyright 2008-%6 %7. Alle Rechte vorbehalten.&lt;br/&gt;&lt;br/&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;br/&gt;</translation>
<translation>&lt;h3&gt;Qt Creator %1 %8&lt;/h3&gt;Basierend auf Qt %2 (%3 bit)&lt;br/&gt;&lt;br/&gt;Erstellt am %4 um %5&lt;br /&gt;&lt;br/&gt;%9&lt;br/&gt;Copyright 2008-%6 %7. Alle Rechte vorbehalten.&lt;br/&gt;&lt;br/&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;br/&gt;</translation>
</message>
</context>
<context>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,26 +14,22 @@ LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
MIME_TR_H = $$IDE_DATA_PATH/translations/mime_tr.h
CUSTOMWIZARD_TR_H = $$IDE_DATA_PATH/translations/customwizard_tr.h
MIME_TR_H = $$OUT_PWD/mime_tr.h
CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h
contains(QT_VERSION, ^4\.[0-6]\..*) {
ts.commands = @echo This Qt version is too old for the ts target. Need Qt 4.7+.
} else {
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, \", \")\"
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, \", \")\"
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
QMAKE_SUBSTITUTES += extract-customwizards.xq.in
ts.commands += \
$$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \
$$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H $$PWD/extract-customwizards.xq && \
(cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$TRANSLATIONS) && \
$$QMAKE_DEL_FILE $$MIME_TR_H
}
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
QMAKE_SUBSTITUTES += extract-customwizards.xq.in
ts.commands += \
$$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \
$$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H $$PWD/extract-customwizards.xq && \
(cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$TRANSLATIONS) && \
$$QMAKE_DEL_FILE $$MIME_TR_H
QMAKE_EXTRA_TARGETS += ts
TEMPLATE = app
......
......@@ -81,6 +81,8 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
options += "fancy,";
if (theDebuggerBoolSetting(AutoDerefPointers))
options += "autoderef,";
if (!qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty())
options += "pe,";
if (options.isEmpty())
options += "defaults,";
options.chop(1);
......
......@@ -260,15 +260,19 @@ MiniTargetWidget::MiniTargetWidget(Target *target, QWidget *parent) :
QFormLayout *formLayout = new QFormLayout;
formLayout->setLabelAlignment(Qt::AlignRight);
QLabel *lbl;
int indent = 10;
if (hasBuildConfiguration()) {
lbl = new QLabel(tr("Build:"));
lbl->setObjectName(QString::fromUtf8("buildLabel"));
lbl->setIndent(10);
lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
lbl->setIndent(indent);
formLayout->addRow(lbl, buildHelperLayout);
}
lbl = new QLabel(tr("Run:"));
lbl->setObjectName(QString::fromUtf8("runLabel"));
lbl->setIndent(10);
lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
lbl->setIndent(indent);
formLayout->addRow(lbl, runHelperLayout);
gridLayout->addWidget(m_targetName, 0, 0);
......@@ -316,8 +320,14 @@ void MiniTargetWidget::setActiveRunConfiguration()
void MiniTargetWidget::addRunConfiguration(ProjectExplorer::RunConfiguration* rc)
{
Q_UNUSED(rc);
m_runComboBox->setEnabled(m_target->runConfigurations().count()>1);
connect(rc, SIGNAL(displayNameChanged()), SLOT(updateDisplayName()));
m_runComboBox->addItem(rc->displayName(), QVariant::fromValue(rc));
m_runComboBox->setItemData(m_runComboBox->findText(rc->displayName()),
rc->displayName(), Qt::ToolTipRole);
if (m_target->activeRunConfiguration() == rc)
m_runComboBox->setCurrentIndex(m_runComboBox->count()-1);
m_runComboBox->setEnabled(m_runComboBox->count()>1);
}
void MiniTargetWidget::removeRunConfiguration(ProjectExplorer::RunConfiguration* rc)
......@@ -330,8 +340,14 @@ void MiniTargetWidget::addBuildConfiguration(ProjectExplorer::BuildConfiguration
{
Q_UNUSED(bc);
QTC_ASSERT(m_buildComboBox, return);
connect(bc, SIGNAL(displayNameChanged()), SIGNAL(changed()), Qt::UniqueConnection);
m_buildComboBox->setEnabled(m_target->buildConfigurations().count() > 1);
connect(bc, SIGNAL(displayNameChanged()), SLOT(updateDisplayName()));
m_buildComboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
m_buildComboBox->setItemData(m_buildComboBox->findText(bc->displayName()),
bc->displayName(), Qt::ToolTipRole);
if (m_target->activeBuildConfiguration() == bc)
m_buildComboBox->setCurrentIndex(m_buildComboBox->count()-1);
m_buildComboBox->setEnabled(m_buildComboBox->count() > 1);
}
void MiniTargetWidget::removeBuildConfiguration(ProjectExplorer::BuildConfiguration* bc)
......@@ -387,7 +403,6 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
m_projectsBox->setProperty("hideborder", true);
m_projectsBox->setObjectName(QString::fromUtf8("ProjectsBox"));
m_projectsBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
m_projectsBox->setMaximumWidth(200);
toolLayout->addWidget(lbl);
toolLayout->addWidget(new Utils::StyledSeparator);
......@@ -562,6 +577,10 @@ void MiniProjectTargetSelector::updateAction()
QString runConfig;
QIcon targetIcon = style()->standardIcon(QStyle::SP_ComputerIcon);
const int extrawidth = 110; // Size of margins + icon width
// Some fudge numbers to ensure the menu doesnt grow unbounded
int maxLength = fontMetrics().averageCharWidth() * 140;
if (project) {
projectName = project->displayName();
......@@ -571,10 +590,14 @@ void MiniProjectTargetSelector::updateAction()
}
if (BuildConfiguration *bc = target->activeBuildConfiguration()) {
buildConfig = bc->displayName();
int minimumWidth = fontMetrics().width(bc->displayName() + tr("Build:")) + extrawidth;
m_widgetStack->setMinimumWidth(qMin(maxLength, qMax(minimumWidth, m_widgetStack->minimumWidth())));
}
if (RunConfiguration *rc = target->activeRunConfiguration()) {
runConfig = rc->displayName();
int minimumWidth = fontMetrics().width(rc->displayName() + tr("Run:")) + extrawidth;
m_widgetStack->setMinimumWidth(qMin(maxLength, qMax(minimumWidth, m_widgetStack->minimumWidth())));
}
targetToolTipText = target->toolTip();
targetIcon = createCenteredIcon(target->icon(), target->overlayIcon());
......
......@@ -53,27 +53,12 @@
#include <QtGui/QMenu>
namespace {
const int TASK_ICON_SIZE = 16;
const int TASK_ICON_MARGIN = 2;
const QIcon ERROR_ICON(":/projectexplorer/images/compile_error.png");
const QIcon WARNING_ICON(":/projectexplorer/images/compile_warning.png");
}
namespace ProjectExplorer {
QIcon Task::icon() const
{
if (type == ProjectExplorer::Task::Error)
return ERROR_ICON;
else if (type == ProjectExplorer::Task::Warning)
return WARNING_ICON;
else
return QIcon();
}
namespace Internal {
class TaskView : public QListView
......@@ -141,6 +126,8 @@ public:
enum Roles { File = Qt::UserRole, Line, Description, FileNotFound, Type, Category, Icon, Task_t };
QIcon taskTypeIcon(Task::TaskType t) const;
private:
QHash<QString,QString> m_categories; // category id -> display name
QList<Task> m_tasks; // all tasks (in order of insertion)
......@@ -148,8 +135,8 @@ private:
QHash<QString,bool> m_fileNotFound;
int m_maxSizeOfFileName;
QIcon m_errorIcon;
QIcon m_warningIcon;
const QIcon m_errorIcon;
const QIcon m_warningIcon;
};
class TaskFilterModel : public QSortFilterProxyModel
......@@ -224,11 +211,24 @@ void TaskView::keyPressEvent(QKeyEvent *e)
// TaskModel
/////
TaskModel::TaskModel()
TaskModel::TaskModel() :
m_maxSizeOfFileName(0),
m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
{
m_maxSizeOfFileName = 0;
m_errorIcon = QIcon(":/projectexplorer/images/compile_error.png");
m_warningIcon = QIcon(":/projectexplorer/images/compile_warning.png");
}
QIcon TaskModel::taskTypeIcon(Task::TaskType t) const
{
switch (t) {
case Task::Warning:
return m_warningIcon;
case Task::Error:
return m_errorIcon;
case Task::Unknown:
break;
}
return QIcon();
}
void TaskModel::addCategory(const QString &categoryId, const QString &categoryName)
......@@ -353,7 +353,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
} else if (role == TaskModel::Category) {
return m_tasks.at(index.row()).category;
} else if (role == TaskModel::Icon) {
return m_tasks.at(index.row()).icon();
return taskTypeIcon(m_tasks.at(index.row()).type);
} else if (role == TaskModel::Task_t) {
return QVariant::fromValue(m_tasks.at(index.row()));
}
......@@ -495,7 +495,7 @@ TaskWindow::TaskWindow()
connect(m_listview, SIGNAL(clicked(QModelIndex)),
this, SLOT(showTaskInFile(QModelIndex)));
m_filterWarningsButton = createFilterButton(WARNING_ICON,
m_filterWarningsButton = createFilterButton(taskTypeIcon(Task::Warning),
tr("Show Warnings"),
this, SLOT(setShowWarnings(bool)));
......@@ -771,6 +771,11 @@ void TaskWindow::updateActions()
m_copyAction->setEnabled(m_model->tasks().count() > 0);
}
QIcon TaskWindow::taskTypeIcon(Task::TaskType t) const
{
return m_model->taskTypeIcon(t);
}
/////
// Delegate
/////
......
......@@ -86,9 +86,6 @@ struct PROJECTEXPLORER_EXPORT Task {
// doesn't work if you split it up, nor are our parsers
// anywhere near being that good
QList<QTextLayout::FormatRange> formats;
/// Get the icon used to represent this task
QIcon icon() const;
};
class PROJECTEXPLORER_EXPORT TaskWindow : public Core::IOutputPane
......@@ -128,6 +125,8 @@ public:
void goToNext();
void goToPrev();
QIcon taskTypeIcon(Task::TaskType t) const;
signals:
void tasksChanged();
......
......@@ -94,7 +94,10 @@ void FormEditorGraphicsView::mouseMoveEvent(QMouseEvent *event)
delete mouseEvent;
}
m_feedbackOriginPoint = event->pos() + QPoint(50, -80);
// Keeps the feedback bubble within screen boundraries
int tx = qMin(width() - 114, qMax(16, event->pos().x() + 50));
int ty = qMin(height() - 45, qMax(10, event->pos().y() - 70));
m_feedbackOriginPoint = QPoint(tx, ty);
}
void FormEditorGraphicsView::keyPressEvent(QKeyEvent *event)
......@@ -127,6 +130,30 @@ void FormEditorGraphicsView::leaveEvent(QEvent *event)
{
m_feedbackOriginPoint = QPoint();
QGraphicsView::leaveEvent(event);
}
static QPixmap createBubblePixmap()
{
QPixmap pixmap(124, 48);
pixmap.fill(Qt::transparent);
QPainter pmPainter(&pixmap);
pmPainter.setRenderHint(QPainter::Antialiasing);
pmPainter.setOpacity(0.85);
pmPainter.translate(0.5, 0.5);
pmPainter.setPen(Qt::NoPen);
pmPainter.setBrush(QColor(0, 0, 0, 40));
pmPainter.drawRoundedRect(QRect(0, 0, 124, 48), 8, 8);
QLinearGradient gradient(QPoint(0, 0), QPoint(0, 44));
gradient.setColorAt(0.0, QColor(70, 70, 70));
gradient.setColorAt(1.0, QColor(10, 10, 10));
pmPainter.setBrush(gradient);
pmPainter.setPen(QColor(60, 60, 60));
pmPainter.drawRoundedRect(QRect(2, 1, 120, 45), 5, 5);
pmPainter.setBrush(Qt::NoBrush);
pmPainter.setPen(QColor(255, 255, 255, 140));
pmPainter.drawRoundedRect(QRect(3, 2, 118, 43), 5, 5);
pmPainter.end();
return pixmap;
}
void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*rect*/ )
......@@ -138,7 +165,6 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
return;
painter->save();
painter->resetTransform();
painter->translate(m_feedbackOriginPoint);
......@@ -150,18 +176,9 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
font.setPixelSize(12);
painter->setFont(font);
painter->save();
painter->setOpacity(0.85);
QLinearGradient gradient(QPoint(0, 0), QPoint(120, 45));
gradient.setColorAt(0.0, Qt::black);
gradient.setColorAt(1.0, Qt::darkGray);
painter->setBrush(gradient);
painter->setPen(Qt::black);
painter->drawRoundedRect(QRect(-1, -1, 120, 45), 5, 5);
painter->restore();
if (m_bubblePixmap.isNull())
m_bubblePixmap = createBubblePixmap();
painter->drawPixmap(-13, -7, m_bubblePixmap);
if (m_beginXHasExpression) {
if(m_feedbackNode.hasBindingProperty("x"))
......@@ -175,8 +192,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
painter->setPen(defaultColor);
}
painter->drawText(QPoint(2.0, 13.0), QString("x:"));
painter->drawText(QPoint(14.0, 13.0), m_feedbackNode.instanceValue("x").toString());
painter->drawText(QPoint(8.0, 13.0), QString("x:"));
painter->drawText(QPoint(22.0, 13.0), m_feedbackNode.instanceValue("x").toString());
if (m_beginYHasExpression) {
......@@ -192,7 +209,7 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
}
painter->drawText(QPoint(60.0, 13.0), QString("y:"));
painter->drawText(QPoint(70.0, 13.0), m_feedbackNode.instanceValue("y").toString());
painter->drawText(QPoint(72.0, 13.0), m_feedbackNode.instanceValue("y").toString());
if (m_beginWidthHasExpression) {
......@@ -207,8 +224,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
painter->setPen(defaultColor);
}
painter->drawText(QPoint(2.0, 26.0), QString("w:"));
painter->drawText(QPoint(14.0, 26.0), m_feedbackNode.instanceValue("width").toString());
painter->drawText(QPoint(8.0, 29.0), QString("w:"));
painter->drawText(QPoint(22.0, 29.0), m_feedbackNode.instanceValue("width").toString());
if (m_beginHeightHasExpression) {
......@@ -223,8 +240,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
painter->setPen(defaultColor);
}
painter->drawText(QPoint(60.0, 26.0), QString("h:"));
painter->drawText(QPoint(70.0, 26.0), m_feedbackNode.instanceValue("height").toString());
painter->drawText(QPoint(60.0, 29.0), QString("h:"));
painter->drawText(QPoint(72.0, 29.0), m_feedbackNode.instanceValue("height").toString());
if (m_parentNode != m_feedbackNode.instanceParent()) {
painter->setPen(changeColor);
......
......@@ -67,6 +67,7 @@ private:
bool m_beginWidthHasExpression;
bool m_beginHeightHasExpression;
QPoint m_feedbackOriginPoint;
QPixmap m_bubblePixmap;
};
} // namespace QmlDesigner
......
......@@ -43,7 +43,7 @@ NavigatorTreeModel::NavigatorTreeModel(QObject *parent)
: QStandardItemModel(parent),
m_blockItemChangedSignal(false)
{
invisibleRootItem()->setFlags(Qt::NoItemFlags);
invisibleRootItem()->setFlags(Qt::ItemIsDropEnabled);
#ifdef _LOCK_ITEMS_
setColumnCount(3);
......
......@@ -39,6 +39,8 @@ namespace QmlDesigner {
class ModelNode;
class NodeState;
const QString auxDataString = QLatin1String("anchors_");
namespace Internal {
QmlAnchorBindingProxy::QmlAnchorBindingProxy(QObject *parent) :
......@@ -269,6 +271,15 @@ void QmlAnchorBindingProxy::resetLayout() {
m_fxItemNode.anchors().removeAnchors();
m_fxItemNode.anchors().removeMargins();
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0))
m_fxItemNode.setVariantProperty("x", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "x"));
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0))
m_fxItemNode.setVariantProperty("y", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "y"));
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0))
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0))
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
emit topAnchorChanged();
emit bottomAnchorChanged();
emit leftAnchorChanged();
......@@ -290,6 +301,7 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
removeBottomAnchor();
} else {
calcBottomMargin();
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "height", m_fxItemNode.instanceSize().height());
m_fxItemNode.removeVariantProperty("height");
}
emit bottomAnchorChanged();
......@@ -312,7 +324,8 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
removeLeftAnchor();
} else {
calcLeftMargin();
m_fxItemNode.removeVariantProperty("width");
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "x", m_fxItemNode.instancePosition().x());
m_fxItemNode.removeVariantProperty("x");
}
emit leftAnchorChanged();
if (hasAnchors() != anchor)
......@@ -333,7 +346,8 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
removeRightAnchor();
} else {
calcRightMargin();
m_fxItemNode.removeVariantProperty("x");
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "width", m_fxItemNode.instanceSize().width());
m_fxItemNode.removeVariantProperty("width");
}
emit rightAnchorChanged();
if (hasAnchors() != anchor)
......@@ -364,13 +378,11 @@ void QmlAnchorBindingProxy::calcTopMargin()
{
m_locked = true;
if (m_topTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
if (m_topTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
qreal topMargin = transformedBoundingBox().top() - parentBoundingBox().top();
m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Top);
} else {
qDebug() << boundingBox(m_fxItemNode).top();
qDebug() << boundingBox(m_topTarget).bottom();
qreal topMargin = boundingBox(m_fxItemNode).top() - boundingBox(m_topTarget).bottom();
m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Bottom);
......@@ -383,7 +395,7 @@ void QmlAnchorBindingProxy::calcBottomMargin()
{
m_locked = true;
if (m_bottomTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
if (m_bottomTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
qreal bottomMargin = parentBoundingBox().bottom() - transformedBoundingBox().bottom();
m_fxItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
m_fxItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Bottom);
......@@ -400,7 +412,7 @@ void QmlAnchorBindingProxy::calcLeftMargin()
{
m_locked = true;
if (m_leftTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
if (m_leftTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
qreal leftMargin = transformedBoundingBox().left() - parentBoundingBox().left();
m_fxItemNode.anchors().setMargin(AnchorLine::Left, leftMargin);
m_fxItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Left);
......@@ -417,7 +429,7 @@ void QmlAnchorBindingProxy::calcRightMargin()
{
m_locked = true;
if (m_rightTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
if (m_rightTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
qreal rightMargin = parentBoundingBox().right() - transformedBoundingBox().right();
m_fxItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
m_fxItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Right);
......@@ -444,6 +456,7 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
removeTopAnchor();
} else {
calcTopMargin();
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "y", m_fxItemNode.instancePosition().y());
m_fxItemNode.removeVariantProperty("y");
}
emit topAnchorChanged();
......@@ -456,6 +469,10 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
m_fxItemNode.anchors().removeAnchor(AnchorLine::Top);
m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "y"))
m_fxItemNode.setVariantProperty("y", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "y"));
}
void QmlAnchorBindingProxy::removeBottomAnchor() {
......@@ -463,6 +480,9 @@ void QmlAnchorBindingProxy::removeBottomAnchor() {
m_fxItemNode.anchors().removeAnchor(AnchorLine::Bottom);
m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom);
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "height"))
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
}
void QmlAnchorBindingProxy::removeLeftAnchor() {
......@@ -470,6 +490,9 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
m_fxItemNode.anchors().removeAnchor(AnchorLine::Left);
m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "x"))
m_fxItemNode.setVariantProperty("x", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "x"));
}
void QmlAnchorBindingProxy::removeRightAnchor() {
......@@ -477,6 +500,9 @@ void QmlAnchorBindingProxy::removeRightAnchor() {
m_fxItemNode.anchors().removeAnchor(AnchorLine::Right);
m_fxItemNode.anchors().removeMargin(AnchorLine::Right);
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "width"))
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
}