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
9a26920d
Commit
9a26920d
authored
Jan 25, 2010
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: get a correct icon_View design
This is not top quality yet, but it is usable.
parent
8a4209e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
modules/gui/qt4/components/playlist/icon_view.cpp
modules/gui/qt4/components/playlist/icon_view.cpp
+40
-3
No files found.
modules/gui/qt4/components/playlist/icon_view.cpp
View file @
9a26920d
...
@@ -23,17 +23,55 @@
...
@@ -23,17 +23,55 @@
#include "components/playlist/icon_view.hpp"
#include "components/playlist/icon_view.hpp"
#include "components/playlist/playlist_model.hpp"
#include "components/playlist/playlist_model.hpp"
#include "input_manager.hpp"
#include <QPainter>
#include <QPainter>
#include <QRect>
#include <QStyleOptionViewItem>
#include "assert.h"
#define RECT_SIZE 100
#define ART_SIZE 64
#define OFFSET (100-64)/2
void
PlListViewItemDelegate
::
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
void
PlListViewItemDelegate
::
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
{
QStyledItemDelegate
::
paint
(
painter
,
option
,
index
);
painter
->
setRenderHint
(
QPainter
::
Antialiasing
);
if
(
option
.
state
&
QStyle
::
State_Selected
)
painter
->
fillRect
(
option
.
rect
,
option
.
palette
.
highlight
());
PLItem
*
currentItem
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
assert
(
currentItem
);
QPixmap
pix
;
QString
url
=
InputManager
::
decodeArtURL
(
currentItem
->
inputItem
()
);
if
(
!
url
.
isEmpty
()
&&
pix
.
load
(
url
)
)
{
pix
=
pix
.
scaled
(
ART_SIZE
,
ART_SIZE
,
Qt
::
KeepAspectRatioByExpanding
);
}
else
{
pix
=
QPixmap
(
":/noart.png"
);
}
QRect
art_rect
=
option
.
rect
.
adjusted
(
OFFSET
-
1
,
0
,
-
OFFSET
,
-
OFFSET
*
2
);
painter
->
drawPixmap
(
art_rect
,
pix
);
painter
->
setFont
(
QFont
(
"Verdana"
,
7
)
);
QRect
textRect
=
option
.
rect
.
adjusted
(
1
,
ART_SIZE
+
2
,
-
1
,
-
1
);
painter
->
drawText
(
textRect
,
qfu
(
input_item_GetTitle
(
currentItem
->
inputItem
()
)
),
QTextOption
(
Qt
::
AlignCenter
)
);
}
}
QSize
PlListViewItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
QSize
PlListViewItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
{
return
QSize
(
100
,
100
);
return
QSize
(
RECT_SIZE
,
RECT_SIZE
);
}
}
...
@@ -46,4 +84,3 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
...
@@ -46,4 +84,3 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
PlListViewItemDelegate
*
pl
=
new
PlListViewItemDelegate
();
PlListViewItemDelegate
*
pl
=
new
PlListViewItemDelegate
();
setItemDelegate
(
pl
);
setItemDelegate
(
pl
);
}
}
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