Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
bea01410
Commit
bea01410
authored
Mar 02, 2010
by
Thomas Hartmann
Browse files
QmlDesigner.propertyEditor: add rewriter transactions
parent
d9d37a22
Changes
6
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/qmldesigner/propertyeditor/Qt/IntEditor.qml
View file @
bea01410
...
...
@@ -65,10 +65,10 @@ QWidget {
}
onSliderPressed
:
{
backendValue
.
lock
();
transaction
.
start
();
}
onSliderReleased
:
{
backendValue
.
unlock
();
transaction
.
end
();
}
}
}
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
View file @
bea01410
...
...
@@ -48,6 +48,7 @@
#include
"qproxylayoutitem.h"
#include
"fontwidget.h"
#include
"siblingcombobox.h"
#include
"propertyeditortransaction.h"
#include
<QtCore/QCoreApplication>
#include
<QtCore/QDir>
...
...
@@ -71,7 +72,7 @@ enum {
namespace
QmlDesigner
{
PropertyEditor
::
NodeType
::
NodeType
(
PropertyEditor
*
propertyEditor
)
:
m_view
(
new
QDeclarativeView
)
m_view
(
new
QDeclarativeView
)
,
m_propertyEditorTransaction
(
new
PropertyEditorTransaction
(
propertyEditor
))
{
Q_ASSERT
(
QFileInfo
(
":/images/button_normal.png"
).
exists
());
...
...
@@ -172,6 +173,7 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
m_backendAnchorBinding
.
setup
(
QmlItemNode
(
fxObjectNode
.
modelNode
()));
ctxt
->
setContextProperty
(
"anchorBackend"
,
&
m_backendAnchorBinding
);
ctxt
->
setContextProperty
(
"transaction"
,
m_propertyEditorTransaction
.
data
());
ctxt
->
setContextProperty
(
"backendValues"
,
&
m_backendValuesPropertyMap
);
ctxt
->
setContextProperty
(
"specificsUrl"
,
QVariant
(
qmlSpecificsFile
));
...
...
@@ -212,6 +214,7 @@ void PropertyEditor::NodeType::initialSetup(const QString &typeName, const QUrl
m_backendValuesPropertyMap
.
insert
(
"id"
,
QVariant
::
fromValue
(
valueObject
));
ctxt
->
setContextProperty
(
"anchorBackend"
,
&
m_backendAnchorBinding
);
ctxt
->
setContextProperty
(
"transaction"
,
m_propertyEditorTransaction
.
data
());
ctxt
->
setContextProperty
(
"backendValues"
,
&
m_backendValuesPropertyMap
);
ctxt
->
setContextProperty
(
"specificsUrl"
,
QVariant
(
qmlSpecificsFile
));
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h
View file @
bea01410
...
...
@@ -44,6 +44,8 @@ QT_END_NAMESPACE
namespace
QmlDesigner
{
class
PropertyEditorTransaction
;
class
PropertyEditor
:
public
QmlModelView
{
Q_OBJECT
...
...
@@ -60,6 +62,7 @@ class PropertyEditor: public QmlModelView
QDeclarativeView
*
m_view
;
Internal
::
QmlAnchorBindingProxy
m_backendAnchorBinding
;
QDeclarativePropertyMap
m_backendValuesPropertyMap
;
QScopedPointer
<
PropertyEditorTransaction
>
m_propertyEditorTransaction
;
};
public:
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri
View file @
bea01410
...
...
@@ -15,7 +15,8 @@ SOURCES += propertyeditor.cpp \
filewidget.cpp \
propertyeditorvalue.cpp \
fontwidget.cpp \
siblingcombobox.cpp
siblingcombobox.cpp \
propertyeditortransaction.cpp
HEADERS += propertyeditor.h \
qmlanchorbindingproxy.h \
allpropertiesbox.h \
...
...
@@ -30,7 +31,8 @@ HEADERS += propertyeditor.h \
filewidget.h \
propertyeditorvalue.h \
fontwidget.h \
siblingcombobox.h
siblingcombobox.h \
propertyeditortransaction.h
QT += declarative
RESOURCES += propertyeditor.qrc
FORMS += behaviordialog.ui
src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
View file @
bea01410
...
...
@@ -186,24 +186,6 @@ void PropertyEditorValue::resetValue()
}
}
void
PropertyEditorValue
::
lock
()
{
if
(
!
modelNode
().
isValid
())
return
;
//Q_ASSERT(!m_rewriterTransaction.isValid());
//m_rewriterTransaction = modelNode().view()->beginRewriterTransaction();
}
void
PropertyEditorValue
::
unlock
()
{
if
(
!
modelNode
().
isValid
())
return
;
//Q_ASSERT(m_rewriterTransaction.isValid());
//m_rewriterTransaction.commit();
}
void
PropertyEditorValue
::
registerDeclarativeTypes
()
{
QML_REGISTER_TYPE
(
Bauhaus
,
1
,
0
,
PropertyEditorValue
,
PropertyEditorValue
);
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
View file @
bea01410
...
...
@@ -121,8 +121,6 @@ public:
public
slots
:
void
resetValue
();
void
lock
();
void
unlock
();
signals:
void
valueChanged
(
const
QString
&
name
);
...
...
@@ -144,8 +142,7 @@ private: //variables
bool
m_isInModel
;
bool
m_isBound
;
bool
m_isValid
;
// if the property value belongs to a non-existing complexProperty it is invalid
PropertyEditorNodeWrapper
*
m_complexNode
;
QmlDesigner
::
RewriterTransaction
m_rewriterTransaction
;
PropertyEditorNodeWrapper
*
m_complexNode
;
};
QML_DECLARE_TYPE
(
PropertyEditorValue
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment