Fix QMessageBox layout addWidget.

This commit is contained in:
Phenom 2016-08-06 13:49:39 +02:00
parent f3d1a6c1ec
commit 21bd8cd6df
2 changed files with 20 additions and 3 deletions

View File

@ -1076,11 +1076,21 @@ void ChatLobbyWidget::readChatLobbyInvites()
tr("%1 invites you to chat lobby named %2").arg(QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())).arg(RsHtml::plainText(it->lobby_name)),
QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
QLabel *label = new QLabel(tr("Choose an identity for this lobby:"));
GxsIdChooser *idchooser = new GxsIdChooser ;
idchooser->loadIds(IDCHOOSER_ID_REQUIRED,default_id) ;
mb.layout()->addWidget(new QLabel(tr("Choose an identity for this lobby:"))) ;
mb.layout()->addWidget(idchooser) ;
QGridLayout* layout = qobject_cast<QGridLayout*>(mb.layout());
if (layout) {
layout->addWidget(label, layout->rowCount(), 0, 1, layout->columnCount(), Qt::AlignHCenter ) ;
layout->addWidget(idchooser, layout->rowCount(), 0, 1, layout->columnCount(), Qt::AlignRight ) ;
} else {
//Not QGridLayout so add at end
mb.layout()->addWidget(label) ;
mb.layout()->addWidget(idchooser) ;
}
int res = mb.exec() ;

View File

@ -1410,7 +1410,14 @@ void MainWindow::externalLinkActivated(const QUrl &url)
QMessageBox mb(QObject::tr("Confirmation"), QObject::tr("Do you want this link to be handled by your system?")+"<br/><br/>"+ url.toString()+"<br/><br/>"+tr("Make sure this link has not been forged to drag you to a malicious website."), QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
QCheckBox *checkbox = new QCheckBox(tr("Don't ask me again")) ;
mb.layout()->addWidget(checkbox) ;
QGridLayout* layout = qobject_cast<QGridLayout*>(mb.layout());
if (layout)
{
layout->addWidget(checkbox,layout->rowCount(),0,1, layout->columnCount(), Qt::AlignLeft);
} else {
//Not QGridLayout so add at end
mb.layout()->addWidget(checkbox) ;
}
int res = mb.exec() ;