TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicopenfilewidget.cpp
Go to the documentation of this file.
1 #include "musicopenfilewidget.h"
2 #include "musicwidgetutils.h"
3 #include "musicwidgetheaders.h"
4 #include "ttkclickedlabel.h"
5 
7  : QWidget(parent)
8 {
9  QGridLayout *layout = new QGridLayout(this);
10  layout->setContentsMargins(0, 0, 0, 0);
11 
12  QLabel *uploadFileIcon = new QLabel(this);
13  uploadFileIcon->setPixmap(QPixmap(":/tiny/btn_open_file"));
14  TTKClickedLabel *uploadFile = new TTKClickedLabel(this);
15  uploadFile->setText(tr("Open File"));
16  uploadFile->setStyleSheet(TTK::UI::ColorStyle02);
18  connect(uploadFile, SIGNAL(clicked()), SIGNAL(uploadFileClicked()));
19 
20  QLabel *uploadDirIcon = new QLabel(this);
21  uploadDirIcon->setPixmap(QPixmap(":/tiny/btn_open_files"));
22  TTKClickedLabel *uploadDir = new TTKClickedLabel(this);
23  uploadDir->setText(tr("Open Dir"));
24  uploadDir->setStyleSheet(TTK::UI::ColorStyle02);
26  connect(uploadDir, SIGNAL(clicked()), SIGNAL(uploadDirClicked()));
27 
28  layout->addWidget(uploadFileIcon, 0, 0, Qt::AlignRight);
29  layout->addWidget(uploadFile, 0, 1, Qt::AlignLeft);
30  layout->addWidget(uploadDirIcon, 1, 0, Qt::AlignRight);
31  layout->addWidget(uploadDir, 1, 1, Qt::AlignLeft);
32  setLayout(layout);
33 
34  resize(150, 50);
35 }
36 
38 {
39  const int x = (w - width() - 60) / 2;
40  const int y = (h - height()) / 2;
41  move(x, y);
42 }
MusicOpenFileWidget(QWidget *parent=nullptr)
void adjustWidgetRect(int w, int h)
The class of the label widget that can click.
TTK_MODULE_EXPORT void setFontStyle(QWidget *widget, TTK::FontStyleMode type)
static const QString ColorStyle02
Definition: musicuiobject.h:40