Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Office
Calligra
Commits
594f073c
Commit
594f073c
authored
Jul 06, 2011
by
José Luis Vergara
Browse files
Handle the start of a drag event in KoDocumentSectionView to bypass a bug in QTreeView
BUG:187346
parent
2f29e0d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
libs/main/KoDocumentSectionView.cpp
View file @
594f073c
...
...
@@ -28,6 +28,7 @@
#include
<QMenu>
#include
<QMouseEvent>
#include
<QPersistentModelIndex>
#include
<QApplication>
class
KoDocumentSectionView
::
Private
{
...
...
@@ -36,6 +37,7 @@ public:
KoDocumentSectionDelegate
*
delegate
;
DisplayMode
mode
;
QPersistentModelIndex
hovered
;
QPoint
lastPos
;
};
KoDocumentSectionView
::
KoDocumentSectionView
(
QWidget
*
parent
)
...
...
@@ -91,6 +93,7 @@ bool KoDocumentSectionView::viewportEvent(QEvent *e)
switch
(
e
->
type
())
{
case
QEvent
::
MouseButtonPress
:
{
const
QPoint
pos
=
static_cast
<
QMouseEvent
*>
(
e
)
->
pos
();
d
->
lastPos
=
pos
;
if
(
!
indexAt
(
pos
).
isValid
())
return
QTreeView
::
viewportEvent
(
e
);
QModelIndex
index
=
model
()
->
buddy
(
indexAt
(
pos
));
...
...
@@ -116,6 +119,13 @@ bool KoDocumentSectionView::viewportEvent(QEvent *e)
}
d
->
hovered
=
hovered
;
}
QMouseEvent
*
mouseEvent
=
static_cast
<
QMouseEvent
*>
(
e
);
if
((
Qt
::
LeftButton
|
Qt
::
MidButton
)
&
mouseEvent
->
buttons
())
{
if
((
mouseEvent
->
pos
()
-
d
->
lastPos
).
manhattanLength
()
>
qApp
->
startDragDistance
())
{
return
QTreeView
::
viewportEvent
(
e
);
}
return
true
;
}
}
break
;
case
QEvent
::
ToolTip
:
{
const
QPoint
pos
=
static_cast
<
QHelpEvent
*>
(
e
)
->
pos
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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