Browse Source

fix(chatform): add hack to avoid Qt bug on chat show

Fix #5570
reviewable/pr5730/r1
Anthony Bilinski 6 years ago
parent
commit
e8d48e8788
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 12
      src/widget/form/genericchatform.cpp

12
src/widget/form/genericchatform.cpp

@ -52,6 +52,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringBuilder> #include <QStringBuilder>
#include <QtGlobal>
#ifdef SPELL_CHECKING #ifdef SPELL_CHECKING
#include <KF5/SonnetUi/sonnet/spellcheckdecorator.h> #include <KF5/SonnetUi/sonnet/spellcheckdecorator.h>
@ -450,10 +451,19 @@ void GenericChatForm::setName(const QString& newName)
void GenericChatForm::show(ContentLayout* contentLayout) void GenericChatForm::show(ContentLayout* contentLayout)
{ {
contentLayout->mainContent->layout()->addWidget(this);
contentLayout->mainHead->layout()->addWidget(headWidget); contentLayout->mainHead->layout()->addWidget(headWidget);
headWidget->show(); headWidget->show();
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 4) && QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
// HACK: switching order happens to avoid a Qt bug causing segfault, present between these versions.
// this could cause flickering if our form is shown before added to the layout
// https://github.com/qTox/qTox/issues/5570
QWidget::show();
contentLayout->mainContent->layout()->addWidget(this);
#else
contentLayout->mainContent->layout()->addWidget(this);
QWidget::show(); QWidget::show();
#endif
} }
void GenericChatForm::showEvent(QShowEvent*) void GenericChatForm::showEvent(QShowEvent*)

Loading…
Cancel
Save