Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
d49a3263
Commit
d49a3263
authored
Mar 10, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: use Qt::DropAction properly throughout playlist drag-and-drop
parent
79944bce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
25 deletions
+41
-25
modules/gui/qt4/components/playlist/icon_view.cpp
modules/gui/qt4/components/playlist/icon_view.cpp
+26
-0
modules/gui/qt4/components/playlist/icon_view.hpp
modules/gui/qt4/components/playlist/icon_view.hpp
+3
-0
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+5
-25
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+6
-0
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+1
-0
No files found.
modules/gui/qt4/components/playlist/icon_view.cpp
View file @
d49a3263
...
...
@@ -33,6 +33,7 @@
#include <QFontMetrics>
#include <QPixmapCache>
#include <QDrag>
#include <QDragMoveEvent>
#include "assert.h"
...
...
@@ -319,6 +320,14 @@ static void plViewStartDrag( QAbstractItemView *view, const Qt::DropActions & su
drag
->
exec
(
supportedActions
);
}
static
void
plViewDragMoveEvent
(
QAbstractItemView
*
view
,
QDragMoveEvent
*
event
)
{
if
(
event
->
keyboardModifiers
()
&
Qt
::
ControlModifier
&&
event
->
possibleActions
()
&
Qt
::
CopyAction
)
event
->
setDropAction
(
Qt
::
CopyAction
);
else
event
->
acceptProposedAction
();
}
PlIconView
::
PlIconView
(
PLModel
*
model
,
QWidget
*
parent
)
:
QListView
(
parent
)
{
PlIconViewItemDelegate
*
delegate
=
new
PlIconViewItemDelegate
(
this
);
...
...
@@ -344,6 +353,12 @@ void PlIconView::startDrag ( Qt::DropActions supportedActions )
plViewStartDrag
(
this
,
supportedActions
);
}
void
PlIconView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
plViewDragMoveEvent
(
this
,
event
);
QAbstractItemView
::
dragMoveEvent
(
event
);
}
PlListView
::
PlListView
(
PLModel
*
model
,
QWidget
*
parent
)
:
QListView
(
parent
)
{
setModel
(
model
);
...
...
@@ -364,8 +379,19 @@ void PlListView::startDrag ( Qt::DropActions supportedActions )
plViewStartDrag
(
this
,
supportedActions
);
}
void
PlListView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
plViewDragMoveEvent
(
this
,
event
);
QAbstractItemView
::
dragMoveEvent
(
event
);
}
void
PlTreeView
::
startDrag
(
Qt
::
DropActions
supportedActions
)
{
plViewStartDrag
(
this
,
supportedActions
);
}
void
PlTreeView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
plViewDragMoveEvent
(
this
,
event
);
QAbstractItemView
::
dragMoveEvent
(
event
);
}
modules/gui/qt4/components/playlist/icon_view.hpp
View file @
d49a3263
...
...
@@ -70,6 +70,7 @@ public:
PlIconView
(
PLModel
*
model
,
QWidget
*
parent
=
0
);
private:
void
startDrag
(
Qt
::
DropActions
supportedActions
);
void
dragMoveEvent
(
QDragMoveEvent
*
event
);
};
class
PlListView
:
public
QListView
...
...
@@ -80,6 +81,7 @@ public:
PlListView
(
PLModel
*
model
,
QWidget
*
parent
=
0
);
private:
void
startDrag
(
Qt
::
DropActions
supportedActions
);
void
dragMoveEvent
(
QDragMoveEvent
*
event
);
};
class
PlTreeView
:
public
QTreeView
...
...
@@ -88,6 +90,7 @@ class PlTreeView : public QTreeView
private:
void
startDrag
(
Qt
::
DropActions
supportedActions
);
void
dragMoveEvent
(
QDragMoveEvent
*
event
);
};
#endif
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
d49a3263
...
...
@@ -108,7 +108,7 @@ PLModel::~PLModel()
Qt
::
DropActions
PLModel
::
supportedDropActions
()
const
{
return
Qt
::
CopyAction
;
/* Why not Qt::MoveAction */
return
Qt
::
CopyAction
|
Qt
::
MoveAction
;
}
Qt
::
ItemFlags
PLModel
::
flags
(
const
QModelIndex
&
index
)
const
...
...
@@ -189,33 +189,13 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
bool
PLModel
::
dropMimeData
(
const
QMimeData
*
data
,
Qt
::
DropAction
action
,
int
row
,
int
column
,
const
QModelIndex
&
parent
)
{
bool
copy
=
action
==
Qt
::
CopyAction
;
if
(
!
copy
&&
action
!=
Qt
::
MoveAction
)
return
true
;
const
PlMimeData
*
plMimeData
=
qobject_cast
<
const
PlMimeData
*>
(
data
);
if
(
plMimeData
)
{
if
(
action
==
Qt
::
IgnoreAction
)
return
true
;
PL_LOCK
;
playlist_item_t
*
p_parent
=
playlist_ItemGetById
(
p_playlist
,
itemId
(
parent
)
);
if
(
!
p_parent
||
p_parent
->
i_children
==
-
1
)
{
PL_UNLOCK
;
return
false
;
}
bool
copy
=
false
;
playlist_item_t
*
p_pl
=
p_playlist
->
p_playing
;
playlist_item_t
*
p_ml
=
p_playlist
->
p_media_library
;
if
(
row
==
-
1
&&
(
(
p_pl
&&
p_parent
==
p_pl
)
||
(
p_ml
&&
p_parent
==
p_ml
)
)
)
copy
=
true
;
PL_UNLOCK
;
if
(
copy
)
dropAppendCopy
(
plMimeData
,
getItem
(
parent
)
);
else
...
...
modules/gui/qt4/components/playlist/selector.cpp
View file @
d49a3263
...
...
@@ -372,6 +372,12 @@ bool PLSelector::dropMimeData ( QTreeWidgetItem * parent, int index,
return
true
;
}
void
PLSelector
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
event
->
setDropAction
(
Qt
::
CopyAction
);
QAbstractItemView
::
dragMoveEvent
(
event
);
}
void
PLSelector
::
plItemAdded
(
int
item
,
int
parent
)
{
if
(
parent
!=
podcastsParentId
)
return
;
...
...
modules/gui/qt4/components/playlist/selector.hpp
View file @
d49a3263
...
...
@@ -119,6 +119,7 @@ protected:
private:
QStringList
mimeTypes
()
const
;
bool
dropMimeData
(
QTreeWidgetItem
*
,
int
,
const
QMimeData
*
,
Qt
::
DropAction
);
void
dragMoveEvent
(
QDragMoveEvent
*
event
);
void
createItems
();
void
drawBranches
(
QPainter
*
,
const
QRect
&
,
const
QModelIndex
&
)
const
;
PLSelItem
*
addItem
(
...
...
Write
Preview
Markdown
is supported
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