QT中QLineEdit的editingFinished()信號在按下回車時會觸發兩次的解決辦法


class MyLineEdit :

public QLineEdit {

Q_OBJECT

public: MyLineEdit(QWidget * parent = 0) : QLineEdit(parent) {}

~MyLineEdit(){}

protected: virtual void focusOutEvent(QFocusEvent * e) {

if (e->reason() == Qt::ActiveWindowFocusReason)

{

return; }

else {

QLineEdit::focusOutEvent(e); }

}

};


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com