这个界面除了麻烦耗时,没有啥技术含量。暂时我也就把它称为迷你个人中心,因为后面还有一个个人中心了。

先看下完成品

左侧是我的,右侧是原生

个人感觉还可以吧,哈哈哈。给我自己奖励一个鸡腿。

看下头文件

#ifndef PERSONFORM_H
#define PERSONFORM_H #include <QWidget>
#include <QPaintEvent>
#include <QPainter>
namespace Ui {
class PersonForm;
} class PersonForm : public QWidget
{
Q_OBJECT public:
explicit PersonForm(QWidget *parent = 0);
~PersonForm();
protected:
void paintEvent(QPaintEvent *event);
private slots:
void on_pushButton_person_head_image_clicked(); void on_pushButton_clicked(); void on_pushButton_sign_clicked(); void on_pushButton_fans_clicked(); void on_pushButton_attention_clicked(); void on_pushButton_dynamic_clicked(); void on_pushButton_mymember_clicked(); void on_pushButton_dengji_clicked(); void on_pushButton_shop_clicked(); void on_pushButton_person_infor_clicked(); void on_pushButton_bend_clicked(); void on_pushButton_off_clicked(); private:
Ui::PersonForm *ui;
}; #endif // PERSONFORM_H

  下面是源文件代码

#include "personform.h"
#include "ui_personform.h"
#include <QDebug>
PersonForm::PersonForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::PersonForm)
{
ui->setupUi(this);
} PersonForm::~PersonForm()
{
delete ui;
} void PersonForm::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QPainter painter_mainback(this);
painter_mainback.drawPixmap(0,0,this->width(),this->height(),QPixmap("./images/Personform/mainback.png"));
ui->pushButton_person_head_image->setMask(QRegion(0,0,40,40,QRegion::Ellipse)); //设置头像遮罩
}
/*
* 头像点击按钮
*/
void PersonForm::on_pushButton_person_head_image_clicked()
{
qDebug()<<"头像按钮点击";
}
/*
* 个人名字点击效果
*/
void PersonForm::on_pushButton_clicked()
{
qDebug()<<"用户名字点击";
}
/*
* 签到按钮槽函数
*/
void PersonForm::on_pushButton_sign_clicked()
{
qDebug()<<"签到按钮点击";
}
/*
* 粉丝按钮按下
*/
void PersonForm::on_pushButton_fans_clicked()
{
qDebug()<<"粉丝按钮点击";
}
/*
* 关注按钮按下
*/
void PersonForm::on_pushButton_attention_clicked()
{
qDebug()<<"关注按钮点击";
}
/*
* 动态按钮按下
*/
void PersonForm::on_pushButton_dynamic_clicked()
{
qDebug()<<"动态按钮点击";
}
/*
* 我的会员点击按钮
*/
void PersonForm::on_pushButton_mymember_clicked()
{
qDebug()<<"我的会员按钮点击";
}
/*
* 等级按钮
*/
void PersonForm::on_pushButton_dengji_clicked()
{
qDebug()<<"等级按钮点击";
}
/*
* 商城按钮
*/
void PersonForm::on_pushButton_shop_clicked()
{
qDebug()<<"商城按钮点击";
}
/*
* 个人信息按钮设置
*/
void PersonForm::on_pushButton_person_infor_clicked()
{
qDebug()<<"个人信息设置按钮点击";
}
/*
* 绑定社交账号按钮
*/
void PersonForm::on_pushButton_bend_clicked()
{
qDebug()<<"绑定社交账号按钮点击";
}
/*
* 退出登录按钮
*/
void PersonForm::on_pushButton_off_clicked()
{
qDebug()<<"退出登录按钮点击";
}

  

整个迷你个人中心布局

那么怎么调出这个界面了,看下主窗口调用函数

/*
* 个人信息按钮
*/
void MainWindow::on_pushButton_people_clicked()
{
if(personform)
{
if(personform->isHidden())
{
personform->show();
}
else
{
personform->hide();
}
}
else
{
personform = new PersonForm(this);
personform->setGeometry(588,40,267,367);
personform->raise(); //提升显示层数
personform->show();
} }

  

