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
1f2e9aae
Commit
1f2e9aae
authored
Aug 09, 2007
by
Clinton Stimpson
Browse files
BUG: Fix record/playback of item views to support hitting
decoration items such as checkboxes.
parent
93bdb8cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
pqAbstractItemViewEventPlayer.cxx
View file @
1f2e9aae
...
...
@@ -118,18 +118,21 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co
else
if
(
Command
.
startsWith
(
"mouse"
))
{
QStringList
args
=
Arguments
.
split
(
','
);
if
(
args
.
size
()
==
4
)
if
(
args
.
size
()
==
6
)
{
Qt
::
MouseButton
button
=
static_cast
<
Qt
::
MouseButton
>
(
args
[
0
].
toInt
());
Qt
::
MouseButtons
buttons
=
static_cast
<
Qt
::
MouseButton
>
(
args
[
1
].
toInt
());
Qt
::
KeyboardModifiers
keym
=
static_cast
<
Qt
::
KeyboardModifier
>
(
args
[
2
].
toInt
());
QModelIndex
idx
=
GetIndex
(
object
,
args
[
3
]);
int
x
=
args
[
3
].
toInt
();
int
y
=
args
[
4
].
toInt
();
QModelIndex
idx
=
GetIndex
(
object
,
args
[
5
]);
QRect
r
=
object
->
visualRect
(
idx
);
QPoint
pt
=
r
.
topLeft
()
+
QPoint
(
x
,
y
);
QEvent
::
Type
type
=
QEvent
::
MouseButtonPress
;
type
=
Command
==
"mouseMove"
?
QEvent
::
MouseMove
:
type
;
type
=
Command
==
"mouseRelease"
?
QEvent
::
MouseButtonRelease
:
type
;
type
=
Command
==
"mouseDblClick"
?
QEvent
::
MouseButtonDblClick
:
type
;
QMouseEvent
e
(
type
,
r
.
center
()
,
button
,
buttons
,
keym
);
QMouseEvent
e
(
type
,
pt
,
button
,
buttons
,
keym
);
QCoreApplication
::
sendEvent
(
object
->
viewport
(),
&
e
);
pqEventDispatcher
::
processEventsAndWait
(
1
);
return
true
;
...
...
pqAbstractItemViewEventTranslator.cxx
View file @
1f2e9aae
...
...
@@ -83,60 +83,45 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent*
return
true
;
}
case
QEvent
::
MouseButtonPress
:
case
QEvent
::
MouseButtonDblClick
:
case
QEvent
::
MouseButtonRelease
:
{
if
(
Object
==
object
)
{
return
false
;
}
QMouseEvent
*
mouseEvent
=
dynamic_cast
<
QMouseEvent
*>
(
Event
);
this
->
LastPos
=
mouseEvent
->
pos
();
QModelIndex
idx
=
object
->
indexAt
(
mouseEvent
->
pos
());
QString
idxStr
=
toIndexStr
(
idx
);
QString
info
=
QString
(
"%1,%2,%3,%4"
)
.
arg
(
mouseEvent
->
button
())
.
arg
(
mouseEvent
->
buttons
())
.
arg
(
mouseEvent
->
modifiers
())
.
arg
(
idxStr
);
emit
recordEvent
(
object
,
"mousePress"
,
info
);
return
true
;
}
case
QEvent
::
MouseButtonDblClick
:
{
if
(
Object
==
object
)
if
(
Event
->
type
()
!=
QEvent
::
MouseButtonRelease
)
{
return
false
;
this
->
LastPos
=
mouseEvent
->
pos
()
;
}
QMouseEvent
*
mouseEvent
=
dynamic_cast
<
QMouseEvent
*>
(
Event
);
this
->
LastPos
=
mouseEvent
->
pos
();
QModelIndex
idx
=
object
->
indexAt
(
mouseEvent
->
pos
());
QString
idxStr
=
toIndexStr
(
idx
);
QString
info
=
QString
(
"%1,%2,%3,%4"
)
QRect
r
=
object
->
visualRect
(
idx
);
QPoint
relPt
=
mouseEvent
->
pos
()
-
r
.
topLeft
();
QString
info
=
QString
(
"%1,%2,%3,%4,%5,%6"
)
.
arg
(
mouseEvent
->
button
())
.
arg
(
mouseEvent
->
buttons
())
.
arg
(
mouseEvent
->
modifiers
())
.
arg
(
relPt
.
x
())
.
arg
(
relPt
.
y
())
.
arg
(
idxStr
);
emit
recordEvent
(
object
,
"mouseDblClick"
,
info
);
return
true
;
}
case
QEvent
::
MouseButtonRelease
:
{
if
(
Object
==
object
)
if
(
Event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
return
false
;
emit
recordEvent
(
object
,
"mousePress"
,
info
)
;
}
QMouseEvent
*
mouseEvent
=
dynamic_cast
<
QMouseEvent
*>
(
Event
);
QModelIndex
idx
=
object
->
indexAt
(
mouseEvent
->
pos
());
QString
idxStr
=
toIndexStr
(
idx
);
QString
info
=
QString
(
"%1,%2,%3,%4"
)
.
arg
(
mouseEvent
->
button
())
.
arg
(
mouseEvent
->
buttons
())
.
arg
(
mouseEvent
->
modifiers
())
.
arg
(
idxStr
);
if
(
this
->
LastPos
!=
mouseEvent
->
pos
())
else
if
(
Event
->
type
()
==
QEvent
::
MouseButtonDblClick
)
{
emit
recordEvent
(
object
,
"mouseDblClick"
,
info
);
}
else
if
(
Event
->
type
()
==
QEvent
::
MouseButtonRelease
)
{
emit
recordEvent
(
object
,
"mouseMove"
,
info
);
if
(
this
->
LastPos
!=
mouseEvent
->
pos
())
{
emit
recordEvent
(
object
,
"mouseMove"
,
info
);
}
emit
recordEvent
(
object
,
"mouseRelease"
,
info
);
}
emit
recordEvent
(
object
,
"mouseRelease"
,
info
);
return
true
;
}
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