mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Fix rare and strange crash in modern UI
This commit is contained in:
parent
5144baa05c
commit
246fa6c1fa
17
wordlist.cc
17
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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue