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.
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <iPlugin_global.h>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QPainter>
|
|
|
|
|
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QStandardItem>
|
|
|
|
|
|
|
|
|
|
// 此处是为了响应在QTableWidget中的表头进行下拉选择(支持多选)而做的三个类。
|
|
|
|
|
// 其中QHeaderViewEx是表头,点中其某一列时,创建QHeaderComboBoxEx,而QHeaderComboBoxEx
|
|
|
|
|
// 内部又设置了view为QListViewEx
|
|
|
|
|
|
|
|
|
|
// 表头HeaderView
|
|
|
|
|
class I_PLUGIN_EXPORT QHeaderViewEx : public QHeaderView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
QHeaderViewEx(const QStringList& lstStrText, QWidget *parent = 0);
|
|
|
|
|
~QHeaderViewEx();
|
|
|
|
|
|
|
|
|
|
// 设置表头下拉列表取值
|
|
|
|
|
void setColumnItems(const QStringList& lstFields, const QStringList& lstAlls);
|
|
|
|
|
|
|
|
|
|
// 设置Titles
|
|
|
|
|
void changeTitles(QStringList listTitles);
|
|
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
|
|
|
|
|
|
// 选择改变时响应
|
|
|
|
|
void slotSelChanged(const int, const QStringList);
|
|
|
|
|
|
|
|
|
|
// 处理表头单元缩放事件
|
|
|
|
|
void handleSectionResized(int index);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void sigGetColumnItems(int index);
|
|
|
|
|
void sigSelChanged(const int, const QStringList);
|
|
|
|
|
|
|
|
|
|
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; //标题
|
|
|
|
|
QStringList m_lstComboxText; ///< 下拉列表中显示表头列表,当前选中的
|
|
|
|
|
QStringList m_lstComboxTextAll;///< 下拉列表中显示表头列表,所有的
|
|
|
|
|
QComboBox* m_pCbxSel; ///< 表头下拉列表控件
|
|
|
|
|
int m_nCurIndex; ///< 被选中的表头单元ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|