You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iPlugin/ZxTableHeaderView.h

88 lines
2.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <QHeaderView>
#include "iPlugin_global.h"
// 此处是为了响应在ZxTableView中的表头进行下拉选择支持多选/单选两种模式)而做的三个类。
// 其中ZxTableHeaderView是表头点中其某一列时创建ZxTableHeaderViewCbx而ZxTableHeaderViewCbx
// 内部又设置了view为ZxTableHeaderViewCbxView
// 所以ZxTableHeaderView、ZxTableHeaderViewCbx、ZxTableHeaderViewCbxView为一组
// 该组实现了表头的Radio选择单选+ Check选择多选
class ZxTableHeaderViewCbx;
// 表头HeaderView
class I_PLUGIN_EXPORT ZxTableHeaderView : public QHeaderView
{
Q_OBJECT
public:
ZxTableHeaderView(const QStringList& listItems, \
bool bMultiSelMode,
QWidget* parent = 0);
~ZxTableHeaderView();
// 设置表头下拉列表取值(两个接口,分别对应多选和单选)
void setColumnItems(const QStringList& listFields, \
const QStringList& listAlls);
void setColumnItems(const QString& sCurSel, \
const QStringList& listAlls);
// 设置Titles
void changeTitles(QStringList listTitles);
protected:
// 处理鼠标单击消息
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
// 重置表头combo控件大小
void resizeItem(int index);
// 删除comboBox控件
void removeCombo();
// 重绘,此处有待完善,目前是没有版本,直接把父类搬过来了。
void paintSection(QPainter* painter, const QRect &rect, int logicalIndex) const;
public Q_SLOTS:
// 选择改变时响应
void slotSelChanged(const int, const QStringList);
// 选择改变时响应
void slotSelChanged(const int, const QString);
// 处理表头单元缩放事件
void handleSectionResized(int index);
signals:
void sigGetColumnItems(int index);
void sigSelChanged(const int, const QStringList);
void sigSelChanged(const int, const QString);
private:
QStringList m_listTitles; //标题
bool m_bMultiSelMode; //是否多选模式
ZxTableHeaderViewCbx* m_pCbxSel; //下拉控件
// 当前表头索引
int m_nCurIndex;
// 当前选择的项
QStringList m_listCbxCheckedItems; //多选模式
QString m_sRadioCheckedItem; //单选模式
// 所有项
QStringList m_listAllItems;
};