当前位置: 首页>>代码示例>>C++>>正文


C++ QMessageBox::critical方法代码示例

本文整理汇总了C++中QMessageBox::critical方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageBox::critical方法的具体用法?C++ QMessageBox::critical怎么用?C++ QMessageBox::critical使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMessageBox的用法示例。


在下文中一共展示了QMessageBox::critical方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_pushButtonPlay_clicked

void MainWindow::on_pushButtonPlay_clicked()
{
    QMessageBox messageBox;
    if(ui->spinBoxHora->value() || ui->spinBoxMin->value()){

        if(!ui->lineEditNome->text().isEmpty()){
            ui->stackedWidget->setCurrentIndex(1);
            ui->timeEdit->setTime(QTime(ui->spinBoxHora->value(), ui->spinBoxMin->value()));
            ui->progressBar->setValue(0);

            QString pasta = "mkdir videos/" + ui->lineEditNome->text();
            system(pasta.toUtf8());


            if(connectPort("ttyUSB0"))
                QObject::connect(&serialPort, SIGNAL(readyRead()), this, SLOT(read()));
            else{
                messageBox.critical(0,"Erro","Conexão falhou");
                messageBox.setFixedSize(500,200);
            }

            if( !video() ){
                messageBox.critical(0,"Erro","Falha na captura de vídeo");
                messageBox.setFixedSize(500,200);
            }
        }else{
            messageBox.critical(0,"Erro","Nome inválido");
            messageBox.setFixedSize(500,200);
        }
    }else{
        messageBox.critical(0,"Erro","Tempo inválido");
        messageBox.setFixedSize(500,200);
    }
}
开发者ID:rafaelavila,项目名称:recordme,代码行数:34,代码来源:mainwindow.cpp

示例2: on_init_button_clicked

void YarrGui::on_init_button_clicked(){
    int index = ui->device_comboBox->currentIndex();
    if(specVec.size() == 0 || index > specVec.size()){
        QMessageBox errorBox;
        errorBox.critical(0, "Error", "Device not found!");
        return;
    }else{
        specVec[index]->init(index);
        if (specVec[index]->isInitialized()) {
            ui->specid_value->setNum(specVec[index]->getId());
            ui->bar0_value->setNum(specVec[index]->getBarSize(0));
            ui->bar4_value->setNum(specVec[index]->getBarSize(4));
            ui->main_tabWidget->setTabEnabled(1, true);
            ui->main_tabWidget->setTabEnabled(2, true);
            tx = specVec[index];
            rx = specVec[index];
            bk = new Bookkeeper(tx, rx);
        }else{
            QMessageBox errorBox;
            errorBox.critical(0, "Error", "Initialization not successful!");
            return;
        }
    }
    ui->actionBenchmark->setEnabled(true);
    ui->actionCreate_scan->setEnabled(true);
    ui->actionEEPROM->setEnabled(true);

    return;
}
开发者ID:Yarr,项目名称:Yarr,代码行数:29,代码来源:yarrgui.cpp

示例3: on_deleteCustomer_clicked

void Customers::on_deleteCustomer_clicked()
{
    QMessageBox::StandardButton reply;
    QMessageBox msgBox;
    reply = QMessageBox::question(this, "Delete Customer", "Are you want to delete customer?",QMessageBox::Yes|QMessageBox::No);
    if (reply == QMessageBox::Yes) {
        qDebug() << "Yes was clicked";
        DbMysql* d = DbMysql::getInstance();
        QString customer_id = ui->customersDetailsTable->selectedItems().at(0)->text();
        if (!d->getConnection().open()) {
            msgBox.critical(this,"Error","Failed to connect database.");
        }
        else {
            QSqlQuery query("delete from customers where customer_id="+customer_id+";",d->getConnection());

            if( !query.exec() )
            {
                msgBox.critical(this,"Error","Failed to execute query.");
                qDebug()<<query.lastError().text();
                return;
            }
            else{
                msgBox.information(this,"Information","Customer Deleted.");
                this->getAllCustomerData();
            }
        }
    }
}
开发者ID:dsubhajit,项目名称:bill_master,代码行数:28,代码来源:customers.cpp

示例4: checkIfRoomNotVacant

