-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaylistqueuelistview.cpp
47 lines (40 loc) · 1.9 KB
/
playlistqueuelistview.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "playlistqueuelistview.h"
PlaylistQueueListView::PlaylistQueueListView(QWidget *parent):
QListView(parent)
{
this->setStyleSheet("QListView#view_Playlist {"
"border: 1px solid #737373;"
"border-radius: 4px;"
"background-color: #1a1a1a;"
"outline: 0px;"
"}"
"QListView::item {"
"height: 60px;"
"padding: 5px;"
"}"
"QListView::item:selected:active {"
"background-color: #404040;"
"color: white;"
"}"
"QListView::item:selected:!active {"
"background-color: #4d4d4d;"
"color: lightgray;"
"}");
this->setContentsMargins(10, 10, 10, 10);
this->setIconSize(QSize(60, 60));
this->setDragEnabled(true);
this->viewport()->setAcceptDrops(true);
this->setDropIndicatorShown(true);
this->setAutoScroll(true);
this->setAutoScrollMargin(100);
this->verticalScrollBar()->setSingleStep(10);
this->setSelectionMode(QAbstractItemView::SingleSelection);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(doubleClickPlaylist(QModelIndex)));
}
void PlaylistQueueListView::doubleClickPlaylist(const QModelIndex &index)
{
PlaylistQueueModel *model = static_cast<PlaylistQueueModel *>(this->model());
model->playPlaylist(index.row());
}