From 13aeecc6c31be05b020724fc05b92cb65f96be60 Mon Sep 17 00:00:00 2001 From: flykhan Date: Tue, 29 Aug 2023 20:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2v2:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=9F=B3=E9=87=8F=E6=BB=91=E5=9D=97=E8=8C=83=E5=9B=B4=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mainwindow.cpp | 17 +++++++++++++- mainwindow.ui | 63 ++++++++++++++++++++++---------------------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f17771b..65d2a57 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6,7 +6,7 @@ MainWindow::MainWindow(QWidget *parent) , ui(new Ui::MainWindow) { ui->setupUi(this); - initMainWindow(); // 初始化界面 + initMainWindow(); // 初始化主界面 } MainWindow::~MainWindow() @@ -16,7 +16,10 @@ MainWindow::~MainWindow() 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); @@ -28,9 +31,21 @@ void MainWindow::initMainWindow() 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_widget->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;}"); + ui->volume_slider->setMinimum(0); // 最小音量 0 + ui->volume_slider->setMaximum(100); // 最大音量 100 + // 当前音量从 mplayer 属性获取 + +// QSlider* slider = new QSlider(Qt::Horizontal); +// slider->setMinimum(0); // 设置最小值 +// slider->setMaximum(100); // 设置最大值 +// slider->setValue(50); // 设置当前值 +// slider->setSingleStep(1); // 设置步长 + } diff --git a/mainwindow.ui b/mainwindow.ui index b48c321..5dbf900 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -27,8 +27,7 @@ - font: 12pt "微软雅黑";color: rgb(255, 255, 0); -background-image: url(:/img/background2); + font: 12pt "微软雅黑";color: rgb(255, 255, 0); @@ -234,19 +233,6 @@ color: rgb(255, 255, 0); - - - - 130 - 550 - 421 - 20 - - - - Qt::Horizontal - - @@ -323,31 +309,38 @@ color: rgb(255, 255, 0); - + - 40 + 50 550 - 72 - 15 + 581 + 40 - - TextLabel - - - - - - 570 - 550 - 72 - 15 - - - - TextLabel - + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + + + + TextLabel + + + +