Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
666851ce
Commit
666851ce
authored
Sep 06, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: menus: do not store QModelIndex.
parent
78390cbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
modules/gui/qt4/util/qmenuview.cpp
modules/gui/qt4/util/qmenuview.cpp
+4
-5
No files found.
modules/gui/qt4/util/qmenuview.cpp
View file @
666851ce
...
...
@@ -30,7 +30,6 @@
#include <QVariant>
#include <assert.h>
/***
* This is a simple view, like a QListView, but displayed as a QMenu
* So far, this is quite limited.
...
...
@@ -41,7 +40,7 @@
* - deal with a root item
***/
Q_DECLARE_METATYPE
(
QModelIndex
);
// So we can store it in a QVariant
Q_DECLARE_METATYPE
(
Q
Persistent
ModelIndex
);
// So we can store it in a QVariant
QMenuView
::
QMenuView
(
QWidget
*
parent
,
int
_iMaxVisibleCount
)
:
QMenu
(
parent
),
iMaxVisibleCount
(
_iMaxVisibleCount
)
...
...
@@ -107,7 +106,7 @@ QAction* QMenuView::createActionFromIndex( QModelIndex index )
action
->
setEnabled
(
index
.
flags
().
testFlag
(
Qt
::
ItemIsEnabled
)
);
/* */
QVariant
variant
;
variant
.
setValue
(
index
);
QVariant
variant
;
variant
.
setValue
(
QPersistentModelIndex
(
index
)
);
action
->
setData
(
variant
);
return
action
;
...
...
@@ -119,9 +118,9 @@ void QMenuView::activate( QAction* action )
assert
(
m_model
);
QVariant
variant
=
action
->
data
();
if
(
variant
.
canConvert
<
QModelIndex
>
()
)
if
(
variant
.
canConvert
<
Q
Persistent
ModelIndex
>
()
)
{
emit
activated
(
variant
.
value
<
QModelIndex
>
());
emit
activated
(
variant
.
value
<
Q
Persistent
ModelIndex
>
());
}
}
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