界面初版完成

This commit is contained in:
flykhan 2023-08-29 20:24:16 +08:00
parent 34186830fd
commit 5533d5fe62
3 changed files with 376 additions and 5 deletions

View File

@ -6,6 +6,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
initMainWindow(); // 初始化界面
}
MainWindow::~MainWindow()
@ -13,3 +14,23 @@ MainWindow::~MainWindow()
delete ui;
}
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;}");
}

View File

@ -15,6 +15,9 @@ public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
public:
void initMainWindow();
private:
Ui::MainWindow *ui;
};

View File

@ -6,17 +6,364 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>1055</width>
<height>750</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar"/>
<property name="styleSheet">
<string notr="true">background-image: url(:/img/background5);</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="widget_show" native="true">
<property name="geometry">
<rect>
<x>50</x>
<y>150</y>
<width>581</width>
<height>391</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 12pt &quot;微软雅黑&quot;;color: rgb(255, 255, 0);
background-image: url(:/img/background2);</string>
</property>
</widget>
<widget class="QListWidget" name="song_list_widget">
<property name="geometry">
<rect>
<x>750</x>
<y>80</y>
<width>241</width>
<height>461</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 0);</string>
</property>
<item>
<property name="text">
<string>新建项目</string>
</property>
</item>
<item>
<property name="text">
<string>新建项目</string>
</property>
</item>
<item>
<property name="text">
<string>新建项目</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_artist">
<property name="geometry">
<rect>
<x>190</x>
<y>100</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0);</string>
</property>
<property name="text">
<string>歌手</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_song_name">
<property name="geometry">
<rect>
<x>240</x>
<y>30</y>
<width>221</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 16pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0);</string>
</property>
<property name="text">
<string>歌名</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_meta_album">
<property name="geometry">
<rect>
<x>380</x>
<y>100</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;微软雅黑&quot;;color: rgb(255, 255, 0);</string>
</property>
<property name="text">
<string>专辑</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_song_list">
<property name="geometry">
<rect>
<x>800</x>
<y>30</y>
<width>141</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 18pt &quot;微软雅黑&quot;;color: rgb(255, 255, 0);</string>
</property>
<property name="text">
<string> 歌曲列表</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QWidget" name="contrl_widget" native="true">
<property name="geometry">
<rect>
<x>110</x>
<y>590</y>
<width>471</width>
<height>74</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="back_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/back</normaloff>:/icon/back</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="last_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/last</normaloff>:/icon/last</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="play_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/button_play</normaloff>:/icon/button_play</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="next_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/next</normaloff>:/icon/next</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="front_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/front</normaloff>:/icon/front</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QSlider" name="time_slider">
<property name="geometry">
<rect>
<x>130</x>
<y>550</y>
<width>421</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QWidget" name="volume_widget" native="true">
<property name="geometry">
<rect>
<x>760</x>
<y>550</y>
<width>219</width>
<height>120</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSlider" name="volume_slider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="mute_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/mute2</normaloff>:/icon/mute2</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="volume_down_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/volume0</normaloff>:/icon/volume0</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="volume_up_btn">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/icon/volume1</normaloff>:/icon/volume1</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="time_left_label">
<property name="geometry">
<rect>
<x>40</x>
<y>550</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="time_right_label">
<property name="geometry">
<rect>
<x>570</x>
<y>550</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1055</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<resources>
<include location="res.qrc"/>
</resources>
<connections/>
</ui>