#pragma once #include #include class ZxSymbolPopup; class QLineEdit; class ZxSymbolListPicker : public QWidget { Q_OBJECT public: explicit ZxSymbolListPicker(QWidget* parent = 0); protected slots: void slotMarkerSelChanged(QString); void slotOpenMarkerDialog(); void slotMarkerNameChanged(); public: virtual void paintEvent(QPaintEvent *); virtual void mousePressEvent(QMouseEvent *); protected: virtual void resizeEvent(QResizeEvent *); virtual void leaveEvent(QEvent *); virtual void enterEvent(QEvent *); void showPopup(); void hidePopup(); void setCategory(const QString& category); void setInputCategory(const QString& category); void setSelectedSymbolCode(const QString& code); QLineEdit* getSymbolNameEdit(); void hideSynbolNameWidget(); void showSynbolNameWidget(const QRect& rcName); void splitSubBounds(QRect& rcSymbol, QRect& rcName, QRect& rcButton); bool isPopupVisible() const; int getNameWidth(); QString getCodeByName(const QString& name); protected: ZxSymbolPopup* m_pPopup; bool m_bHover; bool m_bShowPopup;//是否显示下拉窗口。用来保证第一次点击时,显示下拉窗口,再次点击则隐藏,再次点击则又显示,... QString m_sCategoryConfigged; ///<配置文件中配置的类别 QString m_sCategoryInput; ///<从图形对象传过来的符号的类别 QString m_sCode; ///< 符号的代码 QLineEdit* m_pTbxSynbolName; QPushButton m_button; int m_nBtnWidth; };