diff --git a/wordlist.cc b/wordlist.cc index 25a44224..43e2e5c4 100644 --- a/wordlist.cc +++ b/wordlist.cc @@ -137,3 +137,20 @@ void WordList::refreshTranslateLine() } } + +void WordList::resizeEvent( QResizeEvent * ev ) +{ + // In some rare cases Qt start send QResizeEvent recursively + // up to full stack depletion (tested on Qt 4.8.5, 4.8.6). + // We use this trick to break such suicidal process. + + for( int x = 0; x < resizedSizes.size(); x++ ) + if( resizedSizes.at( x ) == ev->size() ) + return; + + resizedSizes.push_back( ev->size() ); + + QListWidget::resizeEvent( ev ); + + resizedSizes.pop_back(); +} diff --git a/wordlist.hh b/wordlist.hh index c603105a..71b0131f 100644 --- a/wordlist.hh +++ b/wordlist.hh @@ -19,6 +19,9 @@ public: virtual void setTranslateLine(QLineEdit * line) { translateLine = line; } +protected: + virtual void resizeEvent( QResizeEvent * ev ); + signals: void statusBarMessage(QString const & message, int timeout = 0, QPixmap const & pixmap = QPixmap()); void contentChanged(); @@ -36,6 +39,8 @@ private: WordFinder * wordFinder; QLineEdit * translateLine; WordListItemDelegate listItemDelegate; + + QVector< QSize > resizedSizes; }; #endif // WORDLIST_HH