bool CreateLog::checkIfRoomNotVacant(QString room_ids)
{
    DbMysql* d = DbMysql::getInstance();
    QMessageBox msgBox;
    if(!d->getConnection().open())
    {
        msgBox.critical(this,"Error","Failed to connect database.1");
        return false;
    }
    else
    {
        QSqlQuery query1( "select * from rooms where room_id in ("+room_ids+") and room_state=1;" ,d->getConnection());
        if(!query1.isActive())
        {
            msgBox.critical(this,"Error","Failed to connect database.");
        }
        else
        {
            if(query1.size() > 0)
            {
                return false;
            }
            else return true;
        }
    }
}
开发者ID:dsubhajit,项目名称:bill_master,代码行数:26,代码来源:createlog.cpp

示例5: addNewTag

void ImageTags::addNewTag()
{	
	bool ok;
	QString title = tr("Add a new tag");
	QString newTagName = QInputDialog::getText(this, title, tr("Enter new tag name"),
												QLineEdit::Normal, "", &ok);
	if (!ok) {
		return;
	}

	if(newTagName.isEmpty()) {
		QMessageBox msgBox;
		msgBox.critical(this, tr("Error"), tr("No name entered"));
		return;
	}

	QSetIterator<QString> knownTagsIt(GData::knownTags);
	while (knownTagsIt.hasNext()) {
	    QString tag = knownTagsIt.next();
	    if (newTagName == tag) {
			QMessageBox msgBox;
			msgBox.critical(this, tr("Error"), tr("Tag ") + newTagName + tr(" already exists"));
			return;
        }
    }

	addTag(newTagName, false);
	GData::knownTags.insert(newTagName);
	redrawTree();
}
开发者ID:JHooverman,项目名称:phototonic,代码行数:30,代码来源:tags.cpp

示例6: addStatusFields

void CreateBooking::addStatusFields ()
{
    DbMysql* d = DbMysql::getInstance();
    QMessageBox msgBox;

    if(!d->getConnection().open())
    {
        msgBox.critical(this,"Error","Failed to connect database.1");
    }
    else
    {

        QSqlQuery query1( "select * from customer_status;" ,d->getConnection());
        if(!query1.isActive())
        {
            msgBox.critical(this,"Error","Failed to connect database.");
        }
        else
        {
            //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1));
            while(query1.next())
            {
                ui->customer_status->addItem(query1.value(1).toString(),QVariant::fromValue(query1.value(0).toInt()));
            }

        }
        QSqlQuery query2( "select * from payment_status;" ,d->getConnection());
        if(!query2.isActive())
        {
            msgBox.critical(this,"Error","Failed to connect database.");
        }
        else
        {
            //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1));
            while(query2.next())
            {
                ui->payment_status->addItem(query2.value(1).toString(),QVariant::fromValue(query2.value(0).toInt()));
            }

        }
        QSqlQuery query3( "select * from booking_status;" ,d->getConnection());
        if(!query3.isActive())
        {
            msgBox.critical(this,"Error","Failed to connect database.");
        }
        else
        {
            //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1));
            while(query3.next())
            {
                ui->booking_status->addItem(query3.value(1).toString(),QVariant::fromValue(query3.value(0).toInt()));
            }

        }

    }


}
开发者ID:dsubhajit,项目名称:bill_master,代码行数:59,代码来源:createbooking.cpp

示例7: on_export_save_button_clicked

void MemoryCardManagerDialog::on_export_save_button_clicked()
{

    int currentRow = ui->savelistWidget->currentRow();
    int nItemCount = static_cast<int>(m_pCurrentMemoryCard->GetSaveCount() - 1);
    if (currentRow >= 0  && currentRow <= nItemCount)
    {
        const CSave *save = m_pCurrentMemoryCard->GetSaveByIndex(currentRow);
        if(save != NULL)
        {
            QFileDialog dialog(this);
            dialog.setAcceptMode(QFileDialog::AcceptSave);
            dialog.setNameFilter(tr("EMS Memory Adapter Save Dumps (*.psu)"));
            dialog.setDefaultSuffix("psu");
            if (dialog.exec())
            {
                QString fileName = dialog.selectedFiles().first();

                try
                {
                    auto output(Framework::CreateOutputStdStream(fileName.toStdString()));
                    CSaveExporter::ExportPSU(output, save->GetPath());
                }
                catch(const std::exception& Exception)
                {
                    QString msg("Couldn't export save(s):\n\n%1");
                    QMessageBox messageBox;
                    messageBox.critical(this,"Error",msg.arg(Exception.what()));
                    messageBox.show();
                    return;
                }

                QString msg("Save exported successfully.");
                QMessageBox messageBox;
                messageBox.information(this,"Success",msg);
                messageBox.show();
                return;
            } else {
                QString msg("Save export Cancelled.");
                QMessageBox messageBox;
                messageBox.warning(this,"Cancelled",msg);
                messageBox.show();
                return;
            }
        } else {
            QString msg("Save not found,\nPlease try again.");
            QMessageBox messageBox;
            messageBox.critical(this,"Error",msg);
            messageBox.show();
        }
    } else {
        QString msg("Invalid selection,\nPlease try again.");
        QMessageBox messageBox;
        messageBox.critical(this,"Error",msg);
        messageBox.show();
    }
}
开发者ID:Phatcat,项目名称:Play-,代码行数:57,代码来源:memorycardmanagerdialog.cpp

