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/ZxHeaderViewEx.h

74 lines
2.1 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 <iPlugin_global.h>
#include <QStringList>
#include <QComboBox>
#include <QHeaderView>
#include <QDebug>
#include <QPainter>
#include <QListWidget>
#include <QCheckBox>
#include <QStandardItem>
// 此处是为了响应在QTableWidget中的表头进行下拉选择支持多选而做的三个类。
// 其中ZxHeaderViewEx是表头点中其某一列时
// 创建ZxHeaderComboBoxEx而ZxHeaderComboBoxEx
// 内部又设置了view为ZxListViewEx
// 所以ZxHeaderViewEx、ZxHeaderComboBoxEx、ZxListViewEx为一组
// 该组实现了表头的Radio选择单选
// 而原来的QHeaderViewEx、QHeaderComboBoxEx、QListViewEx为一组
// 这一组实现了表头的Check选择多选
// 表头HeaderView
class I_PLUGIN_EXPORT ZxHeaderViewEx : public QHeaderView
{
Q_OBJECT
public:
ZxHeaderViewEx(const QStringList& lstStrText, QWidget *parent = 0);
~ZxHeaderViewEx();
// 设置表头下拉列表取值
void setColumnItems(const QString& sCurSel, const QStringList& lstAlls);
// 设置Titles
void changeTitles(QStringList listTitles);
public Q_SLOTS:
// 选择改变时响应
void slotSelChanged(const int, const QString);
// 处理表头单元缩放事件
void handleSectionResized(int index);
signals:
void sigGetColumnItems(int index);
void sigSelChanged(const int, const QString);
protected:
// 重置表头combo控件大小
void resizeItem(int index);
// 删除comboBox控件
void removeCombo();
// 处理鼠标单击消息
void mouseReleaseEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
// 重绘,此处有待完善,目前是没有版本,直接把父类搬过来了。
void paintSection(QPainter* painter, const QRect &rect, int logicalIndex) const;
private:
QStringList m_lstHeaderTexts; //标题
QString m_sCurSel; //下拉列表中显示表头列表,当前选中的
QStringList m_lstComboxTextAll; //下拉列表中显示表头列表,所有的
QComboBox* m_pCbxSel; //表头下拉列表控件
int m_nCurIndex; //被选中的表头单元ID
};