资源简介
每一个Item是由一张图片,用ListView实现了自由添加删除项图片,鼠标移到图片上面时,删除图标显示,为图片画边框,当鼠标移到删除图标上面时,删除图片变为高亮显示,点击删除图片,item删除。
代码片段和文件信息
#include “listmodel.h“
#include
listmodel::listmodel(Qobject*parent):QAbstractListModel(parent)
{
for(int index = 1;index<5;index++)
{
QString picname = QString(“F:\\myproj\\QML\\TestListModel_Update\\images\\beauty-%1“).arg(index);
m_list.push_back(picname);
}
}
void listmodel::addpiece(QString picname)
{
beginInsertRows(QModelIndex()m_list.count()m_list.count());
m_list.push_back(picname);
endInsertRows();
}
int listmodel::rowCount(const QModelIndex & parent) const
{
return m_list.size();
}
QVariant listmodel::data(const QModelIndex & index int role) const
{
if(role == Qt::DecorationRole)
{
return m_list.at(index.row());
}
return QVariant();
}
void listmodel::deletepiece(int index)
{
beginRemoveRows(QModelIndex()indexindex);
QList::iterator iter;
iter = m_list.begin();
m_list.erase(iter);
endRemoveRows();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1047 2016-10-28 16:48 TestListModel_Update\close.png
文件 1060 2016-10-28 16:49 TestListModel_Update\close_a.png
文件 1036 2016-10-28 16:48 TestListModel_Update\delete.png
文件 2827 2016-10-28 16:49 TestListModel_Update\images\beauty-1.png
文件 2484 2016-10-28 16:48 TestListModel_Update\images\beauty-2.png
文件 2701 2016-10-28 16:49 TestListModel_Update\images\beauty-3.png
文件 2635 2016-10-28 16:48 TestListModel_Update\images\beauty-4.png
文件 1013 2016-11-16 18:15 TestListModel_Update\listmodel.cpp
文件 516 2016-11-16 16:21 TestListModel_Update\listmodel.h
文件 988 2016-10-28 16:49 TestListModel_Update\login_sys_close.png
文件 183 2016-11-16 15:06 TestListModel_Update\main.cpp
文件 1737 2016-11-16 18:05 TestListModel_Update\mainwindow.cpp
文件 602 2016-11-16 17:44 TestListModel_Update\mainwindow.h
文件 654 2016-11-16 15:06 TestListModel_Update\mainwindow.ui
文件 3533 2015-06-30 04:53 TestListModel_Update\monkey_off_64x64.png
文件 2810 2016-11-16 18:20 TestListModel_Update\mydelegate.cpp
文件 632 2016-11-16 18:08 TestListModel_Update\mydelegate.h
文件 3749 2015-06-30 04:53 TestListModel_Update\services.png
文件 475 2016-11-16 15:41 TestListModel_Update\TestListModel_Update.pro
文件 18739 2016-11-21 16:36 TestListModel_Update\TestListModel_Update.pro.user
目录 0 2016-11-16 18:13 TestListModel_Update\images
目录 0 2016-11-21 16:36 TestListModel_Update
----------- --------- ---------- ----- ----
49421 22
相关资源
- vtk QT做的三维地质可视化系统2of2
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- QT,JPEG解码源代码(已完成)
- ModelSim全套中文手册ModelSim SE6.0C
- Qt 播放音频文件
- Qt 读取16进制的data文件
- Cellular automata Model: an Adaptive Approach
- MQTT+串口(usart)透传
- 易语言QQTEA算法源码
- VC工程转Qt工程文件的工具
- MQTT推送Demo
- 基于Linux、QT的视频监控系统的设计与
- Qt 百度地图 定位
- QT酷炫界面开发指南《QmlBook》
- On a nonlocal model in thermal electricity I:
- Modelsim学习资料很全
- Investigation of the Absorption Mechanism of G
- Ubuntu下操作Excel,qt代码
- BPMN2.0 Modeler for Visio
- Qt图片浏览器 --基于Qt的Graphics View f
- qtnribbon2破解
-
Changes of the ex
pression of β-catenin - Comparison between one-dimensional time-depend
- The Existence and Stability of Nontrivial St
评论
共有 条评论