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
8d19eace
Commit
8d19eace
authored
Jun 22, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: ExtensionsModel: use data abstraction in delegate
parent
804c64f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.cpp
+11
-7
modules/gui/qt4/dialogs/plugins.hpp
modules/gui/qt4/dialogs/plugins.hpp
+1
-0
No files found.
modules/gui/qt4/dialogs/plugins.cpp
View file @
8d19eace
...
...
@@ -387,6 +387,12 @@ QVariant ExtensionListModel::data( const QModelIndex& index, int role ) const
switch
(
role
)
{
case
Qt
:
:
DisplayRole
:
return
((
ExtensionCopy
*
)
index
.
internalPointer
())
->
title
;
case
Qt
:
:
DecorationRole
:
return
*
((
ExtensionCopy
*
)
index
.
internalPointer
())
->
icon
;
case
DescriptionRole
:
return
((
ExtensionCopy
*
)
index
.
internalPointer
())
->
shortdesc
;
default:
return
QVariant
();
}
...
...
@@ -419,9 +425,6 @@ void ExtensionItemDelegate::paint( QPainter *painter,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
ExtensionCopy
*
ext
=
(
ExtensionCopy
*
)
index
.
internalPointer
();
assert
(
ext
!=
NULL
);
int
width
=
option
.
rect
.
width
();
// Pixmap: buffer where to draw
...
...
@@ -453,10 +456,11 @@ void ExtensionItemDelegate::paint( QPainter *painter,
QFontMetrics
metrics
=
option
.
fontMetrics
;
// Icon
if
(
ext
->
icon
!=
NULL
)
QPixmap
icon
=
index
.
data
(
Qt
::
DecorationRole
).
value
<
QPixmap
>
();
if
(
!
icon
.
isNull
()
)
{
pixpaint
->
drawPixmap
(
7
,
7
,
2
*
metrics
.
height
(),
2
*
metrics
.
height
(),
*
ext
->
icon
);
icon
);
}
// Title: bold
...
...
@@ -466,7 +470,7 @@ void ExtensionItemDelegate::paint( QPainter *painter,
pixpaint
->
drawText
(
QRect
(
17
+
2
*
metrics
.
height
(),
7
,
width
-
40
-
2
*
metrics
.
height
(),
metrics
.
height
()
),
Qt
::
AlignLeft
,
ext
->
title
);
Qt
::
AlignLeft
,
index
.
data
(
Qt
::
DisplayRole
).
toString
()
);
// Short description: normal
font
.
setBold
(
false
);
...
...
@@ -474,7 +478,7 @@ void ExtensionItemDelegate::paint( QPainter *painter,
pixpaint
->
drawText
(
QRect
(
17
+
2
*
metrics
.
height
(),
7
+
metrics
.
height
(),
width
-
40
,
metrics
.
height
()
),
Qt
::
AlignLeft
,
ext
->
shortdesc
);
Qt
::
AlignLeft
,
index
.
data
(
ExtensionListModel
::
DescriptionRole
).
toString
()
);
// Flush paint operations
delete
pixpaint
;
...
...
modules/gui/qt4/dialogs/plugins.hpp
View file @
8d19eace
...
...
@@ -135,6 +135,7 @@ public:
ExtensionListModel
(
QListView
*
view
,
intf_thread_t
*
p_intf
);
virtual
~
ExtensionListModel
();
static
const
Qt
::
ItemDataRole
DescriptionRole
=
Qt
::
UserRole
;
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
virtual
QModelIndex
index
(
int
row
,
int
column
=
0
,
const
QModelIndex
&
=
QModelIndex
()
)
const
;
...
...
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