diff --git a/mainwindow.cpp b/mainwindow.cpp
index 634599e..ed735b8 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -4,6 +4,7 @@
int mplayer_pid;
pthread_t t1,t2; //
+char current_song_path_name[128] = "";
void *getTimerThreadFunc(void *arg); // 发送获取当前时间的 mplayer 命令
void *readPipeMSG(void *arg); // 获取当前时间的线程
@@ -13,6 +14,15 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
+
+
+ QSize windowSize = QSize(geometry().width(), geometry().height());
+ // 设置背景图片
+ setAutoFillBackground(true);
+ QPalette pal = this->palette();
+ pal.setBrush(backgroundRole(),QPixmap(":/img/background1").scaled(windowSize, Qt::KeepAspectRatio));
+ setPalette(pal);
+
initMainWindow(); // 初始化主界面
mplayerInit(); // 初始化 mplayer
kill(mplayer_pid,SIGSTOP);
@@ -36,8 +46,10 @@ void MainWindow::initMainWindow()
{
// 设置主窗体属性
setWindowTitle("音乐播放器");
+ setFixedSize(1055,750);
setWindowIcon(QIcon(":/icon/button"));
+
// 设置子组件背景透明
ui->song_list_widget->setAttribute(Qt::WA_TranslucentBackground);
ui->label_artist->setAttribute(Qt::WA_TranslucentBackground);
@@ -52,6 +64,8 @@ void MainWindow::initMainWindow()
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: yellow; width: 20px;}");
diff --git a/mainwindow.ui b/mainwindow.ui
index 82c396a..554ebd7 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -14,7 +14,7 @@
MainWindow
- background-image: url(:/img/background5);
+ background-color: rgb(136, 138, 133);