这里的大部分美化都是在Qss文件中完成的,下面看下Qss中文件的实现代码

/*迷你个人中心头像按钮*/
QPushButton#pushButton_person_head_image
{
border-image:url(images/pretty_girl.png);
}
QPushButton::hover#pushButton_person_head_image
{
border-image:url(images/pretty_girl.png);
}
QPushButton::pressed#pushButton_person_head_image
{
border-image:url(images/pretty_girl.png);
}
/*会员表示*/
QLabel#label_user_member_icon
{
border-image:url(images/Personform/user_nember.png);
}
/*迷你个人中心文本*/
QLabel#label_user_name
{
color: rgb(175, 175, 175);
}
/*个人中心按钮*/
QPushButton#pushButton
{
background:#00FFFFFF;
}
QPushButton::hover#pushButton
{
background:#00FFFFFF;
}
QPushButton::pressed#pushButton
{
background:#00FFFFFF;
}
/*迷你个人中签到按钮*/
QPushButton#pushButton_sign
{
border-image:url(images/Personform/btn_tiandao_n.png);
}
QPushButton::hover#pushButton_sign
{
border-image:url(images/Personform/btn_tiandao_h.png);
}
QPushButton::pressed#pushButton_sign
{
border-image:url(images/Personform/btn_tiandao_n.png);
} /*迷你个人中动态按钮*/
QPushButton#pushButton_dynamic
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
QPushButton::hover#pushButton_dynamic
{
background:#00FFFFFF;
color: rgb(255,255,255);
}
QPushButton::pressed#pushButton_dynamic
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
/*迷你个人中心关注按钮*/
QPushButton#pushButton_attention
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
QPushButton::hover#pushButton_attention
{
background:#00FFFFFF;
color: rgb(255,255,255);
}
QPushButton::pressed#pushButton_attention
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
/*迷你个人中心粉丝按钮*/
QPushButton#pushButton_fans
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
QPushButton::hover#pushButton_fans
{
background:#00FFFFFF;
color: rgb(255,255,255);
}
QPushButton::pressed#pushButton_fans
{
background:#00FFFFFF;
color: rgb(130,131,133);
}
/*迷你个人中心分割线*/
QLabel#labelline_1
{
background: rgb(55, 57, 61);
}
QLabel#labelline_2
{
background: rgb(55, 57, 61);
}
QLabel#labelline_3
{
background: rgb(55, 57, 61);
}
/*迷你个人中心关注文本*/
QLabel#label_attention
{
color: rgb(255, 255, 255);
}
/*迷你个人中心动态文本*/
QLabel#label_dynamic
{
color: rgb(255, 255, 255);
}
/*迷你个人中心粉丝文本*/
QLabel#label_fans
{
color: rgb(255, 255, 255);
}
/*迷你个人中心我的会员按钮*/
QPushButton#pushButton_mymember
{
background:#00393b3e;
}
QPushButton::hover#pushButton_mymember
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_mymember
{
background:#00FFFFFF;
}
/*迷你个人中心我的会员头像*/
QLabel#label_my_menber
{
border-image:url(images/Personform/user_nember_h.png);
}
/*迷你个人中心我的会员文本*/
QLabel#label_my_member
{
color: rgb(175, 175, 175);
}
/*迷你个人中心我的会员时间文本*/
QLabel#label_my_member_time
{
color: rgb(95, 95, 99);
}
/*迷你个人中心我>文本*/
QLabel#label_L_1
{
color: rgb(95, 95, 99);
}
QLabel#label_L_2
{
color: rgb(95, 95, 99);
}
/*迷你个人中心等级按钮*/
QPushButton#pushButton_dengji
{
background:#00393b3e;
}
QPushButton::hover#pushButton_dengji
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_dengji
{
background:#00FFFFFF;
}
/*迷你个人中心商城按钮*/
QPushButton#pushButton_shop
{
background:#00393b3e;
}
QPushButton::hover#pushButton_shop
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_shop
{
background:#00FFFFFF;
}
/*迷你个人中心个人信息按钮*/
QPushButton#pushButton_person_infor
{
background:#00393b3e;
}
QPushButton::hover#pushButton_person_infor
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_person_infor
{
background:#00FFFFFF;
}
/*迷你个人中心绑定按钮*/
QPushButton#pushButton_bend
{
background:#00393b3e;
}
QPushButton::hover#pushButton_bend
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_bend
{
background:#00FFFFFF;
}
/*迷你个人中心关闭按钮*/
QPushButton#pushButton_off
{
background:#00393b3e;
}
QPushButton::hover#pushButton_off
{
background:#55393b3e;
border-width:0;
border-color:rgb(255,132,0,0);
border-style: solid;
border-radius: 0px;
}
QPushButton::pressed#pushButton_off
{
background:#00FFFFFF;
}
/*迷你个人中心等级头像*/
QLabel#label_my_dengji
{
border-image:url(images/Personform/dengji.png);
}
/*迷你个人中心等级文本*/
QLabel#label_my_dengji_1
{
color: rgb(175, 175, 175);
}
/*迷你个人中心我的会员时间文本*/
QLabel#label_my_dengji_2
{
color: rgb(95, 95, 99);
}
/*商城*/
QLabel#label_my_shop
{
border-image:url(images/Personform/shop.png);
}
QLabel#label_my_shop2
{
color: rgb(175, 175, 175);
}
QLabel#label_L_3
{
color: rgb(95, 95, 99);
}
/*个人信息设置*/
QLabel#label_my_setup
{
border-image:url(images/Personform/setup.png);
}
QLabel#label_my_setup2
{
color: rgb(175, 175, 175);
}
QLabel#label_L_4
{
color: rgb(95, 95, 99);
}
/*绑定社交账号*/
QLabel#label_my_bend
{
border-image:url(images/Personform/bend.png);
}
QLabel#label_my_bend2
{
color: rgb(175, 175, 175);
}
QLabel#label_L_5
{
color: rgb(95, 95, 99);
}
QLabel#label_my_bend_3
{
border-image:url(images/Personform/xinlang.png);
}
QLabel#label_my_bend_4
{
border-image:url(images/Personform/qita.png);
}
/*退出登录*/
QLabel#label_my_off
{
border-image:url(images/Personform/off.png);
}
QLabel#label_my_off2
{
color: rgb(175, 175, 175);
}

  

