From kde-commits Mon Apr 20 19:17:23 2009 From: Jaroslaw Staniek Date: Mon, 20 Apr 2009 19:17:23 +0000 To: kde-commits Subject: koffice/kexi Message-Id: <1240255043.826101.22395.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124025505804297 SVN commit 956851 by staniek: Forms - fixed undo/redo for inline widget's text editing = fix some {} M +5 -1 doc/dev/CHANGELOG-Kexi-js M +20 -12 formeditor/widgetfactory.cpp --- trunk/koffice/kexi/doc/dev/CHANGELOG-Kexi-js #956850:956851 @@ -26,13 +26,14 @@ - add support for paletteForegroundColor and paletteBackgroundColor properties of Kexi 1.x - add translation and simplify "textInteractionFlags" for QTextEdit and QLabel - move from K3CommandHistory to the QUndo framework + - remove m_widget and m_container from WidgetLibrary, otherwise multiple form views won't work in parallel TODO KoProperty: - mising border below the last item when its editor is visible - when started to change the editor's value: -- "revert" button should appear -- if the property has parent, the item for the parent should be repainted -- (??) fox or reimplement spin box widgets: look bad with oxygen and probably other styles +- (??) fix or reimplement spin box widgets: look bad with oxygen and probably other styles TODO: - crash in keximainwindow...... create > script > select the interpreter property, and change it from python to qtscript @@ -40,6 +41,9 @@ - (the same?) Create a database -> enter the table schema editor -> add a field -> try to change the field type -> crash http://rafb.net/p/R4QIBR13.html +2009-04-20 +Forms +- fixed undo/redo for inline widget's text editing 2009-04-16..19 Forms --- trunk/koffice/kexi/formeditor/widgetfactory.cpp #956850:956851 @@ -367,10 +367,12 @@ // resize widget using resize handles QWidget *ed = editor(m_widget); resizeEditor(ed, m_widget, m_widget->metaObject()->className()); - } else if ((ev->type() == QEvent::Paint) && (obj == m_widget) && editor(m_widget)) { + } + else if ((ev->type() == QEvent::Paint) && (obj == m_widget) && editor(m_widget)) { // paint event for container edited (eg button group) return m_container->eventFilter(obj, ev); - } else if ((ev->type() == QEvent::MouseButtonPress) && (obj == m_widget) && editor(m_widget)) { + } + else if ((ev->type() == QEvent::MouseButtonPress) && (obj == m_widget) && editor(m_widget)) { // click outside editor --> cancel editing Container *cont = m_container; resetEditor(); @@ -385,11 +387,14 @@ return false; QWidget *focus = w->topLevelWidget()->focusWidget(); - if (focus && w != focus - && !KexiUtils::findFirstChild(w, focus->objectName().toLatin1(), focus->metaObject()->className())) { + if ( focus + && w != focus + && !KexiUtils::findFirstChild(w, focus->objectName().toLatin1(), focus->metaObject()->className())) + { resetEditor(); } - } else if (ev->type() == QEvent::KeyPress) { + } + else if (ev->type() == QEvent::KeyPress) { QWidget *w = editor(m_widget); if (!w) w = (QWidget *)m_widget; @@ -397,14 +402,16 @@ return false; QKeyEvent *e = static_cast(ev); - if (((e->key() == Qt::Key_Return) || (e->key() == Qt::Key_Enter)) && (e->modifiers() != Qt::AltModifier)) + if (((e->key() == Qt::Key_Return) || (e->key() == Qt::Key_Enter)) && (e->modifiers() != Qt::AltModifier)) { resetEditor(); + } if (e->key() == Qt::Key_Escape) { setEditorText(m_firstText); //changeText(m_firstText); resetEditor(); } - } else if (ev->type() == QEvent::ContextMenu) { + } + else if (ev->type() == QEvent::ContextMenu) { QWidget *w = editor(m_widget); if (!w) w = (QWidget *)m_widget; @@ -512,8 +519,12 @@ void WidgetFactory::changeProperty(const char *name, const QVariant &value, Form *form) { - if (!form->selectedWidgets()->isEmpty()) { // If eg multiple labels are selected, - // we only want to change the text of one of them (the one the user cliked on) + if (form->selectedWidget()) { // single selection + form->propertySet().changePropertyIfExists(name, value); + } + else { + // If eg multiple labels are selected, + // we only want to change the text of one of them (the one the user cliked on) if (m_widget) { m_widget->setProperty(name, value); } @@ -521,9 +532,6 @@ form->selectedWidgets()->first()->setProperty(name, value); } } - else { // single selection - form->propertySet().changePropertyIfExists(name, value); - } } /*