Qt编写网易云界面 (8) -----歌手模块实现
今天完成一下最后的歌手模块,效果如图:
这个模块应该是要用数据库通过筛选显示对应的界面,这里只是简单加载界面,有能力的自行添加。
UI:
主要代码:
/*歌手模块*/
/*语种*/
QPushButton#ptnAll1,#ptnChinese,#ptnEurope,
#ptnJapan,#ptnKorea,#ptnOther1
{
border:0px;
color:rgb(103,103,103);
border-radius:10px;
}
QPushButton::hover#ptnAll1,::hover#ptnChinese,::hover#ptnEurope,
::hover#ptnJapan,::hover#ptnKorea,::hover#ptnOther1
{
border:0px;
background:rgb(253,245,245);
border-radius:10px;
}
QPushButton::checked#ptnAll1,::checked#ptnChinese,::checked#ptnEurope,
::checked#ptnJapan,::checked#ptnKorea,::checked#ptnOther1
{
border:0px;
background:rgb(253,245,245);
color:rgb(236,65,65);
border-radius:10px;
}
/*分类*/
QPushButton#ptnAll2,#ptnMan,#ptnWomen,
#ptnBank
{
border:0px;
color:rgb(103,103,103);
border-radius:10px;
}
QPushButton::hover#ptnAll2,::hover#ptnMan,::hover#ptnWomen,
::hover#ptnBank
{
border:0px;
background:rgb(253,245,245);
border-radius:10px;
}
QPushButton::checked#ptnAll2,::checked#ptnMan,::checked#ptnWomen,
::checked#ptnBank
{
border:0px;
background:rgb(253,245,245);
color:rgb(236,65,65);
border-radius:10px;
}
/*筛选*/
QPushButton#ptnhot,#ptnA,#ptnB,#ptnC,#ptnD,#ptnE,#ptnF,#ptnG,#ptnH,
#ptnI,#ptnJ,#ptnK,#ptnL,#ptnM,#ptnN,#ptnO,#ptnP,#ptnQ,#ptnR,#ptnS,#ptnT,
#ptnU,#ptnV,#ptnW,#ptnX,#ptnY,#ptnZ,#ptnOH
{
border:0px;
color:rgb(103,103,103);
border-radius:10px;
}
QPushButton::hover#ptnhot,::hover#ptnA,::hover#ptnB,::hover#ptnC,::hover#ptnD,
::hover#ptnE,::hover#ptnF,::hover#ptnG,::hover#ptnH,
::hover#ptnI,::hover#ptnJ,::hover#ptnK,::hover#ptnL,::hover#ptnM,::hover#ptnN,
::hover#ptnO,::hover#ptnP,::hover#ptnQ,::hover#ptnR,::hover#ptnS,::hover#ptnT,
::hover#ptnU,::hover#ptnV,::hover#ptnW,::hover#ptnX,::hover#ptnY,::hover#ptnZ,
::hover#ptnOH
{
border:0px;
background:rgb(253,245,245);
border-radius:10px;
}
QPushButton::checked#ptnhot,::checked#ptnA,::checked#ptnB,::checked#ptnC,::checked#ptnD,
::checked#ptnE,::checked#ptnF,::checked#ptnG,::checked#ptnH,
::checked#ptnI,::checked#ptnJ,::checked#ptnK,::checked#ptnL,::checked#ptnM,::checked#ptnN,
::checked#ptnO,::checked#ptnP,::checked#ptnQ,::checked#ptnR,::checked#ptnS,::checked#ptnT,
::checked#ptnU,::checked#ptnV,::checked#ptnW,::checked#ptnX,::checked#ptnY,::checked#ptnZ,
::checked#ptnOH
{
border:0px;
background:rgb(253,245,245);
color:rgb(236,65,65);
border-radius:10px;
}
/*加载歌手*/
QWidget#widgetSinger0
{
border-image:url(images/singer/singer0.png);
}
QWidget#widgetSinger1
{
border-image:url(images/singer/singer1.png);
}
QWidget#widgetSinger2
{
border-image:url(images/singer/singer2.png);
}
QWidget#widgetSinger3
{
border-image:url(images/singer/singer3.png);
}
QWidget#widgetSinger4
{
border-image:url(images/singer/singer4.png);
}
QWidget#widgetSinger5
{
border-image:url(images/singer/singer5.png);
}
QWidget#widgetSinger6
{
border-image:url(images/singer/singer6.png);
}
QWidget#widgetSinger7
{
border-image:url(images/singer/singer7.png);
}
QWidget#widgetSinger8
{
border-image:url(images/singer/singer8.png);
}
QWidget#widgetSinger9
{
border-image:url(images/singer/singer9.png);
}
/**/
QPushButton#ptnSinger0,#ptnSinger1,#ptnSinger2,
#ptnSinger3,#ptnSinger4
{
border-image:url(images/singer/Mer.png);
}
代码部分:
void AllMain::setSingerLaug()
{
pButtonLaug = new QButtonGroup(this);
pButtonLaug->addButton(ui->ptnAll1,0);
pButtonLaug->addButton(ui->ptnChinese,1);
pButtonLaug->addButton(ui->ptnEurope,2);
pButtonLaug->addButton(ui->ptnJapan,3);
pButtonLaug->addButton(ui->ptnKorea,4);
pButtonLaug->addButton(ui->ptnOther1,5);
pButtonLaug->setExclusive(true);
pButtonLaug->button(0)->setChecked(true);
connect(pButtonLaug, QOverload<int>::of(&QButtonGroup::buttonClicked),
[=](int id){
setSingerSourLaug(id);
});
}
void AllMain::setSingerSourLaug(int id)
{
//这里可以加载对应图片
switch (id) {
default:
break;
}
}
void AllMain::setSingerClass()
{
pButtonClass = new QButtonGroup(this);
pButtonClass->addButton(ui->ptnAll2,0);
pButtonClass->addButton(ui->ptnMan,1);
pButtonClass->addButton(ui->ptnWomen,2);
pButtonClass->addButton(ui->ptnBank,3);
pButtonClass->setExclusive(true);
pButtonClass->button(0)->setChecked(true);
connect(pButtonClass, QOverload<int>::of(&QButtonGroup::buttonClicked),
[=](int id){
setSingerSourClass(id);
});
}
void AllMain::setSingerSourClass(int id)
{
//这里可以加载对应图片
//这里省略一下
switch (id) {
default:
break;
}
}
void AllMain::setSingerScreen()
{
pButtonScreen = new QButtonGroup(this);
pButtonScreen->addButton(ui->ptnhot,0);
pButtonScreen->addButton(ui->ptnA,1);
pButtonScreen->addButton(ui->ptnB,2);
pButtonScreen->addButton(ui->ptnC,3);
pButtonScreen->addButton(ui->ptnD,4);
pButtonScreen->addButton(ui->ptnE,5);
pButtonScreen->addButton(ui->ptnF,6);
pButtonScreen->addButton(ui->ptnG,7);
pButtonScreen->addButton(ui->ptnH,8);
pButtonScreen->addButton(ui->ptnI,9);
pButtonScreen->addButton(ui->ptnJ,10);
pButtonScreen->addButton(ui->ptnK,11);
pButtonScreen->addButton(ui->ptnL,12);
pButtonScreen->addButton(ui->ptnM,13);
pButtonScreen->addButton(ui->ptnN,14);
pButtonScreen->addButton(ui->ptnO,15);
pButtonScreen->addButton(ui->ptnP,16);
pButtonScreen->addButton(ui->ptnQ,17);
pButtonScreen->addButton(ui->ptnR,18);
pButtonScreen->addButton(ui->ptnS,19);
pButtonScreen->addButton(ui->ptnT,20);
pButtonScreen->addButton(ui->ptnU,21);
pButtonScreen->addButton(ui->ptnV,22);
pButtonScreen->addButton(ui->ptnW,23);
pButtonScreen->addButton(ui->ptnX,24);
pButtonScreen->addButton(ui->ptnY,25);
pButtonScreen->addButton(ui->ptnZ,26);
pButtonScreen->addButton(ui->ptnOH,27);
pButtonScreen->setExclusive(true);
pButtonScreen->button(0)->setChecked(true);
connect(pButtonScreen, QOverload<int>::of(&QButtonGroup::buttonClicked),
[=](int id){
setSingerSourScreen(id);
});
}
void AllMain::setSingerSourScreen(int id)
{
//这里可以加载对应图片
switch (id) {
default:
break;
}
}