[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi/formeditor
From: Jaroslaw Staniek <js () iidea ! pl>
Date: 2009-04-16 20:39:34
Message-ID: 1239914374.260756.26312.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 955060 by staniek:
Forms
- on moving widget: just change the value of "geometry" property, to avoid multiple PropertyCommands that \
only differ by value
M +5 -1 container.cpp
M +20 -4 form.cpp
M +2 -1 form.h
--- trunk/koffice/kexi/formeditor/container.cpp #955059:955060
@@ -112,6 +112,7 @@
Private(Container* toplevel, QWidget *container)
: m_toplevel(toplevel)
, state(DoingNothing)
+ , idOfPropertyCommand(0)
, m_widget(container)
, insertBegin(-1, -1)
{
@@ -180,6 +181,7 @@
InlineEditing
};
State state;
+ uint idOfPropertyCommand;
private:
// the watched container and it's toplevel one...
QPointer<Container> m_toplevel;
@@ -273,6 +275,7 @@
kDebug() << "this = " << this->objectName();
m_moving = static_cast<QWidget*>(s);
+ d->idOfPropertyCommand++; // this will create another PropertyCommand
if (m_moving->parentWidget() && KexiUtils::objectIsA(m_moving->parentWidget(), \
"QStackedWidget")) {
m_moving = m_moving->parentWidget(); // widget is a stacked widget's page
}
@@ -1415,7 +1418,8 @@
QRect g(w->geometry());
g.moveTo(tmpx, tmpy);
d->form->addPropertyCommand(w->objectName().toLatin1(), w->geometry(),
- g, "geometry", true /*execute*/);
+ g, "geometry", true /*execute*/,
+ d->idOfPropertyCommand);
w->move(tmpx, tmpy);
}
else {
--- trunk/koffice/kexi/formeditor/form.cpp #955059:955060
@@ -297,8 +297,9 @@
#endif
// moved from WidgetPropertySet
- // used to update command's value when undoing
+ //! used to update command's value when undoing
PropertyCommand *lastCommand;
+ uint idOfPropertyCommand;
GeometryPropertyCommand *lastGeoCommand;
bool slotPropertyChangedEnabled : 1;
bool slotPropertyChanged_addCommandEnabled : 1;
@@ -354,6 +355,7 @@
origActiveColors = 0;
// end of moved from WidgetPropertySet
designModeStyle = 0;
+ idOfPropertyCommand = 0;
}
FormPrivate::~FormPrivate()
@@ -1625,13 +1627,27 @@
}
void Form::addPropertyCommand(const QByteArray &wname, const QVariant &oldValue,
- const QVariant &value, const QByteArray &propertyName, bool execute)
+ const QVariant &value, const QByteArray &propertyName,
+ bool execute, uint idOfPropertyCommand)
{
kDebug() << d->propertySet[propertyName];
kDebug() << "oldValue:" << oldValue << "value:" << value;
+ kDebug() << "idOfPropertyCommand:" << idOfPropertyCommand;
d->insideAddPropertyCommand = true;
- d->lastCommand = new PropertyCommand(*this, wname, oldValue, value, propertyName);
- addCommand(d->lastCommand, execute);
+ PropertyCommand *presentCommand = dynamic_cast<PropertyCommand*>( \
d->commandHistory->presentCommand() ); + if ( presentCommand
+ && d->lastCommand == presentCommand
+ && idOfPropertyCommand > 0
+ && d->idOfPropertyCommand == idOfPropertyCommand)
+ {
+ d->lastCommand->setValue(value); // just change the value,
+ // to avoid multiple PropertyCommands that only differ by value
+ }
+ else {
+ d->lastCommand = new PropertyCommand(*this, wname, oldValue, value, propertyName);
+ addCommand(d->lastCommand, execute);
+ d->idOfPropertyCommand = idOfPropertyCommand;
+ }
d->insideAddPropertyCommand = false;
}
--- trunk/koffice/kexi/formeditor/form.h #955059:955060
@@ -254,7 +254,8 @@
void addCommand(K3Command *command, bool execute);
void addPropertyCommand(const QByteArray &wname, const QVariant &oldValue,
- const QVariant &value, const QByteArray &propertyName, bool execute);
+ const QVariant &value, const QByteArray &propertyName,
+ bool execute, uint idOfPropertyCommand = 0);
void addPropertyCommand(const QHash<QByteArray, QVariant> &oldValues,
const QVariant &value, const QByteArray &propertyName, bool execute);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic