qtmplayer/mainwindow.cpp

37 lines
1.4 KiB
C++
Raw Normal View History

#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
2023-08-29 20:24:16 +08:00
initMainWindow(); // 初始化界面
}
MainWindow::~MainWindow()
{
delete ui;
}
2023-08-29 20:24:16 +08:00
void MainWindow::initMainWindow()
{
setWindowTitle("音乐播放器");
ui->song_list_widget->setAttribute(Qt::WA_TranslucentBackground);
ui->label_artist->setAttribute(Qt::WA_TranslucentBackground);
ui->label_song_list->setAttribute(Qt::WA_TranslucentBackground);
ui->label_song_name->setAttribute(Qt::WA_TranslucentBackground);
ui->label_meta_album->setAttribute(Qt::WA_TranslucentBackground);
ui->contrl_widget->setAttribute(Qt::WA_TranslucentBackground);
ui->widget_show->setAttribute(Qt::WA_TranslucentBackground);
ui->volume_widget->setAttribute(Qt::WA_TranslucentBackground);
ui->widget_3->setAttribute(Qt::WA_TranslucentBackground);
ui->time_left_label->setAttribute(Qt::WA_TranslucentBackground);
ui->time_right_label->setAttribute(Qt::WA_TranslucentBackground);
ui->time_slider->setStyleSheet("QSlider::groove:horizontal { background-color: white; }"
"QSlider::handle:horizontal { background-color: blue; width: 20px;}");
ui->volume_slider->setStyleSheet("QSlider::groove:horizontal { background-color: gray; }"
"QSlider::handle:horizontal { background-color: yellow; width: 20px;}");
}