Przeglądaj źródła

Merge pull request #738 from commontk/fix-message-box-with-qt5

BUG: ctkMessageBox: Fix layout setting checkbox with Qt >= 5.2
Jean-Christophe Fillion-Robin 7 lat temu
rodzic
commit
1f3eba2282
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      Libs/Widgets/ctkMessageBox.cpp

+ 7 - 1
Libs/Widgets/ctkMessageBox.cpp

@@ -194,11 +194,12 @@ void ctkMessageBox::setDontShowAgainVisible(bool visible)
   Q_D(ctkMessageBox);
   if (!visible)
     {
+#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
     this->layout()->removeWidget(d->DontShowAgainCheckBox);
+#endif
     d->DontShowAgainCheckBox->hide();
     return;
     }
-  QGridLayout *grid = static_cast<QGridLayout *>(this->layout());
   d->DontShowAgainCheckBox->setVisible(true);
   // update the text from the button with the accept role
   QAbstractButton *acceptButton = d->button(QMessageBox::AcceptRole);
@@ -209,7 +210,12 @@ void ctkMessageBox::setDontShowAgainVisible(bool visible)
 
     d->DontShowAgainCheckBox->setText(dontShowAgainText);
     }
+#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
+  QGridLayout *grid = static_cast<QGridLayout *>(this->layout());
   grid->addWidget(d->DontShowAgainCheckBox, 1, 1, 1, 1);
+#else
+  this->setCheckBox(d->DontShowAgainCheckBox);
+#endif
 }
 
 //-----------------------------------------------------------------------------