#pragma once #include #include class ZxSymbolPopup; class QLineEdit; class ZxSymbolListPicker : public QWidget { Q_OBJECT public: explicit ZxSymbolListPicker(QWidget* parent = 0); protected slots: void slotSymbolSelectionChanged(QString); void slotOpenSymbolSelectionDialog(); void slotSymbolNameChanged(); 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 getConponentRect( 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_categoryConfigged; ///<配置文件中配置的类别 QString m_categoryInput; ///<从图形对象传过来的符号的类别 QString m_symbolCode; ///< 符号的代码 QLineEdit* m_lineEditSynbolName; int m_symbolNameWidth; QPushButton m_button; int m_buttonWidth; };