#pragma once #include "nmSubWxs_global.h" #include #include class QCheckBox; class QVariant; class QListWidget; class QTextEdit; class nmWxSelectWellItemWidget: public QWidget { Q_OBJECT public: nmWxSelectWellItemWidget(); nmWxSelectWellItemWidget(QWidget* parent, QString name, QVariant value); void setSelected(bool selected); bool getSelected(); void toggleSelected(); private: void initUI(); protected: void mousePressEvent(QMouseEvent *event) override; signals: void sigItemClicked(); private slots: void onStateChanged(int); private: QCheckBox* m_pCBox; QString m_sName; QVariant m_iValue; }; class NM_SUB_WXS_EXPORT nmWxSelectWellsWidget : public QWidget { Q_OBJECT public: nmWxSelectWellsWidget(QWidget* aParent = NULL); public: // 添加多项 void addItems(QStringList items, QList values); // 添加单项 void addItem(QString name, QVariant value); // 获取选中的items QStringList getItems(); // 设置被选中的items void setSelectedItems(QStringList selectItems); private: QListWidget* m_pListWidget; QTextEdit* m_pLineEdit; QStringList m_items; QList m_values; // 已经被选中的items QStringList m_selectItems; private slots: void onUpdateSelections(); };