示例8: saveImage

void ImageView::saveImage()
{
	Exiv2::Image::AutoPtr image;
	bool exifError = false;

	if (newImage)
	{
		saveImageAs();
		return;
	}

	setFeedback(tr("Saving..."));

	try
	{
		image = Exiv2::ImageFactory::open(currentImageFullPath.toStdString());
		image->readMetadata();
	}
	catch (Exiv2::Error &error)
	{
		exifError = true;
	}

	QImageReader imgReader(currentImageFullPath);
	if (!displayPixmap.save(currentImageFullPath, imgReader.format().toUpper(),
																			GData::defaultSaveQuality))
	{
		QMessageBox msgBox;
		msgBox.critical(this, tr("Error"), tr("Failed to save image."));
		return;
	}

	if (!exifError)
	{
		try
		{
			image->writeMetadata();
		}
		catch (Exiv2::Error &error)
		{
			QMessageBox msgBox;
			msgBox.critical(this, tr("Error"), tr("Failed to save Exif metadata."));
		}
	}

	reload();
	setFeedback(tr("Image saved."));
}
开发者ID:vfrenkel,项目名称:phototonic,代码行数:48,代码来源:imageview.cpp

示例9: while

void SimulatorWindow::on_commandLinkButton_2_clicked() //Run button
{

     //   this->Disassembler();
QMessageBox error;
    if(canRun)
    {
        while (ingy->getClk() <= ingy->getClkWAtFinal())
        {
        ui->PCcount->setText(QString::number(ingy->getPC()));
            this->oldPC = ingy->textIM[ingy->getPC()];
            ingy->test();
            cout << "RUNNING!!!!";
          this->setGraphContent();
            ingy->incrementClk();


        }

        this->setRegistersContent();
        this->setDataContent();

    }
    else
    {
        QString s = "PLEASE CHANGE THE CODE. ";
        QString s1= " ";
        error.critical(0,s1,s, "EDIT CODE");
        error.show();
    }

}
开发者ID:IngyN,项目名称:MipsPipelinedSimulator,代码行数:32,代码来源:simulatorwindow.cpp

示例10: on_commandLinkButton_clicked

void SimulatorWindow::on_commandLinkButton_clicked() // Next button
{
    QMessageBox error;
    // run 1 step
   if(canRun)
   {
       if(ingy->getClk() <= ingy->getClkWAtFinal())
      {

          ui->PCcount->setText(QString::number(ingy->getPC()));
          this->oldPC = ingy->textIM[ingy->getPC()];
          //finished=S->run1();
          ingy->test();
          this->setGraphContent();
           ingy->incrementClk();
          this->setRegistersContent();
          this->setDataContent();


      }

   }
   else
   {
       QString s = "PLEASE CHANGE THE CODE. ";
       QString s1= " ";
       error.critical(0,s1,s, "EDIT CODE");
       error.show();
   }

}
开发者ID:IngyN,项目名称:MipsPipelinedSimulator,代码行数:31,代码来源:simulatorwindow.cpp

示例11: shutDown

void MainWindow::shutDown()
{
    if(!isConnected)
        close();

    char sdata[6];
    mutex.lock();
    socket->write("dwnnow",6);
    socket->waitForBytesWritten();
    socket->waitForReadyRead();
    socket->read(sdata,6);
    if(sdata[0]=='d' && sdata[1]=='w' && sdata[2]=='n' && sdata[3]=='n' && sdata[4]=='o' && sdata[5]=='w')
    {
        socket->disconnect();
        mutex.unlock();
        close();
    }
    else
    {
        mutex.unlock();
        QMessageBox messageBox;
        messageBox.critical(0,"Fejl","Bilen kan ikke lukke ned!\n Prøv igen");
        messageBox.setFixedSize(500,200);
    }

}
开发者ID:KarstenSN,项目名称:E4PRJ4,代码行数:26,代码来源:mainwindow.cpp

