#include "textreplacerdelegate.h"
TextReplacerDelegate::TextReplacerDelegate(int type, QObject* parent):
QItemDelegate(parent),
wd_type(type)
{
}
void TextReplacerDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
// 蓝:enabled,selected,active灰:enabled,selected
int col = index.column();
int row = index.row();
if(row == 0){qDebug()<<col<<": "<<option.state;}
QColor whi(255,255,255), blk(0,0,0);
// 选中设置
// 选中且活跃态
if ((option.state & (QStyle::State_Selected | QStyle::State_Active)) == (QStyle::State_Selected | QStyle::State_Active))
{
// 选中时设置背景色,更改文字颜色为白色
painter->fillRect(option.rect, option.palette.highlight());
painter->setPen(whi);
}
// 选中但非活跃态
else if((option.state & QStyle::State_Selected) == QStyle::State_Selected)
{
painter->fillRect(option.rect, option.palette.midlight());
}
else
{
painter->setPen(blk);
}
// fund
if(wd_type == 0)
{
// type
if(col == 2)
{
QString text;
if(index.data().toBool())
{
text = "股份基金";
}
else
{
text = "货币基金";
}
painter->drawText(option.rect, Qt::AlignVCenter, text);
}
// risk
else if(col == 3)
{
QString text;
if(index.data().toUInt() == 1)
{
text = "非常低";
}
else if(index.data().toUInt() == 2)
{
text = "低";
}
else if(index.data().toUInt() == 3)
{
text = "中";
}
else if(index.data().toUInt() == 4)
{
text = "高";
}
else
{
text = "非常高";
}
painter->drawText(option.rect, Qt::AlignVCenter, text);
}
// other
else
{
painter->drawText(option.rect, Qt::AlignVCenter, index.data().toString());
}
}
// insurance
else if(wd_type == 1)
{
// crowd
if(col == 2)
{
QString text;
if(index.data().toUInt() == 1)
{
text = "全部人群";
}
else if(index.data().toUInt() == 2)
{
text = "青少年";
}
else if(index.data().toUInt() == 3)
{
text = "成年人";
}
else
{
text = "老年客户";
}
painter->drawText(option.rect, Qt::AlignVCenter, text);
}
// type
else if(col == 3)
{
QString text;
if(index.data().toString() == "WEALTH")
{
text = "财产保险";
}
else
{
text = "健康保险";
}
painter->drawText(option.rect, Qt::AlignVCenter, text);
}
// other
else
{
painter->drawText(option.rect, Qt::AlignVCenter, index.data().toString());
}
}
// assets inspect
else if(wd_type == 10)
{
// status
if(col == 2)
{
QString text;
if(index.data().toBool())
{
text = "正常";
}
else
{
text = "冻结";
}
painter->drawText(option.rect, Qt::AlignVCenter, text);
}
// other
else
{
painter->drawText(option.rect, Qt::AlignVCenter, index.data().toString());
}
}
// other tables
else
{
QItemDelegate::paint(painter, option, index);
}
}
void TextReplacerDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
QItemDelegate::setModelData(editor, model, index);
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于Qt+Sqlite实现的金融产品管理系统源码.zip
共54个文件
jpg:13个
cpp:11个
h:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 88 浏览量
2024-02-19
01:29:56
上传
评论
收藏 1.34MB ZIP 举报
温馨提示
【资源说明】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 3、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip基于Qt+Sqlite实现的金融产品管理系统源码.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于Qt+Sqlite实现的金融产品管理系统源码.zip (54个子文件)
code_20105
bank.db 228KB
assets_inspect.h 738B
manager_view.h 893B
textreplacerdelegate.cpp 5KB
confirmbox.h 431B
manager_mainwindow.h 1KB
login.cpp 5KB
mainwindow.h 1KB
confirmbox.ui 2KB
manager_view.cpp 2KB
user_view.ui 2KB
user_view.cpp 4KB
mainwindow.cpp 2KB
BankManager.pro 1KB
login.ui 3KB
manager_view.ui 3KB
okbox.cpp 501B
main.cpp 162B
sources.qrc 930B
mainwindow.ui 5KB
assets_inspect.ui 2KB
user_view.h 957B
manager_mainwindow.cpp 2KB
db_connection.h 306B
images
back_fuzzy.jpg 36KB
background1.jpg 277KB
button1-3.png 95KB
button1-1.png 81KB
b1-1.jpg 22KB
login.jpg 17KB
b2-2.jpg 21KB
back.jpg 155KB
b1-4.jpg 23KB
background2.jpg 80KB
b2-4.jpg 21KB
button2-4.png 81KB
mi.png 462B
button1-4.png 86KB
button2-1.png 84KB
button2-3.png 88KB
button2-2.png 100KB
b2-3.jpg 22KB
b2-1.jpg 22KB
b1-3.jpg 28KB
button1-2.png 103KB
b1-2.jpg 26KB
db_connection.cpp 594B
manager_mainwindow.ui 5KB
okbox.h 354B
textreplacerdelegate.h 543B
okbox.ui 2KB
confirmbox.cpp 619B
assets_inspect.cpp 2KB
login.h 1KB
共 54 条
- 1
资源评论
土豆片片
- 粉丝: 1556
- 资源: 5641
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- postgresql-42.7.3.jar
- 2024-05-21 20-36-43.mkv
- 基于QT+C++的智能云监护仪项目,能够实时显示使用者心电、血氧、血压波形及其它各种参数+源码(毕业设计&课程设计&项目开发)
- 基于java开发的app接收硬件端传输的心音信号,具有显示心音波形,发出心音的功能+源码(毕业设计&课程设计&项目开发)
- Python 程序语言设计模式思路-行为型模式:职责链模式:将请求从一个处理者传递到下一个处理者
- 9241703124789646.16健身系统2.apk
- postgresql-16.3-1-windows-x64.exe
- Python 程序语言设计模式思路-结构型模式:装饰器讲解及利用Python装饰器模式实现高效日志记录和性能测试
- 基于YOLOv5和DeepSORT的多目标跟踪仿真与记录
- Python 程序语言设计模式思路-创建型模式:原型模式:通过复制现有对象来创建新对象,面向对象编程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功