加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SearchView.h 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
chaocc.wang 提交于 2019-12-24 14:51 . 版本更新
//
// Created by cc on 2019-06-20.
//
#ifndef QTALK_V2_SEARCHVIEW_H
#define QTALK_V2_SEARCHVIEW_H
#include <QListView>
#include <QStyledItemDelegate>
#include <QSortFilterProxyModel>
enum
{
EM_SEARCH_DATATYPE_TEXT = Qt::UserRole + 1,
EM_SEARCH_DATATYPE_ICONPATH,
EM_SEARCH_DATATYPE_XMPPID,
EM_SEARCH_DATATYPE_USERID,
EM_SEARCH_DATATYPE_INDEX,
EM_SEARCH_DATATYPE_CHECKSTATE,
EM_SEARCH_DATATYPE_STAFF,
};
class SearchItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit SearchItemDelegate(QWidget *parent);
~SearchItemDelegate() override;
Q_SIGNALS:
void itemChanged(const QModelIndex&);
void sgItemDbClicked(const QModelIndex&);
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
};
class SearchItemSortModel : public QSortFilterProxyModel
{
public:
explicit SearchItemSortModel(QObject* parent = nullptr);
protected:
//
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
};
#endif //QTALK_V2_SEARCHVIEW_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化