For enabling the undo and redo actions, there are signals from the edit box (derived from the QTextEdit class) when the undo or redo availability changes. Likewise, there is a signal for when the copy selection availability changes. The undo, redo, cut, copy and delete actions were set to disabled in Designer.
The edit box's undo and redo signals are connected to the undo and redo set enabled slot respectively. When an undo or redo is available, this signal is emitted to the action with a true value, which enables the action. Likewise when an undo or redo is no longer available, this signal is emitted to the action with a false value, which disables the action.
The edit box's copy available signal is connected to the cut, copy and delete set enabled slot. The copy available simply means that text has been selected, which can then be copied, but also cut or deleted.
[commit d9a3f3b0b7]
Sunday, January 20, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)