本文整理汇总了C++中QMessageBox::close方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageBox::close方法的具体用法?C++ QMessageBox::close怎么用?C++ QMessageBox::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMessageBox
的用法示例。
在下文中一共展示了QMessageBox::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tryUnlock
void MainWindow::tryUnlock(QString _user, QString _password)
{
//std::cout<<"\nIn Unlock method\n";
QString encryptedPass;
QString encryptedUser;
encryptedUser = QString(QCryptographicHash::hash((_user.toStdString().c_str()), QCryptographicHash::Md5).toHex());
encryptedPass = QString(QCryptographicHash::hash((_password.toStdString().c_str()),QCryptographicHash::Md5).toHex());
if (encryptedUser == m_username && encryptedPass == m_password)
{
m_loggedIn = true;
QMessageBox messageBox;
messageBox.setWindowTitle(tr("Login Successful!"));
messageBox.setText("Successful login!");
messageBox.setStandardButtons(QMessageBox::Ok);
if (messageBox.exec() == QMessageBox::Ok)
messageBox.close();
}//end if
else
{
m_loggedIn = false;
QMessageBox messageBox;
messageBox.setWindowIcon(QIcon("questionface.xpm"));
messageBox.setWindowTitle(tr("Login Failed"));
messageBox.setText(tr("ERROR: Invalid Login! You cannot modify cash without a valid login!"));
messageBox.setStandardButtons(QMessageBox::Ok);
if (messageBox.exec() == QMessageBox::Ok)
messageBox.close();
}//invalid login window
}//end void
示例2: sonucKapat
void proje::sonucKapat()
{
if(formEkleSonuc.ekleSonucDegisiklikVar==true)
{
if(formEkleSonuc.ekleSonucDegisiklikVar==true)
{
QMessageBox msgBox;
msgBox.setText("Değişiklikler kaydedilsin mi?");
msgBox.setIcon(QMessageBox::Warning);
QPushButton *tamam = msgBox.addButton("Tamam", QMessageBox::ActionRole);
QPushButton *iptal = msgBox.addButton("İptal", QMessageBox::ActionRole);
msgBox.exec();
if (msgBox.clickedButton() == tamam)
{
tamamSonuc();
}
else if (msgBox.clickedButton() == iptal)
{
formEkleSonuc.ekleSonucDegisiklikVar=false;
formEkleSonuc.degisenIDOgrenci.clear();
msgBox.close();
}
}
}
formEkleSonuc.close();
}
示例3: QMainWindow
TelaPrincipal::TelaPrincipal(Usuario *usuAtu, QSqlDatabase conn, QWidget *parent) : QMainWindow(parent), ui(new Ui::TelaPrincipal) {
ui->setupUi(this);
this->setWindowTitle("Fila de Produção");
db = conn;
opDAO = new OrdemDeProducaoDAO(db);
apontamento = new Apontamento();
this->usuAtu = new Usuario(usuAtu);
apontamento->setUsuario(this->usuAtu);
if (usuAtu->getGrupo() != "TI")
ui->menubar->setVisible(false);
SerialDAO dialogSserialDAO = SerialDAO(db);
if (dialogSserialDAO.getPortaSerial().size() == 0) {
std::cout << "Não achou a porta Serial para este Computador." << std::endl;
QMessageBox erroDeSerial;
erroDeSerial.setWindowTitle("Erro ao tentar conectar na máquina");
erroDeSerial.setText("Não foi possível connectar na máquina pois não foi encontrado a porta serial, por gentileza contate o TI.");
erroDeSerial.setDefaultButton(QMessageBox::Ok);
if (erroDeSerial.exec() == QMessageBox::Ok) {
erroDeSerial.close();
}
} else {
portaDeComunicacao = new Serial(dialogSserialDAO.getPortaSerial());
portaDeComunicacao->bloqueiaMaquina();
leDadosImpressora = new QTimer();
connect(ui->actionSelecionar_Porta_Serial,SIGNAL(triggered()),this,SLOT(selecionaPortaSerial()));
connect(this->leDadosImpressora, SIGNAL(timeout()), this, SLOT(leDados()));
procuraParadasSemMotivos();
}
}
示例4: settingsDefault
void Settings::settingsDefault(){
QMessageBox msgBox;
msgBox.setWindowTitle(trUtf8("Zurücksetzen bestätigen"));
msgBox.setText(trUtf8("Möchten Sie die Werte wirklich auf die "
"Standardeinstellungen zurücksetzen?"));
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes:
if (tabWidget_Settings->currentIndex() == 0)
settingsDefaultClamUI();
else if (tabWidget_Settings->currentIndex() == 1)
settingsDefaultClamAV();
break;
case QMessageBox::No:
msgBox.close();
break;
default:
break;
}
}
示例5: error
void viewcart::error(){
QMessageBox msgBox;
msgBox.setWindowTitle("Warning");
msgBox.setText("Please select a product");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int userAnswer = msgBox.exec();
if(userAnswer == QMessageBox::Ok) {
msgBox.close();
}
}
示例6: NetworkError
void Execut_window::NetworkError()//网络连接错误
{
closePage();
QMessageBox qMbox;
qMbox.setText(QString("对不起,无法上传请稍后"));
qMbox.show();
waitTaskInfo(1000);//延时1s
qMbox.close();
}
示例7: error
void ar::error(){
QMessageBox msgBox;
msgBox.setWindowTitle("Warning");
msgBox.setText("Invalid Date\nValid Year: from 1900 ~ 2015\nValid Month: from 01 ~ 12\nValid Date: from 01 ~ 31");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
int userAnswer = msgBox.exec();
if(userAnswer == QMessageBox::Ok) {
msgBox.close();
}
}
示例8: showMessageBox
void SimulateTrafficDialog::showMessageBox(std::string message)
{
QMessageBox msgBox;
msgBox.setWindowTitle("Info");
msgBox.setText(QString::fromUtf8(message.c_str()));
msgBox.setStandardButtons(QMessageBox::Ok);
if(msgBox.exec() == QMessageBox::Ok)
{
msgBox.close();
}
}
示例9: displayErrorMsg
void Preferences::displayErrorMsg(QString errormsg)
{
QMessageBox *msgbox;
QFont msgboxfont;
msgbox = new QMessageBox( QMessageBox::Critical, tr("Error"), errormsg, QMessageBox::Ok, this);
msgboxfont = msgbox->font();
msgboxfont.setPixelSize(12); // 9pts
msgbox->setFont( msgboxfont );
msgbox->show();
msgbox->exec();
msgbox->close();
delete msgbox;
}
示例10: slotQuit
void ClamUI::slotQuit(){
checkBoxNoMessage = new QCheckBox;
checkBoxNoMessage->setText(trUtf8("Die Meldung nicht mehr anzeigen."));
ClamdProcess clamd;
FreshClamProcess freshclam;
QMessageBox msgBox;
QSettings clamui_conf(QSettings::NativeFormat, QSettings::UserScope,
APP_TITLE, APP_NAME);
if (noMessageOnQuit){
if (stopClamdOnQuit)
clamd.stopDaemon();
if (stopFreshclamOnQuit)
freshclam.stopFreshclam();
qApp->quit();
}
msgBox.setWindowTitle(trUtf8("Beenden bestätigen"));
msgBox.setText(trUtf8("Möchten Sie <b>") +
APP_TITLE + trUtf8("</b> wirklich beenden?"));
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setCheckBox(checkBoxNoMessage);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes:
if (stopClamdOnQuit)
clamd.stopDaemon();
if (stopFreshclamOnQuit)
freshclam.stopFreshclam();
clamui_conf.beginGroup("ClamUI");
clamui_conf.setValue("NoMessage", checkBoxNoMessage->isChecked());
clamui_conf.endGroup();
qApp->quit();
break;
case QMessageBox::No:
msgBox.close();
break;
default:
break;
}
}
示例11: showMessageBox
int GwtCallback::showMessageBox(int type,
QString caption,
QString message,
QString buttons,
int defaultButton,
int cancelButton)
{
// cancel other message box if it's visible
QMessageBox* pMsgBox = qobject_cast<QMessageBox*>(
QApplication::activeModalWidget());
if (pMsgBox != NULL)
pMsgBox->close();
QMessageBox msgBox(safeMessageBoxIcon(static_cast<QMessageBox::Icon>(type)),
caption,
message,
QMessageBox::NoButton,
pOwner_->asWidget(),
Qt::Dialog | Qt::Sheet);
msgBox.setWindowModality(Qt::WindowModal);
msgBox.setTextFormat(Qt::PlainText);
QStringList buttonList = buttons.split(QChar::fromLatin1('|'));
for (int i = 0; i != buttonList.size(); i++)
{
QPushButton* pBtn = msgBox.addButton(buttonList.at(i),
captionToRole(buttonList.at(i)));
if (defaultButton == i)
msgBox.setDefaultButton(pBtn);
}
msgBox.exec();
QAbstractButton* button = msgBox.clickedButton();
if (!button)
return cancelButton;
for (int i = 0; i < buttonList.size(); i++)
if (buttonList.at(i) == button->text())
return i;
return cancelButton;
}
示例12: on_createButton_clicked
void Gomoku::on_createButton_clicked() {
CreateDialog dialog;
if (dialog.exec() == QDialog::Accepted) {
server = new QTcpServer(this);
server->listen(QHostAddress(dialog.getHostIpAddress()), 8888);
ui->connectButton->setEnabled(false);
ui->createButton->setEnabled(false);
QMessageBox *waiting = new QMessageBox(QMessageBox::NoIcon,
tr("waiting"),
dialog.getHostIpAddress() + tr("\nwaiting for new connection..."),
QMessageBox::Cancel,
this);
bool connecting = false;
connect(server, &QTcpServer::newConnection, [&]() {
connecting = true;
socket = server->nextPendingConnection();
// ui->undoButton->setEnabled(true);
ui->saveButton->setEnabled(true);
ui->loadButton->setEnabled(true);
ui->quitButton->setEnabled(true);
ui->createButton->setEnabled(false);
ui->connectButton->setEnabled(false);
ui->gameboard->playerColor = Qt::black;
ui->gameboard->enemyColor = Qt::white;
ui->gameboard->inRound = true;
connect(socket, &QTcpSocket::readyRead, this, &Gomoku::readData);
connect(ui->gameboard, &GameBoard::addChess, this, &Gomoku::sendChessInfo);
connect(ui->gameboard, &GameBoard::win, this, &Gomoku::sendWin);
connect(ui->quitButton, &QPushButton::clicked, this, &Gomoku::requestQuit);
connect(ui->undoButton, &QPushButton::clicked, this, &Gomoku::requestUndo);
connect(ui->saveButton, &QPushButton::clicked, this, &Gomoku::sendSave);
connect(ui->loadButton, &QPushButton::clicked, this, &Gomoku::requestLoad);
waiting->close();
});
if (waiting->exec() == QMessageBox::Cancel && !connecting) {
server->close();
ui->connectButton->setEnabled(true);
ui->createButton->setEnabled(true);
}
}
}
示例13: on_accept_package_clicked
void PackageDialog::on_accept_package_clicked(QAbstractButton* button) {
// OK clicked to accept values
if (ui->accept_package->button(QDialogButtonBox::Ok) == (QPushButton*)button) {
bool ok;
QString package = ui->nameLine->text();
float length = ui->lengthLine->text().toFloat(&ok);
float height = ui->heightLine->text().toFloat();
float width = ui->widthLine->text().toFloat();
int pins = ui->pinsLine->text().toInt();
// Check if all inputs are valid
if(package.length() > 3 && length > 0 && height > 0 && width > 0 && pins > 0){
// Edit given package
if(editPackage) {
(*databaseVector)[packageNum].package = package;
(*databaseVector)[packageNum].length = length;
(*databaseVector)[packageNum].height = height;
(*databaseVector)[packageNum].width = width;
(*databaseVector)[packageNum].pins = pins;
// Add a new package
} else {
databaseEntry newEntry;
newEntry.package = package;
newEntry.length = length;
newEntry.height = height;
newEntry.width = width;
newEntry.pins = pins;
databaseVector->append(newEntry);
}
} else {
QMessageBox msgBox;
msgBox.setText("Invalid input!");
msgBox.exec();
msgBox.close();
}
} else {
this->close();
}
}
示例14: on_defaultButton_clicked
void MysqLoader::on_defaultButton_clicked()
{
QMessageBox msgBox;
msgBox.setWindowTitle(trUtf8("Vorgang bestätigen"));
msgBox.setText(trUtf8("<b>Alle Werte werden auf die "
"Standardeinstellungen zurück gesetzt!</b>"));
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes:
defaultSettings();
break;
case QMessageBox::No:
msgBox.close();
break;
default:
break;
}
}
示例15: sonucDoldur
void proje::sonucDoldur()
{
if(formEkleSonuc.ekleSonucDegisiklikVar==true)
{
QMessageBox msgBox;
msgBox.setText("Değişiklikler kaydedilsin mi?");
msgBox.setIcon(QMessageBox::Warning);
QPushButton *tamam = msgBox.addButton("Tamam", QMessageBox::ActionRole);
QPushButton *iptal = msgBox.addButton("İptal", QMessageBox::ActionRole);
msgBox.exec();
if (msgBox.clickedButton() == tamam)
{
tamamSonuc();
}
else if (msgBox.clickedButton() == iptal)
{
formEkleSonuc.degisenIDOgrenci.clear();
formEkleSonuc.ekleSonucDegisiklikVar=false;
msgBox.close();
}
}
if(formEkleSonuc.ui->cbSinav->currentIndex()!=-1)//cbSinavda olmayan bir seçenek olursa fonksiyona girmesin
{
QString sinavisim=formEkleSonuc.ui->cbSinav->currentText();
QString dersisim=ui->tableDersler->currentItem()->text();
formEkleSonuc.ilkAcilis=true;
formEkleSonuc.ui->tableSonuclar->setRowCount(0);
formEkleSonuc.ui->tableSonuclar->setColumnCount(0);
int sira=0;
int toplamPuan=0;
QSqlQuery query,query2;
query.exec(QString("select sorusayisi,sinav.sinavid from sinav,derssinav where sinav.sinavid=derssinav.sinavid and dersid=(select dersid from ders where dersisim='%1') and sinavisim='%2'").arg(dersisim).arg(sinavisim));
query.next();
formEkleSonuc.sinavID=query.value(1).toString();
const int currentRow = formEkleSonuc.ui->tableSonuclar->rowCount();
formEkleSonuc.ui->tableSonuclar->setRowCount(currentRow + 1);
for(int i=0;i<=query.value(0).toInt();i++)//sonuc ekranındaki sutun başlıkları
{
const int currentColumn = formEkleSonuc.ui->tableSonuclar->columnCount();
formEkleSonuc.ui->tableSonuclar->setColumnCount(currentColumn + 1);
query2.exec(QString("select puan from soru where sorunumarasi='%1' and sinavid=(select sinav.sinavid from sinav,derssinav where sinav.sinavid=derssinav.sinavid and dersid=(select dersid from ders where dersisim='%2') and sinavisim='%3')").arg(i).arg(dersisim).arg(sinavisim));
query2.next();
QTableWidgetItem *itm=new QTableWidgetItem(QString::number(i)+" ("+query2.value(0).toString()+")");
formEkleSonuc.ui->tableSonuclar->setItem(0,i,itm);
itm->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
kalinFont(itm);
toplamPuan=toplamPuan+query2.value(0).toInt();
}
const int currentColumn = formEkleSonuc.ui->tableSonuclar->columnCount();
formEkleSonuc.ui->tableSonuclar->setColumnCount(currentColumn + 1);
QTableWidgetItem *itmt=new QTableWidgetItem("Toplam ("+QString::number(toplamPuan)+")");
formEkleSonuc.ui->tableSonuclar->setItem(0,currentColumn,itmt);
itmt->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
kalinFont(itmt);
query.exec(QString("select ogrenci.ogrenciid from dersogrenci,ogrenci where dersogrenci.ogrenciid=ogrenci.ogrenciid and dersid=(select dersid from ders where dersisim='%1')").arg(dersisim));
while(query.next())
{
sira=sira+1;
const int currentRow = formEkleSonuc.ui->tableSonuclar->rowCount();
formEkleSonuc.ui->tableSonuclar->setRowCount(currentRow + 1);
QTableWidgetItem *itm=new QTableWidgetItem(query.value(0).toString());
formEkleSonuc.ui->tableSonuclar->setItem(sira,0,itm);
itm->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
kalinFont(itm);
}
for(int j=1;j<formEkleSonuc.ui->tableSonuclar->rowCount();j++)
{
for(int i=1;i<formEkleSonuc.ui->tableSonuclar->columnCount();i++)
{
if(i!=formEkleSonuc.ui->tableSonuclar->columnCount()-1)//toplam sutununda birşey yazmasın
{
query.exec(QString("select alinanpuan from sonuc where ogrenciid='%1' and sorunumarasi='%2' and sinavid=(select sinav.sinavid from sinav,derssinav where sinav.sinavid=derssinav.sinavid and dersid=(select dersid from ders where dersisim='%3') and sinavisim='%4')").arg(formEkleSonuc.ui->tableSonuclar->item(j,0)->text()).arg(i).arg(dersisim).arg(sinavisim));
query.next();
QTableWidgetItem *itm=new QTableWidgetItem(query.value(0).toString());
formEkleSonuc.ui->tableSonuclar->setItem(j,i,itm);
}
else//toplamı yazdırıyor
{
query.exec(QString("select toplampuan from sinavogrenci where ogrenciid='%1' and sinavid=(select sinav.sinavid from sinav,derssinav where sinav.sinavid=derssinav.sinavid and dersid=(select dersid from ders where dersisim='%2') and sinavisim='%3')").arg(formEkleSonuc.ui->tableSonuclar->item(j,0)->text()).arg(dersisim).arg(sinavisim));
query.next();
QTableWidgetItem *itm=new QTableWidgetItem(query.value(0).toString());
formEkleSonuc.ui->tableSonuclar->setItem(j,formEkleSonuc.ui->tableSonuclar->columnCount()-1,itm);
itm->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
kalinFont(itm);
}
}
//.........这里部分代码省略.........