logplus/WellLogUI/include/PaiTableWidget.h

193 lines
4.7 KiB
C
Raw Normal View History

#ifndef PAI_FRAME_ICONSOLE_PAITABLEWIDGET_H
#define PAI_FRAME_ICONSOLE_PAITABLEWIDGET_H
#include <QTableWidget>
#include <QContextMenuEvent>
#include <QAction>
#include <QCheckBox>
namespace pai
{
namespace gui
{
//class PaiCheckBox;
/**
* @class PaiTableWidget
* @brief PaiTableWidget P.A.I系统定制发布的表格控件
*/
class PaiTableWidget : public QTableWidget
{
Q_OBJECT
public:
PaiTableWidget(QWidget* pParent = NULL);
virtual ~PaiTableWidget();
/**
* @brief
* @param[in] ok
* @param[in] maxRowCount
*/
void SetAutoHeight(const bool ok, const int maxRowCount = 10);
/**
* @brief
* @param[in] rowIndex
* @param[in] count ,
*/
void RemoveRows(const int rowIndex, const int count);
/**
* @brief
*/
void RemoveRows();
/**
* @brief
* @param[in] hor 线
* @param[in] ver 线
*/
void setShowGrid(bool hor, bool ver);
/**
* @brief
* @param msg
*/
void ShowPromptMessage(const QString &msg);
/**
* @brief
* @param str
*/
void SetFilterEmptyMessage(const QString &str);
/**
* @brief
* @param[in] selectable
*/
void SetColumnVisibleSelectable(bool selectable);
/**
* @brief
* @param[in] columnList
*/
void SetUnselectableColumns(const QStringList& columnList);
/**
*@brief
*/
void RecallMemberedSections();
/**
* @brief ,CheckBox.()
* @param[in] logicalIndex
* @param[in] checkable
* @param[in] pCheckBox CheckBoxcheckable为false
*/
void SetColumnCheckable(const int logicalIndex, const bool checkable, QCheckBox *pCheckBox = NULL);
public slots:
/**
* @brief
* @param[in] keyword
* @param[in] col
*/
void Filter(const QString & keyword, int col = 0);
/**
* @brief
* @param[in] keyword
* @param[in] cols
*/
void Filter(const QString & keyword, QList<int> cols);
/**
* @brief 使HeaderView的CheckBox
* @param[in] column
*/
void insertColumn(int column);
/**
* @brief 使HeaderView的CheckBox
* @prama[in] column
*/
void removeColumn(int column);
private:
/**
*@brief
*/
void RememberCurrentSections();
protected:
/**
* @brief
* @param[in] rowIndex
* @return
*/
virtual bool Filter(int rowIndex);
/**
* @brief
*/
void paintEvent(QPaintEvent *event);
/**
* @brief
*/
void contextMenuEvent(QContextMenuEvent *event);
/**
* @brief
*/
void keyPressEvent(QKeyEvent *event);
private slots:
/**
* @brief
*/
void ResetTableHeight();
/**
* @brief
*/
void RowCountChanged();
/**
* @brief
*/
void setClipboard();
/**
* @brief
* @param[in] pItem
*/
void TableItemChanged(QTableWidgetItem *pItem);
private:
bool m_AutoHeight;
bool m_ShowFilterEmptyMsg;
int m_AutoHeightMaxRowCount;
QString m_MsgWhileFilterEmpty;
QString m_PromptMsg;
QList<int> m_FilterCols; // 最近一次过滤的的列
protected:
QString m_FilterKeyword; // 最近一次过滤的关键字
signals:
/**
* @brief
* @param count
*/
void RowCountChanged(const int count);
};
}
}
#endif /* PAITABLEWIDGET_H_ */