fix crash when creating the Open Torrent dialog in Qt 5.2 on Ubuntu 14.04

This commit is contained in:
Jordan Lee 2014-03-16 22:50:39 +00:00
parent a78090f921
commit 8b0a7746bb
2 changed files with 15 additions and 5 deletions

View File

@ -1177,8 +1177,13 @@ TrMainWindow :: openTorrent ()
QCheckBox * b = new QCheckBox (tr ("Show &options dialog"));
b->setChecked (myPrefs.getBool (Prefs::OPTIONS_PROMPT));
b->setObjectName (SHOW_OPTIONS_CHECKBOX_NAME);
QGridLayout * l = dynamic_cast<QGridLayout*> (d->layout ());
l->addWidget (b, l->rowCount (), 0, 1, -1, Qt::AlignLeft);
auto l = dynamic_cast<QGridLayout*> (d->layout ());
if (l == nullptr)
{
l = new QGridLayout;
d->setLayout (l);
}
l->addWidget (b, l->rowCount(), 0, 1, -1, Qt::AlignLeft);
connect (d, SIGNAL (filesSelected (const QStringList&)),
this, SLOT (addTorrents (const QStringList&)));
@ -1319,8 +1324,13 @@ TrMainWindow :: removeTorrents (const bool deleteFiles)
msgBox.setStandardButtons (QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton (QMessageBox::Cancel);
msgBox.setIcon (QMessageBox::Question);
/* hack needed to keep the dialog from being too narrow */
QGridLayout* layout = (QGridLayout*)msgBox.layout ();
// hack needed to keep the dialog from being too narrow
auto layout = dynamic_cast<QGridLayout*>(msgBox.layout());
if (layout == nullptr)
{
layout = new QGridLayout;
msgBox.setLayout (layout);
}
QSpacerItem* spacer = new QSpacerItem (450, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
layout->addItem (spacer, layout->rowCount (), 0, 1, layout->columnCount ());

View File

@ -11,7 +11,7 @@ unix: INSTALLS += man
man.path = /share/man/man1/
man.files = transmission-qt.1
CONFIG += qt thread debug link_pkgconfig
CONFIG += qt thread debug link_pkgconfig c++11
QT += network dbus
PKGCONFIG = fontconfig libcurl openssl libevent