Qt-网易云音乐界面实现-6 迷你个人中心实现的更多相关文章

  1. Android 开发之网易云音乐(或QQ音乐)的播放界面转盘和自定义SeekBar的实现

    这个东西我在eoeAndroid上首发的,但没有详细的实现说明:http://www.eoeandroid.com/thread-317901-1-1.html 在csdn上进行详细的说明吧.(同时上 ...

  2. Flutter仿网易云音乐:播放界面

    写在前头 本来是要做一个仿网易云音乐的flutter项目,但是因为最近事情比较多,项目周期跨度会比较长,因此分几个步骤来完成.这是仿网易云音乐项目系列文章的第一篇.没有完全照搬网易云音乐的UI,借鉴了 ...

  3. Qt-网易云音乐界面实现-1 窗口隐藏拖拽移动,自定义标题栏

    最近也换了公司,也换了新的工作,工资也象征性的涨了一点点,但是最近心里还是慌慌,不知道为什么,没有那种踏实感,感觉自己随时可以被抛弃的感觉.感觉自己在荒废时间,也感觉自己在浪费生命. 为了让自己在被抛 ...

  4. Qt-网易云音乐界面实现-2 红红的程序运行图标,和相似下方音乐条

    被调出来出差了,这次出差可以说是非常不开心,这次出差也算给我自己提了个醒吧,那就是注意自己的精力,自己的口碑,和比人对自己的信任.具体内容如下 我们公司有一款硬件的设备的电路是外包给某个人来做的,这个 ...

  5. Github获8300星!用Python开发的一个命令行的网易云音乐

    最近在逛Github发现了一个非常有趣的库musicbox,是用纯Python打造的,收获了8300颗星.Python语言简单易学,好玩有趣,身边越来越多的小伙伴都开始学习Python.她的魅力非常大 ...

  6. UWP 动画系列之模仿网易云音乐动画

    一.前言 最近在弄毕业设计(那时坑爹选了制作个UWP商店的APP),一个人弄得烦躁,在这里记录一些在做毕业设计时的学习过程.由于我的毕业设计是做一个音乐播放器,那么Windows商店上优秀的软件当然是 ...

  7. 使用网易云音乐,丢掉QQ音乐吧

    我是一个听音乐的重度用户,基本上每天大约有三分之一的时间里我在使用网易云音乐去听音乐.包括工作写代码的时候,跑步的时候,去上班的途中我都去听.首先需要声明的是,在这里我不是故意的去抹黑其他的音乐产品, ...

  8. 网易云音乐 歌词制作软件 BesLyric

    导读 哈哈,喜欢网易云音乐,又愁于制作歌词的童鞋有福啦! BesLyric 为你排忧解难! 上个周末在用网易云音乐听歌,发现一些喜欢的歌还没有滚动歌词,然而网易云音乐还没有自带的歌词编辑功能,要制作歌 ...

  9. 《云阅》一个仿网易云音乐UI,使用Gank.Io及豆瓣Api开发的开源项目

    CloudReader 一款基于网易云音乐UI,使用GankIo及豆瓣api开发的符合Google Material Desgin阅读类的开源项目.项目采取的是Retrofit + RxJava + ...

