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/nmNum/nmSubWxs/nmWxSelectWellsWidget.h

62 lines
1.3 KiB
C++

#pragma once
#include "nmSubWxs_global.h"
#include <QComboBox>
#include <QList>
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<QVariant> 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<QVariant> m_values;
// 已经被选中的items
QStringList m_selectItems;
private slots:
void onUpdateSelections();
};