示例12: addAllRoomEquipments

void RoomSettings::addAllRoomEquipments()
{

    DbMysql* d = DbMysql::getInstance();
    QMessageBox msgBox;
    if(!d->getConnection().open()){
        msgBox.critical(this,"Error","Failed to connect database.");
    }
    else {
        QSqlQuery query( "select * from room_equipments;" ,d->getConnection());
        if( !query.isActive() )
        {
            qDebug()<<"Failed to execute query. insert room.";
            qDebug()<<query.lastQuery();
            qDebug()<<query.lastError().text();
            return;
        }
        else
        {
            ui->equipList->clear();
            int index=0;
            while(query.next())
            {
                QListWidgetItem* item = new QListWidgetItem();
                item->setText(query.value(1).toString());

                qDebug()<<query.value(1).toString();

                item->setData(Qt::UserRole,QVariant::fromValue(query.value(0).toInt()));
                ui->equipList->insertItem(index++,item);
            }
        }
    }
}
开发者ID:dsubhajit,项目名称:bill_master,代码行数:34,代码来源:roomsettings.cpp

示例13: Dequeue

/**************************************************************************
* Dequeue
* ------------------------------------------------------------------------
* Removes the first node from the list
**************************************************************************/
Customer CustomerList::Dequeue()
{
	Node<Customer>* temp;
	Customer tempCustomer;

	if(isEmpty())
	{
		QMessageBox messageBox;
		messageBox.critical(0,"Error","**Cannot dequeue empty list**");
		messageBox.setFixedSize(500,200);
	}
	else
	{
		//Assigns temp to head
		temp  = _head;

		_head = _head->GetNext();

		//Decrements the _nodeCount
		DecrementCount();

		//Calls Orphan to set all pointers to NULL

		temp->Orphan();

		tempCustomer = temp->GetData();

		delete temp;

		temp = NULL;
		}
	return tempCustomer;
}
开发者ID:AustinVaday,项目名称:CS1C-Class-Project,代码行数:38,代码来源:customerlistclass.cpp

示例14: loadMovie

bool DialogVideoPlayer::loadMovie(QString path) {
    qDebug() << "loading " << path;

    QFileInfo check_file(path);
    // check if file exists and if yes: Is it really a file and no directory?
    if (!check_file.exists() || !check_file.isFile()) {
        return false;
    }

    mediaPlayer->setMedia(QUrl::fromLocalFile(path));

    // Wait to load...
    while(mediaPlayer->mediaStatus() != QMediaPlayer::LoadedMedia && mediaPlayer->mediaStatus() != QMediaPlayer::InvalidMedia) {
        qApp->processEvents();
    }





    if (mediaPlayer->mediaStatus() != QMediaPlayer::InvalidMedia) {
        resizeDisplay();
        ui->checkBoxMovie->setEnabled(true);
        ui->checkBoxMovie->setChecked(true);
        return true;
    } else {
        QMessageBox messageBox;
        messageBox.critical(0, "Error", "An error has occured when loading this movie!");
        messageBox.setFixedSize(500, 200);
    }
    return false;
}
开发者ID:jamesalvarez,项目名称:grafix-coder,代码行数:32,代码来源:DialogVideoPlayer.cpp

示例15: Browse

//################################################################################################
// Show folder selection dialog when user chooses output directory
void ExportSingle::Browse(){
    QString outputdir=QFileDialog::getExistingDirectory(this,
    "Select Directory",ui->ExportLocation->text(),QFileDialog::ShowDirsOnly);

    // only copy the directory to the ExportLocation field if the size is greater than 0.
    // if the user cancels the QFileDialog, the size WILL be 0 and we don't want this to be blank.
    if(outputdir.length() != 0){

        QFileInfo p(outputdir);
        if(p.isWritable()){
            ui->ExportLocation->clear();
            ui->ExportLocation->setText(outputdir);
        }
        else{
            QMessageBox m;
            m.critical(this,"RoboJournal","You are not allowed to save files in <b>" +
                       outputdir +"</b>! Please select a different location and try again.");

            //  Browse for another directory
            outputdir.clear();
            Browse();
        }

    }
}
开发者ID:pwizard2,项目名称:robojournal,代码行数:27,代码来源:exportsingle.cpp


注:本文中的QMessageBox::critical方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。