今天数字要实现一下该项目的最新音乐模块,效果如图:
其实这个模块的内容应该是从数据库查询然后再显示,这里就简单的写死了,以后有时间在改了。
最新音乐的qss:
/*最新模块*/
/*最新音乐*/
QPushButton#ptnMusAll,#ptnMusChinese,#ptnMusEurope,
#ptnMusKorea,#ptnMusJapan
{
color:rgb(103,103,103);
border:0px;
background:rgb(255,255,255);
}
QPushButton:hover#ptnMusAll,:hover#ptnMusChinese,:hover#ptnMusEurope,
:hover#ptnMusKorea,:hover#ptnMusJapan
{
color:rgb(69,69,69);
border:0px;
background:rgb(255,255,255);
}
QPushButton::checked#ptnMusAll,::checked#ptnMusChinese,::checked#ptnMusEurope,
::checked#ptnMusKorea,::checked#ptnMusJapan
{
color:rgb(69,69,69);
font-weight: bold;
border:0px;
background:rgb(255,255,255);
}
/*全部播放*/
QPushButton#ptnPlayAll
{
border-image:url(images/NewMusic/playAll.png);
}
/*全部保存*/
QPushButton#ptnSaveAll
{
border-image:url(images/NewMusic/saveAll.png);
}
/**/
QListWidget#listAll
{
height:400px;
border:0px;
color:rgb(55,55,55);
background:rgb(255,255,255);
}
QListWidget::Item#listAll
{
height:80px;
border:0px solid rgb(255,255,255);
color:rgb(55,55,55);
background:rgb(255,255,255);
}
QListWidget::Item:hover#listAll
{
border-radius:2px;
background:rgb(239,239,239);
}
/*选中*/
QListWidget::Item:selected#listAll
{
border-radius:2px;
background:rgb(239,239,239);
}
主要代码:
#ifndef NEWCOURIERITEM_H
#define NEWCOURIERITEM_H
#include <QWidget>
namespace Ui {
class NewCourierItem;
}
class NewCourierItem : public QWidget
{
Q_OBJECT
public:
explicit NewCourierItem(QWidget *parent = nullptr);
~NewCourierItem();
//设置id
void setNum(int id);
//设置图片
void setPicture(QString url);
//设置歌名
void setMusicName(QString musicName);
//设置log 默认
void setLogPic();
//设置作者
void setMusicAuthor(QString author);
//设置专辑
void setMusicAlbum(QString name);
//设置timer
void setMusicTimer(QString strTimer);
private:
Ui::NewCourierItem *ui;
};
#endif // NEWCOURIERITEM_H
cpp:
#include "newcourieritem.h"
#include "ui_newcourieritem.h"
NewCourierItem::NewCourierItem(QWidget *parent) :
QWidget(parent),
ui(new Ui::NewCourierItem)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setStyleSheet("QWidget{background:transparent; border-radius:8px;}"
"QWidget:hover{background:transparent;}");
}
NewCourierItem::~NewCourierItem()
{
delete ui;
}
void NewCourierItem::setNum(int id)
{
ui->labMusicNum->setNum(id);
ui->labMusicNum->setStyleSheet("QLabel#labMusicNum{color:rgb(195,195,219);}");
}
void NewCourierItem::setPicture(QString url)
{
QString str = "QWidget{border-image:url("+url+");}";
ui->widMusicPic->setStyleSheet(str);
}
void NewCourierItem::setMusicName(QString musicName)
{
ui->MusicName->setText(musicName);
ui->MusicName->setStyleSheet("QLabel#MusicName{color:rgb(54,54,54);}");
}
void NewCourierItem::setLogPic()
{
ui->labMusicLog->setMaximumSize(27,17);
// ui->labMusicLog->setStyleSheet("QLable{border-image:url(:/images/NewMusic/sq2.png);}");
}
void NewCourierItem::setMusicAuthor(QString author)
{
ui->MusicAuthor->setText(author);
ui->MusicAuthor->setStyleSheet("QLabel#MusicAuthor{color:rgb(101,101,101);}");
}
void NewCourierItem::setMusicAlbum(QString name)
{
ui->MusicAlbum->setText(name);
ui->MusicAlbum->setStyleSheet("QLabel#MusicAlbum{color:rgb(101,101,101);}");
}
void NewCourierItem::setMusicTimer(QString strTimer)
{
ui->MusicTimer->setText(strTimer);
ui->MusicTimer->setStyleSheet("QLabel#MusicTimer{color:rgb(155,155,202);}");
}
显示代码片段:
#ifndef NEWCOURIER_H
#define NEWCOURIER_H
#include <QWidget>
#include <QListWidgetItem>
namespace Ui {
class NewCourier;
}
class NewCourier : public QWidget
{
Q_OBJECT
public:
explicit NewCourier(QWidget *parent = nullptr);
~NewCourier();
//设置对应数据
void setInitData();
void setChose(int id);
void setChinese(); //设置中文
void setEurope();//设置欧美
void setKorea(); //设置韩国
void setJapan(); //设置日文
private:
Ui::NewCourier *ui;
};
#endif // NEWCOURIER_H
#include "newcourier.h"
#include "ui_newcourier.h"
#include "newcourieritem.h"
NewCourier::NewCourier(QWidget *parent) :
QWidget(parent),
ui(new Ui::NewCourier)
{
ui->setupUi(this);
setInitData();
}
NewCourier::~NewCourier()
{
delete ui;
}
void NewCourier::setInitData()
{
ui->listAll->clear();
//
QListWidgetItem *item = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem = new NewCourierItem();
nitem->setNum(01); //设置编号
nitem->setPicture(":/images/NewMusic/01.png");
nitem->setMusicName("一起向未来");
nitem->setLogPic();
nitem->setMusicAuthor("易烊千玺");
nitem->setMusicAlbum("一起向未来");
nitem->setMusicTimer("03:19");
ui->listAll->setItemWidget(item,nitem);
QListWidgetItem *item2 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem2 = new NewCourierItem();
nitem2->setNum(02); //设置编号
nitem2->setPicture(":/images/NewMusic/02.png");
nitem2->setMusicName("灯牌");
nitem2->setLogPic();
nitem2->setMusicAuthor("刘也");
nitem2->setMusicAlbum("朝圣者");
nitem2->setMusicTimer("05:20");
ui->listAll->setItemWidget(item2,nitem2);
QListWidgetItem *item3 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem3 = new NewCourierItem();
nitem3->setNum(03); //设置编号
nitem3->setPicture(":/images/NewMusic/03.png");
nitem3->setMusicName("漠河舞厅2020");
nitem3->setLogPic();
nitem3->setMusicAuthor("柳爽");
nitem3->setMusicAlbum("漠河舞厅2020");
nitem3->setMusicTimer("05:04");
ui->listAll->setItemWidget(item3,nitem3);
QListWidgetItem *item4 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem4 = new NewCourierItem();
nitem4->setNum(04); //设置编号
nitem4->setPicture(":/images/NewMusic/04.png");
nitem4->setMusicName("B级鲨鱼");
nitem4->setLogPic();
nitem4->setMusicAuthor("裴德");
nitem4->setMusicAlbum("B级鲨鱼");
nitem4->setMusicTimer("03:51");
ui->listAll->setItemWidget(item4,nitem4);
QListWidgetItem *item5 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem5 = new NewCourierItem();
nitem5->setNum(05); //设置编号
nitem5->setPicture(":/images/NewMusic/05.png");
nitem5->setMusicName("春天花会开");
nitem5->setLogPic();
nitem5->setMusicAuthor("张杰");
nitem5->setMusicAlbum("时光音乐会");
nitem5->setMusicTimer("04:14");
ui->listAll->setItemWidget(item5,nitem5);
}
void NewCourier::setChose(int id)
{
switch (id) {
case 0:
setInitData();
break;
case 1:
setChinese();
break;
case 2:
setEurope();
break;
case 3:
setKorea();
break;
case 4:
setJapan();
break;
}
}
void NewCourier::setChinese()
{
ui->listAll->clear();
//
QListWidgetItem *item = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem = new NewCourierItem();
nitem->setNum(01); //设置编号
nitem->setPicture(":/images/NewMusic/06.png");
nitem->setMusicName("宣言");
nitem->setLogPic();
nitem->setMusicAuthor("赵磊");
nitem->setMusicAlbum("进击之月");
nitem->setMusicTimer("04:28");
ui->listAll->setItemWidget(item,nitem);
QListWidgetItem *item2 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem2 = new NewCourierItem();
nitem2->setNum(02); //设置编号
nitem2->setPicture(":/images/NewMusic/01.png");
nitem2->setMusicName("一起向未来");
nitem2->setLogPic();
nitem2->setMusicAuthor("易烊千玺");
nitem2->setMusicAlbum("一起向未来");
nitem2->setMusicTimer("03:19");
ui->listAll->setItemWidget(item2,nitem2);
QListWidgetItem *item3 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem3 = new NewCourierItem();
nitem3->setNum(03); //设置编号
nitem3->setPicture(":/images/NewMusic/03.png");
nitem3->setMusicName("漠河舞厅2020");
nitem3->setLogPic();
nitem3->setMusicAuthor("柳爽");
nitem3->setMusicAlbum("漠河舞厅2020");
nitem3->setMusicTimer("05:04");
ui->listAll->setItemWidget(item3,nitem3);
QListWidgetItem *item4 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem4 = new NewCourierItem();
nitem4->setNum(04); //设置编号
nitem4->setPicture(":/images/NewMusic/04.png");
nitem4->setMusicName("B级鲨鱼");
nitem4->setLogPic();
nitem4->setMusicAuthor("裴德");
nitem4->setMusicAlbum("B级鲨鱼");
nitem4->setMusicTimer("03:51");
ui->listAll->setItemWidget(item4,nitem4);
QListWidgetItem *item5 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem5 = new NewCourierItem();
nitem5->setNum(05); //设置编号
nitem5->setPicture(":/images/NewMusic/05.png");
nitem5->setMusicName("春天花会开");
nitem5->setLogPic();
nitem5->setMusicAuthor("张杰");
nitem5->setMusicAlbum("时光音乐会");
nitem5->setMusicTimer("04:14");
ui->listAll->setItemWidget(item5,nitem5);
}
void NewCourier::setEurope()
{
ui->listAll->clear();
//
QListWidgetItem *item = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem = new NewCourierItem();
nitem->setNum(01); //设置编号
nitem->setPicture(":/images/NewMusic/07.png");
nitem->setMusicName("Fay As Me");
nitem->setLogPic();
nitem->setMusicAuthor("Bruno Mars");
nitem->setMusicAlbum("An Evening With Silk Sonic");
nitem->setMusicTimer("03:39");
ui->listAll->setItemWidget(item,nitem);
QListWidgetItem *item2 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem2 = new NewCourierItem();
nitem2->setNum(02); //设置编号
nitem2->setPicture(":/images/NewMusic/08.png");
nitem2->setMusicName("Already Dead");
nitem2->setLogPic();
nitem2->setMusicAuthor("Juice WRLD");
nitem2->setMusicAlbum("Already Dead");
nitem2->setMusicTimer("03:51");
ui->listAll->setItemWidget(item2,nitem2);
QListWidgetItem *item3 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem3 = new NewCourierItem();
nitem3->setNum(03); //设置编号
nitem3->setPicture(":/images/NewMusic/09.png");
nitem3->setMusicName("Be Alive");
nitem3->setLogPic();
nitem3->setMusicAuthor("Beyonce");
nitem3->setMusicAlbum("Be Alive");
nitem3->setMusicTimer("03:40");
ui->listAll->setItemWidget(item3,nitem3);
QListWidgetItem *item4 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem4 = new NewCourierItem();
nitem4->setNum(04); //设置编号
nitem4->setPicture(":/images/NewMusic/10.png");
nitem4->setMusicName("Bite Me");
nitem4->setLogPic();
nitem4->setMusicAuthor("Avril Lavigne");
nitem4->setMusicAlbum("Bite Me");
nitem4->setMusicTimer("02:39");
ui->listAll->setItemWidget(item4,nitem4);
QListWidgetItem *item5 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem5 = new NewCourierItem();
nitem5->setNum(05); //设置编号
nitem5->setPicture(":/images/NewMusic/11.png");
nitem5->setMusicName("World We Used To Know");
nitem5->setLogPic();
nitem5->setMusicAuthor("Alan");
nitem5->setMusicAlbum("World We Used To Know");
nitem5->setMusicTimer("04:14");
ui->listAll->setItemWidget(item5,nitem5);
}
void NewCourier::setKorea()
{
ui->listAll->clear();
//
QListWidgetItem *item = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem = new NewCourierItem();
nitem->setNum(01); //设置编号
nitem->setPicture(":/images/NewMusic/12.png");
nitem->setMusicName("거대한 말");
nitem->setLogPic();
nitem->setMusicAuthor("B1A4");
nitem->setMusicAlbum("거대한 말");
nitem->setMusicTimer("03:56");
ui->listAll->setItemWidget(item,nitem);
QListWidgetItem *item2 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem2 = new NewCourierItem();
nitem2->setNum(02); //设置编号
nitem2->setPicture(":/images/NewMusic/13.png");
nitem2->setMusicName("SNAPSHOT");
nitem2->setLogPic();
nitem2->setMusicAuthor("jessica");
nitem2->setMusicAlbum("제시카 & 크리스탈 - US로드");
nitem2->setMusicTimer("03:10");
ui->listAll->setItemWidget(item2,nitem2);
QListWidgetItem *item3 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem3 = new NewCourierItem();
nitem3->setNum(03); //设置编号
nitem3->setPicture(":/images/NewMusic/14.png");
nitem3->setMusicName("DAYDREAM");
nitem3->setLogPic();
nitem3->setMusicAuthor("jessica");
nitem3->setMusicAlbum("제시카 & 크리스탈 - US로드");
nitem3->setMusicTimer("05:04");
ui->listAll->setItemWidget(item3,nitem3);
QListWidgetItem *item4 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem4 = new NewCourierItem();
nitem4->setNum(04); //设置编号
nitem4->setPicture(":/images/NewMusic/15.png");
nitem4->setMusicName("같은 곳을 향해가");
nitem4->setLogPic();
nitem4->setMusicAuthor("유지현 김상지");
nitem4->setMusicAlbum("같은 곳을 향해가");
nitem4->setMusicTimer("03:51");
ui->listAll->setItemWidget(item4,nitem4);
QListWidgetItem *item5 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem5 = new NewCourierItem();
nitem5->setNum(05); //设置编号
nitem5->setPicture(":/images/NewMusic/16.png");
nitem5->setMusicName("9号线少女");
nitem5->setLogPic();
nitem5->setMusicAuthor("Yourbeagle");
nitem5->setMusicAlbum("9号线少女");
nitem5->setMusicTimer("03:00");
ui->listAll->setItemWidget(item5,nitem5);
}
void NewCourier::setJapan()
{
ui->listAll->clear();
//
QListWidgetItem *item = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem = new NewCourierItem();
nitem->setNum(01); //设置编号
nitem->setPicture(":/images/NewMusic/17.png");
nitem->setMusicName("MAKAFUKA");
nitem->setLogPic();
nitem->setMusicAuthor("RADWIMPS");
nitem->setMusicAlbum("FOREVER DAZE");
nitem->setMusicTimer("05:31");
ui->listAll->setItemWidget(item,nitem);
QListWidgetItem *item2 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem2 = new NewCourierItem();
nitem2->setNum(02); //设置编号
nitem2->setPicture(":/images/NewMusic/18.png");
nitem2->setMusicName("Chopstick");
nitem2->setLogPic();
nitem2->setMusicAuthor("Niziu");
nitem2->setMusicAlbum("Chopstick");
nitem2->setMusicTimer("02:57");
ui->listAll->setItemWidget(item2,nitem2);
QListWidgetItem *item3 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem3 = new NewCourierItem();
nitem3->setNum(03); //设置编号
nitem3->setPicture(":/images/NewMusic/19.png");
nitem3->setMusicName("ラストシーン");
nitem3->setLogPic();
nitem3->setMusicAuthor("菅田将暉");
nitem3->setMusicAlbum("ラストシーン");
nitem3->setMusicTimer("04:29");
ui->listAll->setItemWidget(item3,nitem3);
QListWidgetItem *item4 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem4 = new NewCourierItem();
nitem4->setNum(04); //设置编号
nitem4->setPicture(":/images/NewMusic/20.png");
nitem4->setMusicName("starting over");
nitem4->setLogPic();
nitem4->setMusicAuthor("三代目");
nitem4->setMusicAlbum("BEST BROTHERS");
nitem4->setMusicTimer("04:20");
ui->listAll->setItemWidget(item4,nitem4);
QListWidgetItem *item5 = new QListWidgetItem(ui->listAll);
NewCourierItem * nitem5 = new NewCourierItem();
nitem5->setNum(05); //设置编号
nitem5->setPicture(":/images/NewMusic/21.png");
nitem5->setMusicName("Ito");
nitem5->setLogPic();
nitem5->setMusicAuthor("TOMORROW X");
nitem5->setMusicAlbum("Chaotic");
nitem5->setMusicTimer("04:30");
ui->listAll->setItemWidget(item5,nitem5);
}
新碟上架模块:
#ifndef NEWDISC_H
#define NEWDISC_H
#include <QWidget>
namespace Ui {
class NewDisc;
}
class NewDisc : public QWidget
{
Q_OBJECT
public:
explicit NewDisc(QWidget *parent = nullptr);
~NewDisc();
void setInitData();
void setChose(int id);
void setChinese(); //设置中文
void setEurope();//设置欧美
void setKorea(); //设置韩国
void setJapan(); //设置日文
private:
Ui::NewDisc *ui;
};
#endif // NEWDISC_H
#include "newdisc.h"
#include "ui_newdisc.h"
NewDisc::NewDisc(QWidget *parent) :
QWidget(parent),
ui(new Ui::NewDisc)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setStyleSheet("QWidget{background:transparent; border-radius:8px;}"
"QWidget:hover{background:transparent;}");
setInitData();
}
NewDisc::~NewDisc()
{
delete ui;
}
void NewDisc::setInitData()
{
ui->DiscF->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/DiscF.png);}");
ui->Disc0->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis01.png);}");
ui->Disc1->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis02.png);}");
ui->Disc2->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis03.png);}");
ui->Disc3->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis04.png);}");
ui->Disc4->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis05.png);}");
ui->Disc5->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis06.png);}");
ui->Disc6->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis07.png);}");
ui->Disc7->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis08.png);}");
ui->Disc01->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc02->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc03->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc04->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->labName01->setText("进击之月");
ui->labName01->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu01->setText("赵磊");
ui->labDiscAu01->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName02->setText("一起向未来");
ui->labName02->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu02->setText("易烊千玺");
ui->labDiscAu02->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName03->setText("All Too Well");
ui->labName03->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu03->setText("Switf");
ui->labDiscAu03->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName04->setText("B级鲨鱼");
ui->labName04->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu04->setText("裴德");
ui->labDiscAu04->setStyleSheet("QLabel{color:rgb(159,159,159);}");
}
void NewDisc::setChose(int id)
{
switch (id) {
case 0:
setInitData();
break;
case 1:
setChinese();
break;
case 2:
setEurope();
break;
case 3:
setKorea();
break;
case 4:
setJapan();
break;
}
}
void NewDisc::setChinese()
{
ui->DiscF->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/DiscT.png);}");
ui->Disc0->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis01.png);}");
ui->Disc1->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis02.png);}");
ui->Disc2->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis04.png);}");
ui->Disc3->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis07.png);}");
ui->Disc4->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis08.png);}");
ui->Disc5->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis10.png);}");
ui->Disc6->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis11.png);}");
ui->Disc7->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis12.png);}");
ui->Disc01->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc02->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc03->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc04->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->labName01->setText("进击之月");
ui->labName01->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu01->setText("赵磊");
ui->labDiscAu01->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName02->setText("一起向未来");
ui->labName02->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu02->setText("易烊千玺");
ui->labDiscAu02->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName03->setText("B级鲨鱼");
ui->labName03->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu03->setText("裴德");
ui->labDiscAu03->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName04->setText("云");
ui->labName04->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu04->setText("林鹿言");
ui->labDiscAu04->setStyleSheet("QLabel{color:rgb(159,159,159);}");
}
void NewDisc::setEurope()
{
ui->DiscF->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/DiscT.png);}");
ui->Disc0->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis13.png);}");
ui->Disc1->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis14.png);}");
ui->Disc2->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis15.png);}");
ui->Disc3->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis16.png);}");
ui->Disc4->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis17.png);}");
ui->Disc5->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis18.png);}");
ui->Disc6->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis19.png);}");
ui->Disc7->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis20.png);}");
ui->Disc01->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc02->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc03->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc04->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->labName01->setText("Fay As Me");
ui->labName01->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu01->setText("Bruno Mars");
ui->labDiscAu01->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName02->setText("Already Dead");
ui->labName02->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu02->setText("Juice WRLD");
ui->labDiscAu02->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName03->setText("All Too Well");
ui->labName03->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu03->setText("Switf");
ui->labDiscAu03->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName04->setText("Bite Me");
ui->labName04->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu04->setText("Avril Lavigne");
ui->labDiscAu04->setStyleSheet("QLabel{color:rgb(159,159,159);}");
}
void NewDisc::setKorea()
{
ui->DiscF->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/DiscT.png);}");
ui->Disc0->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis21.png);}");
ui->Disc1->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis22.png);}");
ui->Disc2->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis23.png);}");
ui->Disc3->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis24.png);}");
ui->Disc4->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis25.png);}");
ui->Disc5->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis26.png);}");
ui->Disc6->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis27.png);}");
ui->Disc7->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis06.png);}");
ui->Disc01->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc02->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc03->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc04->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->labName01->setText("거대한 말");
ui->labName01->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu01->setText("B1A4");
ui->labDiscAu01->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName02->setText("SNAPSHOT");
ui->labName02->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu02->setText("jessica");
ui->labDiscAu02->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName03->setText("DAYDREAM");
ui->labName03->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu03->setText("jessica");
ui->labDiscAu03->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName04->setText("같은 곳을 향해가");
ui->labName04->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu04->setText("유지현 김상지");
ui->labDiscAu04->setStyleSheet("QLabel{color:rgb(159,159,159);}");
}
void NewDisc::setJapan()
{
ui->DiscF->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/DiscT.png);}");
ui->Disc0->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis28.png);}");
ui->Disc1->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis29.png);}");
ui->Disc2->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis30.png);}");
ui->Disc3->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis31.png);}");
ui->Disc4->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis32.png);}");
ui->Disc5->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis33.png);}");
ui->Disc6->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis34.png);}");
ui->Disc7->setStyleSheet("QWidget{border-image:url(:/images/NewMusic/Dis35.png);}");
ui->Disc01->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc02->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc03->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->Disc04->setStyleSheet("QWidget{background:rgb(255,255,255);}");
ui->labName01->setText("MAKAFUKA");
ui->labName01->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu01->setText("RADWIMPS");
ui->labDiscAu01->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName02->setText("Chopstick");
ui->labName02->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu02->setText("Niziu");
ui->labDiscAu02->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName03->setText("ラストシーン");
ui->labName03->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu03->setText("菅田将暉");
ui->labDiscAu03->setStyleSheet("QLabel{color:rgb(159,159,159);}");
ui->labName04->setText("starting over");
ui->labName04->setStyleSheet("QLabel{color:rgb(55,55,55);}");
ui->labDiscAu04->setText("三代目");
ui->labDiscAu04->setStyleSheet("QLabel{color:rgb(159,159,159);}");
}
主要加载:
void AllMain::setNewMusicButton()
{
ui->widNewMus->setGeometry(280,10,232,32);
ui->widNewMus->setStyleSheet("QWidget#widNewMus{background:rgb(255,255,255);border:1px solid rgb(187,187,187);border-radius:16px;}");
ui->ptnNew->setParent(ui->widNewMus);
ui->ptnNew->setGeometry(0,1,115,30);
ui->ptnNew->move(1,1);
ui->ptnNew->setCheckable(true);
ui->ptnNew2->setParent(ui->widNewMus);
ui->ptnNew2->setGeometry(ui->ptnNew->width()+2,1,115,30);
ui->ptnNew2->move(ui->ptnNew->width()+1,1);
ui->ptnNew2->setCheckable(true);
ui->ptnNew->setStyleSheet("QPushButton{color:rgb(55,55,55);border:0px;background:rgb(255,255,255);border-radius:14px;}"
"QPushButton:hover{border:0px;background:rgb(244,244,244);border-radius:14px;}"
"QPushButton:checked{color:rgb(255,255,255);border:0px;background:rgb(187,187,187);border-radius:14px;}");
ui->ptnNew2->setStyleSheet("QPushButton{color:rgb(55,55,55);border:0px;background:rgb(255,255,255);border-radius:14px;}"
"QPushButton:hover{border:0px;background:rgb(244,244,244);border-radius:14px;}"
"QPushButton:checked{color:rgb(255,255,255);border:0px;background:rgb(187,187,187);border-radius:14px;}");
QButtonGroup * btnGroup = new QButtonGroup(this);
btnGroup->addButton(ui->ptnNew,0);
btnGroup->addButton(ui->ptnNew2,1);
btnGroup->setExclusive(true);
btnGroup->button(0)->setChecked(true);
//连接槽
connect(btnGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
[=](int id){
//这里处理对应界面
setShowWidget(id);
});
}
void AllMain::setShowWidget(int id)
{
currentFlog = id;
changeChose();
}
void AllMain::setNewMusicChooseButton()
{
QButtonGroup * btnGroup = new QButtonGroup(this);
btnGroup->addButton(ui->ptnMusAll,0);
btnGroup->addButton(ui->ptnMusChinese,1);
btnGroup->addButton(ui->ptnMusEurope,2);
btnGroup->addButton(ui->ptnMusKorea,3);
btnGroup->addButton(ui->ptnMusJapan,4);
btnGroup->setExclusive(true);
btnGroup->button(0)->setChecked(true);
//连接槽
connect(btnGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
[=](int id){
//这里处理对应界面
setLanguageChose(id);
});
}
void AllMain::setAddWidget()
{
pCourier = new NewCourier;
pDisMusic = new NewDisc;
stackedLayout = new QStackedLayout;
stackedLayout->addWidget(pCourier);
stackedLayout->addWidget(pDisMusic);
pCourier->move(0,0);
ui->verAddWidget->addLayout(stackedLayout);
stackedLayout->setCurrentIndex(0);
}
void AllMain::setLanguageChose(int id)
{
currentClass = id;
changeChose();
}
void AllMain::changeChose()
{
if(currentFlog == 0)
{
pCourier->setChose(currentClass);
stackedLayout->setCurrentIndex(0);
}
else if (currentFlog == 1) {
pDisMusic->setChose(currentClass);
stackedLayout->setCurrentIndex(1);
}
}
标签:界面,Qt,rgb,ui,setStyleSheet,QWidget,-----,NewMusic,255
From: https://www.cnblogs.com/dwinternet/p/17660521.html