Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ben Boeckel
QtTesting
Commits
8f6cfd29
Commit
8f6cfd29
authored
Dec 21, 2006
by
Utkarsh Ayachit
⛰
Browse files
ENH: Added support to record/playback events from a QTextEdit widget.
parent
4e9c06d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
pqAbstractStringEventPlayer.cxx
View file @
8f6cfd29
...
...
@@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QComboBox>
#include <QLineEdit>
#include <QtDebug>
#include <QTextDocument>
#include <QTextEdit>
pqAbstractStringEventPlayer
::
pqAbstractStringEventPlayer
(
QObject
*
p
)
:
pqWidgetEventPlayer
(
p
)
...
...
@@ -75,6 +77,12 @@ bool pqAbstractStringEventPlayer::playEvent(QObject* Object, const QString& Comm
return
true
;
}
if
(
QTextEdit
*
const
object
=
qobject_cast
<
QTextEdit
*>
(
Object
))
{
object
->
document
()
->
setPlainText
(
value
);
return
true
;
}
qCritical
()
<<
"calling set_string on unhandled type "
<<
Object
;
Error
=
true
;
...
...
pqLineEditEventTranslator.cxx
View file @
8f6cfd29
...
...
@@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QEvent>
#include <QLineEdit>
#include <QSpinBox>
#include <QTextDocument>
#include <QTextEdit>
pqLineEditEventTranslator
::
pqLineEditEventTranslator
(
QObject
*
p
)
:
pqWidgetEventTranslator
(
p
)
...
...
@@ -44,18 +46,30 @@ pqLineEditEventTranslator::pqLineEditEventTranslator(QObject* p)
bool
pqLineEditEventTranslator
::
translateEvent
(
QObject
*
Object
,
QEvent
*
Event
,
bool
&
/*Error*/
)
{
QLineEdit
*
const
object
=
qobject_cast
<
QLineEdit
*>
(
Object
);
if
(
!
object
)
QTextEdit
*
const
teObject
=
qobject_cast
<
QTextEdit
*>
(
Object
);
if
(
!
object
&&
!
teObject
)
{
return
false
;
}
// If this line edit is part of a spinbox, don't translate events (the spinbox translator will receive the final value directly)
if
(
qobject_cast
<
QSpinBox
*>
(
Object
->
parent
()))
{
return
false
;
}
switch
(
Event
->
type
())
{
case
QEvent
::
KeyRelease
:
{
emit
recordEvent
(
Object
,
"set_string"
,
object
->
text
());
if
(
object
)
{
emit
recordEvent
(
Object
,
"set_string"
,
object
->
text
());
}
else
if
(
teObject
)
{
emit
recordEvent
(
Object
,
"set_string"
,
teObject
->
document
()
->
toPlainText
());
}
}
break
;
default:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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