Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
6241fbf7
Commit
6241fbf7
authored
Feb 20, 2012
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: limit the number of entries in the right click to 25
Close #6103
parent
575ef3b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+1
-1
modules/gui/qt4/util/qmenuview.cpp
modules/gui/qt4/util/qmenuview.cpp
+6
-5
modules/gui/qt4/util/qmenuview.hpp
modules/gui/qt4/util/qmenuview.hpp
+6
-1
No files found.
modules/gui/qt4/menus.cpp
View file @
6241fbf7
...
...
@@ -1083,7 +1083,7 @@ void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
}
/* */
QMenuView
*
plMenu
=
new
QMenuView
(
menu
);
QMenuView
*
plMenu
=
new
QMenuView
(
menu
,
25
);
plMenu
->
setTitle
(
qtr
(
"Playlist"
)
);
PLModel
*
model
=
PLModel
::
getPLModel
(
p_intf
);
plMenu
->
setModel
(
model
);
...
...
modules/gui/qt4/util/qmenuview.cpp
View file @
6241fbf7
...
...
@@ -37,15 +37,14 @@
*
* This is now linked to VLC's models. It should be splittable in the future.
*
* TODO: - limit the number of the menu, as a Q_PROPERTY
* - limit the width of the entries
* TODO: - limit the width of the entries
* - deal with a root item
***/
Q_DECLARE_METATYPE
(
QModelIndex
);
// So we can store it in a QVariant
QMenuView
::
QMenuView
(
QWidget
*
parent
)
:
QMenu
(
parent
)
QMenuView
::
QMenuView
(
QWidget
*
parent
,
int
_iMaxVisibleCount
)
:
QMenu
(
parent
)
,
iMaxVisibleCount
(
_iMaxVisibleCount
)
{
m_model
=
NULL
;
...
...
@@ -75,7 +74,9 @@ void QMenuView::rebuild()
/* */
void
QMenuView
::
build
(
const
QModelIndex
&
parent
)
{
for
(
int
i
=
0
;
i
<
m_model
->
rowCount
(
parent
);
i
++
)
int
i_count
=
iMaxVisibleCount
==
0
?
m_model
->
rowCount
(
parent
)
:
__MIN
(
iMaxVisibleCount
,
m_model
->
rowCount
(
parent
)
);
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
{
QModelIndex
idx
=
m_model
->
index
(
i
,
0
,
parent
);
if
(
m_model
->
hasChildren
(
idx
)
)
...
...
modules/gui/qt4/util/qmenuview.hpp
View file @
6241fbf7
...
...
@@ -32,13 +32,16 @@ class QMenuView : public QMenu
Q_OBJECT
;
public:
QMenuView
(
QWidget
*
parent
=
0
);
QMenuView
(
QWidget
*
parent
=
0
,
int
iMaxVisibleCount
=
0
);
virtual
~
QMenuView
(){}
/* Model */
void
setModel
(
QAbstractItemModel
*
model
)
{
m_model
=
model
;
}
QAbstractItemModel
*
model
()
const
{
return
m_model
;
}
/* Size limit */
void
setMaximumItemCount
(
int
count
)
{
iMaxVisibleCount
=
count
;
}
private:
QAbstractItemModel
*
m_model
;
...
...
@@ -46,6 +49,8 @@ private:
void
build
(
const
QModelIndex
&
parent
);
int
iMaxVisibleCount
;
private
slots
:
void
rebuild
();
void
activate
(
QAction
*
);
...
...
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