monadic_kid
30th November 2009, 18:59
Hi I'm using qtpropertybrowser (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtpropertybrowser) with a custom redo/undo system (which is for a multi-process system) and I'm having a problem trying to emulate undoing like the the property editor in Qt Designer where input widgets such as QLineEdit/Q(Double)SpinBox when you undo the value reverts to the to the very first value it was before making the modification. For example if you modify a QLineEdit (in the Designer Property Editor) with this sequence of inputs 'a','b','c' press enter or lose focus then press ctrl-z the undo operation deletes "abc" as a whole and not just the last character 'c'.
I'm guessing in the case of designer's property editor it is using qt's redo/undo framework and using the QUndoCommand::mergeWith method to merge multiple commands into one and hooking up events like QLineEdit's "editingFinished" to be able to do those block undo/redos.
I can't seem to find a workaround to do this with the property browser because the Property Manager only has propertyChanged/valueChanged events but nothing like QLineEdit/QSpinBox's "editingFinished" events which could help me to write a more useful undo/redo for string input.
Does anyone have any ideas as to how I can achieve this without modifying the original source of the property browser framework? If not I'm planning on adding another event to the property manager called something like valueChanging.
I'm guessing in the case of designer's property editor it is using qt's redo/undo framework and using the QUndoCommand::mergeWith method to merge multiple commands into one and hooking up events like QLineEdit's "editingFinished" to be able to do those block undo/redos.
I can't seem to find a workaround to do this with the property browser because the Property Manager only has propertyChanged/valueChanged events but nothing like QLineEdit/QSpinBox's "editingFinished" events which could help me to write a more useful undo/redo for string input.
Does anyone have any ideas as to how I can achieve this without modifying the original source of the property browser framework? If not I'm planning on adding another event to the property manager called something like valueChanging.