#pragma once #include #include "Defines.h" #include "iPlugin_global.h" class ZxComboBoxCbxRadioWx; // 方案一: // 自定义Combobox,支持CheckBox、Radio双重选 // 与 ZxComboBoxCbxRadioWx 一起实现该功能 class I_PLUGIN_EXPORT ZxComboBoxCbxRadio :public QComboBox { Q_OBJECT public: explicit ZxComboBoxCbxRadio(QWidget* parent = 0); ~ZxComboBoxCbxRadio(); void setInfos(QStringList& listAllItems, \ QStringList listCbxs = QStringList(), \ QString sRadio = ""); /// @brief 参数传递,确定默认值 /// @param listAllItems 所有数据项 /// @param vecIndexCbxs 复选项索引,默认为空 /// @param indexRadio 单选项索引,默认为-1 /// @note 如果indexRadio为-1,且vecIndexCbxs非空, /// 则指定indexRadio为vecIndexCbxs第一个 void setInfos(QStringList& listAllItems, \ QVector vecIndexCbxs = VecInt(), \ int indexRadio = -1); public: virtual void showPopup(); virtual void hidePopup(); private: void makesureSubWx(); public slots: /// @brief 选择改变 /// @param vecIndexCbxs 复选项索引,非空 /// @param indexRadio 单选项索引,>= 0 /// @note 如果不满足上述条件,则不触发 void slotSelChanged(const VecInt vecIndexCbxs, \ const int indexRadio); protected: //重写失去焦点事件 void focusOutEvent(QFocusEvent *e); signals: // 选择改变 void sigSelChanged(const VecInt, const int); private: ZxComboBoxCbxRadioWx* m_pWxSub; };