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

先看下完成品

左侧是我的,右侧是原生

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

看下头文件

#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. Hadoop HBase概念学习系列之HBase里的列式数据库(十七)

    列式数据库,从数据存储方式上有别于行式数据库,所有数据按列存取. 行式数据库在做一些列分析时,必须将所有列的信息全部读取出来 而列式数据库由于其是按列存取,因此只需在特定列做I/O即可完成查询与分析, ...

  2. 一、TCL事务控制语言 二、MySQL中的约束 三、多表查询(重点) 四、用户的创建和授权 五、MySQL中的索引

    一.TCL事务控制语言###<1>事务的概念 事务是访问并可能更新数据库中各种数据项的执行单元. 事务是一条SQL语句,一组SQL语句,或者整个程序. 事务是恢复和并发控制的基本单位. 事 ...

  3. September 11th 2017 Week 37th Monday

    I believe there is a hero in all of us. 我相信每个人心中都住着一个英雄. For every of us, there are two version with ...

  4. 02-urllib库的get请求方式

    对于urllib中的get请求方式,可以直接传入url的连接即可访问页面,但是对于要传入关键字的话,也可以用quote进行编码再传入. 案例如下: #get请求搜索参数如何添加 import urll ...

  5. GNSS基础(持续更新)

    1.整周模糊度成功率 可参考文献:GNSS整周模糊度概率特性 2.正太分布 见百度百科 https://baike.baidu.com/item/%E6%AD%A3%E6%80%81%E5%88%86 ...

  6. 【原创】MySQL 生产环境备份还原

    公司需要对生产环境的数据库进行备份,我接下了这份任务. 1. 首先谷歌了以下大家的备份方法 许多都使用到了Xtrabackup这个工具,超大型的公司可能有其他的的备份方法,这个工具对于中小型公司,甚至 ...

  7. 4719: [Noip2016]天天爱跑步

    Time Limit: 40 Sec Memory Limit: 512 MB Submit: 1986 Solved: 752 [Submit][Status][Discuss] Descripti ...

  8. 微信小程序 置顶/取消置顶

    wxml <view wx:for="{{confirmlist}}" wx:for-item="confirm" wx:for-index=" ...

  9. programming-languages学习笔记--第9部分

    programming-languages学习笔记–第9部分 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} pre.src ...

  10. ethers.js-3-Providers

    Providers A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and send ...