随机推荐

  1. 如何从Microsoft web platform installer取得离线安装包

    有一架visual studio 2012的开发环境A由于某种原因无法链接internet, 于是乎安装officetoolsforvisual2012就有问题了. 从微软的官网上只可以下载 offi ...

  2. November 17th 2016 Week 47th Thursday

    Don't cry because it is over. Smile because it happened. 不要因为结束而哭泣:微笑吧,因为我们曾经拥有. My ex-girlfriend ha ...

  3. PHP设计模式系列 - 单例

    单例模式 通过提供自身共享实例的访问,单例设计模式用于限制特定对象只能被创建一次. 使用场景 例如数据库实例,一般都会走单例模式. 单例模式可以减少类的实例化 代码:来源InitPHP框架,先检测类有 ...

  4. nginx alias

    A path to the file is constructed by merely adding a URI to the value of the root directive. If a UR ...

  5. python第十四课--排序及自定义函数之自定义函数(案例三)

    return关键字的使用:1).结束函数 2).将结果返回给函数的调用者/调用处 [注意事项]1).与return同一作用范围内的后面不要显示书写任何代码,因为永远不可能被执行到,不会报错. 2).r ...

  6. isa class superclass metaclass

    http://www.cnblogs.com/feng9exe/p/7232915.html Note: 其实这里的难点就在于对 和 的区分. .class 当 target 是 Instance 则 ...

  7. __autoreleasing 与 局部变量

    __autoreleasing 修饰的变量不是局部变量: 它的生命周期由autoreleasepool负责: +(Reachability*)reachabilityWithHostname:(NSS ...

  8. [HAOI2015]按位或

    题目 好神的题啊 我们发现我们求这个东西如果常规\(dp\)的话可以建出一张拓扑图来,但是边的级别高达\(3^n\),转移的时候还要解方程显然不能通过本题 我们考虑神仙的\(min-max\)容斥 设 ...

  9. 2018 - 2019 CTU Open Contest H. Split Game 【SG函数】

    H. Split Game time limit per test 1.0 s memory limit per test 256 MB input standard input output sta ...

  10. vlc源码分析(七) 调试学习HLS协议

    HTTP Live Streaming(HLS)是苹果公司提出来的流媒体传输协议.与RTP协议不同的是,HLS可以穿透某些允许HTTP协议通过的防火墙. 一.HLS播放模式 (1) 点播模式(Vide ...