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


C++ QMessageBox类代码示例

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


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

示例1: connection

void QgsWFSSourceSelect::buildQuery( const QModelIndex &index )
{
  if ( !index.isValid() )
  {
    return;
  }

  const QString typeName = index.sibling( index.row(), MODEL_IDX_NAME ).data().toString();

  //get available fields for wfs layer
  QgsWfsConnection connection( cmbConnections->currentText() );
  QgsWFSDataSourceURI uri( connection.uri().uri() );
  uri.setTypeName( typeName );

  QgsDataProvider::ProviderOptions providerOptions;
  QgsWFSProvider p( uri.uri(), providerOptions, mCaps );
  if ( !p.isValid() )
  {
    QMessageBox *box = new QMessageBox( QMessageBox::Critical, tr( "Server exception" ), tr( "DescribeFeatureType failed" ), QMessageBox::Ok, this );
    box->setAttribute( Qt::WA_DeleteOnClose );
    box->setModal( true );
    box->setObjectName( QStringLiteral( "WFSFeatureTypeErrorBox" ) );
    if ( !property( "hideDialogs" ).toBool() )
      box->open();

    return;
  }

  QModelIndex filterIndex = index.sibling( index.row(), MODEL_IDX_SQL );
  QString sql( filterIndex.data().toString() );
  QString displayedTypeName( typeName );
  if ( !mCaps.setAmbiguousUnprefixedTypename.contains( QgsWFSUtils::removeNamespacePrefix( typeName ) ) )
    displayedTypeName = QgsWFSUtils::removeNamespacePrefix( typeName );
  QString allSql( "SELECT * FROM " + QgsSQLStatement::quotedIdentifierIfNeeded( displayedTypeName ) );
  if ( sql.isEmpty() )
  {
    sql = allSql;
  }

  QgsSQLComposerDialog *d = new QgsSQLComposerDialog( this );

  QgsWFSValidatorCallback *validatorCbk = new QgsWFSValidatorCallback( d, uri, allSql, mCaps );
  d->setSQLValidatorCallback( validatorCbk );

  QgsWFSTableSelectedCallback *tableSelectedCbk = new QgsWFSTableSelectedCallback( d, uri, mCaps );
  d->setTableSelectedCallback( tableSelectedCbk );

  const bool bSupportJoins = mCaps.featureTypes.size() > 1 && mCaps.supportsJoins;
  d->setSupportMultipleTables( bSupportJoins, QgsSQLStatement::quotedIdentifierIfNeeded( displayedTypeName ) );

  QMap< QString, QString > mapTypenameToTitle;
  Q_FOREACH ( const QgsWfsCapabilities::FeatureType f, mCaps.featureTypes )
    mapTypenameToTitle[f.name] = f.title;

  QList< QgsSQLComposerDialog::PairNameTitle > tablenames;
  tablenames << QgsSQLComposerDialog::PairNameTitle(
               QgsSQLStatement::quotedIdentifierIfNeeded( displayedTypeName ), mapTypenameToTitle[typeName] );
  if ( bSupportJoins )
  {
    for ( int i = 0; i < mModel->rowCount(); i++ )
    {
      const QString iterTypename = mModel->index( i, MODEL_IDX_NAME ).data().toString();
      if ( iterTypename != typeName )
      {
        QString displayedIterTypename( iterTypename );
        QString unprefixedIterTypename( QgsWFSUtils::removeNamespacePrefix( iterTypename ) );
        if ( !mCaps.setAmbiguousUnprefixedTypename.contains( unprefixedIterTypename ) )
          displayedIterTypename = unprefixedIterTypename;

        tablenames << QgsSQLComposerDialog::PairNameTitle(
                     QgsSQLStatement::quotedIdentifierIfNeeded( displayedIterTypename ), mapTypenameToTitle[iterTypename] );
      }
    }
  }
  d->addTableNames( tablenames );

  QList< QgsSQLComposerDialog::Function> functionList;
  Q_FOREACH ( const QgsWfsCapabilities::Function &f, mCaps.functionList )
  {
    QgsSQLComposerDialog::Function dialogF;
    dialogF.name = f.name;
    dialogF.returnType = f.returnType;
    dialogF.minArgs = f.minArgs;
    dialogF.maxArgs = f.maxArgs;
    Q_FOREACH ( const QgsWfsCapabilities::Argument &arg, f.argumentList )
    {
      dialogF.argumentList << QgsSQLComposerDialog::Argument( arg.name, arg.type );
    }
    functionList << dialogF;
  }
  d->addFunctions( functionList );

  QList< QgsSQLComposerDialog::Function> spatialPredicateList;
  Q_FOREACH ( const QgsWfsCapabilities::Function &f, mCaps.spatialPredicatesList )
  {
    QgsSQLComposerDialog::Function dialogF;
    dialogF.name = f.name;
    dialogF.returnType = f.returnType;
    dialogF.minArgs = f.minArgs;
    dialogF.maxArgs = f.maxArgs;
//.........这里部分代码省略.........
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:101,代码来源:qgswfssourceselect.cpp

示例2: dir

/**
 * Saves model to xml file.
 */
bool DatasetTestMdlParser::save(DatasetTestModel* mdl) const{
	bool succ = true;

	QDir dir(mdl->projectPath());
	if(!dir.exists(mdl->folder()))
		succ = dir.mkdir(mdl->folder());

	if(!succ){
		QMessageBox msgBox;
        msgBox.setWindowTitle(tr("Save testing scenario"));
        msgBox.setText(tr("Testing scenario folder can't be created !!!"));
        msgBox.setInformativeText(tr("Check if given path exists or program have permission to read and write."));
		msgBox.setIcon(QMessageBox::Critical);
		msgBox.exec();
		return false;
	}

	QFile file(mdl->pathName());
	succ = file.open(QIODevice::WriteOnly);

	if(!succ){
		QMessageBox msgBox;
        msgBox.setWindowTitle(tr("Save testing scenario"));
        msgBox.setText(tr("Testing scenario file can't be created !!!"));
        msgBox.setInformativeText(tr("Check if given path exists or program have permission to read and write."));
		msgBox.setIcon(QMessageBox::Critical);
		msgBox.exec();
		return false;
	}

	QXmlStreamWriter wr(&file);
	wr.setAutoFormatting(true);
	wr.writeStartDocument();
	wr.writeStartElement("datasetTest");

	wr.writeStartElement("header");
	wr.writeTextElement("name", mdl->name());
	wr.writeTextElement("dataset", mdl->selectedDatasetName());
	wr.writeTextElement("network", mdl->selectedNetworkName());
	wr.writeEndElement();

	wr.writeEndElement();
	file.close();
	return true;
}
开发者ID:kacerpetr,项目名称:NNCreator,代码行数:48,代码来源:DatasetTestMdlParser.cpp

示例3: message

//------------------------------------------------------------------------------
// Create a message window
//------------------------------------------------------------------------------
void SaleCategories::message(QString text)
{
    QMessageBox msgBox;
    msgBox.setText(text);
    msgBox.exec();
}
开发者ID:Bodiok007,项目名称:SimpleAccounting,代码行数:9,代码来源:salecategories.cpp

示例4: QMessageBox

void MainWindow::updateDiskNameList()
{
    QMessageBox* testBox = new QMessageBox();
    testBox->exec();

}
开发者ID:Rina25,项目名称:TestFlash,代码行数:6,代码来源:mainwindow.cpp

示例5: sobre

void TelaPrincipal::sobre() {
    QMessageBox sobre;
    sobre.setText("UNOESC - Universidade do Oeste de Santa Catarina \nAluno: Luan Tavares \nDisciplina: Compiladores \nProfessor: Cristiano Azevedo");
    sobre.exec();
}
开发者ID:LuanTavares,项目名称:Compilador,代码行数:5,代码来源:TelaPrincipal.cpp

示例6: main

int main(int argv, char **args)
{
    QApplication app(argv, args);
    QWidget *button;

  {
//![0]
    QStateMachine machine;
    machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);

    QState *s1 = new QState();
    s1->assignProperty(object, "fooBar", 1.0);
    machine.addState(s1);
    machine.setInitialState(s1);

    QState *s2 = new QState();
    machine.addState(s2);
//![0]
  }

  {

//![2]
    QStateMachine machine;
    machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);

    QState *s1 = new QState();
    s1->assignProperty(object, "fooBar", 1.0);
    machine.addState(s1);
    machine.setInitialState(s1);

    QState *s2 = new QState(s1);
    s2->assignProperty(object, "fooBar", 2.0);
    s1->setInitialState(s2);

    QState *s3 = new QState(s1);
//![2]

  }

  {
//![3]
    QState *s1 = new QState();
    QState *s2 = new QState();

    s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
    s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));

    s1->addTransition(button, SIGNAL(clicked()), s2);
//![3]

  }

  {
//![4]
    QState *s1 = new QState();
    QState *s2 = new QState();

    s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
    s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));

    QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2);
    transition->addAnimation(new QPropertyAnimation(button, "geometry"));
//![4]

  }

  {
    QMainWindow *mainWindow = 0;

//![5]
    QMessageBox *messageBox = new QMessageBox(mainWindow);
    messageBox->addButton(QMessageBox::Ok);
    messageBox->setText("Button geometry has been set!");
    messageBox->setIcon(QMessageBox::Information);

    QState *s1 = new QState();

    QState *s2 = new QState();
    s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
    connect(s2, SIGNAL(entered()), messageBox, SLOT(exec()));

    s1->addTransition(button, SIGNAL(clicked()), s2);
//![5]
  }

  {
    QMainWindow *mainWindow = 0;

//![6]
    QMessageBox *messageBox = new QMessageBox(mainWindow);
    messageBox->addButton(QMessageBox::Ok);
    messageBox->setText("Button geometry has been set!");
    messageBox->setIcon(QMessageBox::Information);

    QState *s1 = new QState();

    QState *s2 = new QState();
    s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));

//.........这里部分代码省略.........
开发者ID:3163504123,项目名称:phantomjs,代码行数:101,代码来源:main5.cpp

示例7: showButtonTestMessage

void MainWindow::showButtonTestMessage() {
    QMessageBox msgBox;
    msgBox.setText("Button test ...");
    msgBox.exec();
    close();
}
开发者ID:xpharry,项目名称:ROSCppGUI,代码行数:6,代码来源:main_window.cpp

示例8: ShowError

void ExperimentDialog::ShowError(QString msg)
{
    QMessageBox msgBox;
    msgBox.setText(msg);
    msgBox.exec();
}
开发者ID:yzxyzh,项目名称:LazGUI,代码行数:6,代码来源:ExperimentDialog.cpp

示例9: QLabel

void RicercaUt::cerca() {
    if(!rUs->isChecked() && !rNmCg->isChecked()) {
        QMessageBox msg;
        msg.setText("E' necessario selezionare una modalità di ricerca!");
        msg.setIcon(QMessageBox::Warning);
        msg.exec();

    }
    else {
        QString us_nm= campo->text();
        output=new QLabel(areaRisultato);
        output->setAlignment(Qt::AlignTop);
        output->setMargin(5);

        if(!us_nm.isEmpty()) {
            if(rUs->isChecked()) {
                string dati = us_nm.toStdString();
                Utente* risultato=admin->ricercaUsername(dati);
                if(risultato) {
                    string profilo=risultato->mostraDatiAccesso()+risultato->mostraPrCompleto()+"\n";
                    QString pr=QString::fromStdString(profilo);
                    output->setText(pr);
                    output->setWordWrap(true);
                }
                else {
                    QMessageBox msg;
                    msg.setText("Ricerca fallita:l'utente cercato non è registrato in LinQedIn!");
                    msg.setIcon(QMessageBox::Warning);
                    msg.exec();
                    this->close();
                }
            }
            else { //rNmCg->isChecked()==true
                QString cogn= campo1->text();
                string nm = us_nm.toStdString();
                string cgnm=cogn.toStdString();
                list<Utente*> risultato=admin->ricercaNomeCognome(nm,cgnm);
                int numero=risultato.size();
                if(numero!=0){
                    string profili;
                    list<Utente*>::iterator it=risultato.begin();
                    for(;it!=risultato.end();++it) {
                        profili=profili+(*it)->mostraDatiAccesso()+(*it)->mostraPrCompleto()+"\n \n";
                    }
                    QString pr=QString::fromStdString(profili);
                    output->setText(pr);
                    output->setWordWrap(true);
                }
                else {
                    QMessageBox msg;
                    msg.setText("Ricerca fallita:l'utente cercato non è registrato in LinQedIn!");
                    msg.setIcon(QMessageBox::Warning);
                    msg.exec();
                    this->close();
                }
            }

            areaRisultato->setWidget(output);
            areaRisultato->ensureWidgetVisible(output);
            areaRisultato->setWidgetResizable(true);
            areaRisultato->show();
            this->close();
        }
        else {
            QMessageBox msg;
            msg.setText("Campo vuoto: immettere l'utente da cercare!");
            msg.setIcon(QMessageBox::Warning);
            msg.exec();
        }
    }
}
开发者ID:rudyberton92,项目名称:LinQedIn,代码行数:71,代码来源:ricercaAdmin.cpp

示例10: main

int main(int argc, char *argv[])
{
    QCoreApplication::setApplicationName( "VideoLibrary" );

    for(int i=0;i<argc;i++){
        if(!strcmp(argv[i],"-v")){              //return version ID integer
            QString version(CURRENT_VERSION);
            QStringList n = version.split(".");
            int ID = n.at(0).toInt()*100*100 + n.at(1).toInt()*100 + n.at(2).toInt();
            qDebug() << QString("Version : ") + version + QString(" - ID : ") + QString::number(ID);
            return ID;
        }
        if(!strcmp(argv[i],"-n")){              //return 1 if CURRENT_VERSION > version
            QStringList currentVersion = QString(CURRENT_VERSION).split(".");
            QStringList version = QString(argv[i+1]).split(".");
            if(currentVersion.at(0)>version.at(0)) return 1;
            if(currentVersion.at(1)>version.at(1)) return 1;
            if(currentVersion.at(2)>version.at(2)) return 1;
            return 0;
        }
    }

    QApplication a(argc, argv);

    QString path = qApp->applicationFilePath();

    Window w;
    w.setExecutableFilename(path);

#if defined(__WIN32__)
    if(path.contains("-update.exe")){
        QString original_path = path;
        original_path = original_path.remove("-update");

        w.showNewFeatures();

        if(QFile::exists(original_path)){
            if(!QFile::remove(original_path)){
               QMessageBox mess;
               mess.setText(QString("Can't remove: %1\nPlease close the software then restart the update").arg(original_path));
               mess.setWindowTitle("Error");
               mess.setIcon(QMessageBox::Critical);
               mess.exec();
            }
        }

        QFile::copy(path,original_path);
        QProcess process;

#ifdef DEBUG_OUTPUT
        w.addLog(path,QString(CURRENT_VERSION),original_path,"Install update");
#endif

        process.startDetached("\""+original_path+"\"");
        exit(1);
    }else{
        QString update = path;
        update.remove(".exe");
        update += "-update.exe";

#ifdef DEBUG_OUTPUT
        w.addLog(path,QString(CURRENT_VERSION),update,"Update path");
#endif

        if(QFile::exists(update)){
            QProcess process;
            QStringList arg;
            arg << "-v";
            int version = process.execute("\""+update+"\"",arg);
            QString updateVersion = QString::number(version);
            QString currentVersion(CURRENT_VERSION);
            QStringList n = currentVersion.split(".");
            int ID = n.at(0).toInt()*100*100 + n.at(1).toInt()*100 + n.at(2).toInt();
            if(ID>=version){
                qDebug() << "Already up to date";
#ifdef DEBUG_OUTPUT
                w.addLog(path,QString(CURRENT_VERSION),"","Already up to date");
                QMessageBox mess;
                mess.setText(QString("Already up to date\n%1 wille be remove").arg(update));
                mess.setWindowTitle("Information");
                mess.setIcon(QMessageBox::Information);
                mess.setDetailedText("Current version: "+currentVersion+"\n\n"
                                     "Update version: "+updateVersion);
                mess.exec();
#endif
                QFile::remove(update);
            }else{
#ifdef DEBUG_OUTPUT
                w.addLog(path,QString(CURRENT_VERSION),QString::number(version),"Start Update");
                QMessageBox mess;
                mess.setText(QString("Start update"));
                mess.setWindowTitle("Information");
                mess.setIcon(QMessageBox::Information);
                mess.setDetailedText("Update path:\n"+update);
                mess.exec();
#endif
                process.startDetached("\""+update+"\"");
                exit(1);
            }
        }
//.........这里部分代码省略.........
开发者ID:lbaudouin,项目名称:VideoLibrary,代码行数:101,代码来源:main.cpp

示例11: sSave

bool xTupleDesignerActions::sSave()
{
  QMessageBox save;
  save.setText("How do you want to save your changes?");
  QPushButton *cancel= save.addButton(QMessageBox::Cancel);
  QPushButton *db    = save.addButton(tr("Database only"),    QMessageBox::AcceptRole);
  QPushButton *file  = save.addButton(tr("File only"),        QMessageBox::AcceptRole);
  QPushButton *both  = save.addButton(tr("Database and File"),QMessageBox::AcceptRole);

  save.setDefaultButton(_designer->formwindow()->fileName().isEmpty() ? db : both);
  save.setEscapeButton((QAbstractButton*)cancel);

  save.exec();
  if (save.clickedButton() == (QAbstractButton*)db)
    return sSaveToDB();
  else if (save.clickedButton() == (QAbstractButton*)file)
    return sSaveFile();
  else if (save.clickedButton() == (QAbstractButton*)both)
    return sSaveFile() && sSaveToDB();
  else if (save.clickedButton() == (QAbstractButton*)cancel)
    return false;
  else
  {
    qWarning("xTupleDesignerActions::sSave() bug - unknown button clicked");
    return false;
  }
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:27,代码来源:xTupleDesignerActions.cpp

示例12: QHBoxLayout

ObjectEditorWidget::ObjectEditorWidget()
{
	this->setLayout( new QHBoxLayout() );

	QWidget * objectListContainer = new QWidget;
	objectListContainer->setLayout( new QVBoxLayout );

	objectListContainer->layout()->addWidget( new QLabel( "Objects" ) );

	objectList = new ObjectListWidget();
	objectList->refreshList();

	connect( objectList->selectionModel(), &QItemSelectionModel::selectionChanged, [this](){ this->changingSelection(); } );


	objectListContainer->setFixedWidth( 150 );

	objectListContainer->layout()->addWidget( objectList );

	QPushButton * newObjButt = new QPushButton( "New" );
	connect( newObjButt, &QPushButton::clicked, [this](){
		bool ok;
		QString s = QInputDialog::getText(this, tr("New Object"), tr("Name:"), QLineEdit::Normal, tr( "NewObject" ), &ok);
		if (ok && !s.isEmpty())
		{
			StructureObject obj;
			obj.name = s.toStdString();
			display( obj );
			saveCurrent();
			objectList->refreshList();
			hasChanged = false;
			objectList->seekObject( s );
		}
	} );
	objectListContainer->layout()->addWidget( newObjButt );

	QPushButton * deleteObjButt = new QPushButton( "Delete" );
	connect( deleteObjButt, &QPushButton::clicked, [this](){
		if( objectList->currentRow() != -1 )
		{
			QMessageBox msgBox;
			msgBox.setWindowTitle("Deleting Object");
			msgBox.setText("Are you sure you want to delete the object \"" + objectList->item( objectList->currentRow() )->text() + "\"?");
			msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
			msgBox.setDefaultButton(QMessageBox::No);
			int result = msgBox.exec();
			if( result == QMessageBox::Yes )
			{
				remove( ( "Assets/objs/" + ( objectList->item( objectList->currentRow() )->text() + ".rpobj" ).toStdString() ).c_str() );
				editingIndex = -1;
				objectList->selectionModel()->reset();
				objectList->refreshList();				
				hide();
			}
		}
	} );
	objectListContainer->layout()->addWidget( deleteObjButt );

	this->layout()->addWidget( objectListContainer ); //Existing objects widget

	noObjectSelected = new QWidget();
	noObjectSelected->setLayout( new QVBoxLayout() );
	noObjectSelected->layout()->setAlignment( Qt::AlignHCenter );
	noObjectSelected->layout()->addWidget( new QLabel( "No object has been selected for editing" ) );
	QFont nf("Tahoma");
	nf.setPixelSize( 24 );
	noObjectSelected->setFont( nf );
	this->layout()->addWidget( noObjectSelected );

	currentObjectContainer = new QSplitter( Qt::Vertical );
	//currentObjectContainer->setLayout( new QVBoxLayout );

	QWidget * currentObjectEditorContainer = new QWidget;
	currentObjectEditorContainer->setLayout( new QVBoxLayout );

	nameEditor = new QLineEdit;
	QFont lf("Tahoma");
	lf.setPixelSize( 24 );
	nameEditor->setFont(lf);
	nameEditor->setMaximumWidth( 320 );
	connect( nameEditor, &QLineEdit::textEdited, [this](){ hasChanged = true; } );
	currentObjectEditorContainer->layout()->addWidget( nameEditor );

	codeEditTabs = new QTabWidget();

	const char * signatures[] = { "subsetRayMarch( x, y, z, out r, out g, out b ) : boolean", "distanceRayMarch( x, y, z, out r, out g, out b ) : number", "rayTrace( x, y, z, dx, dy, dy, out dist, out r, out g, out b ) : boolean" };

	for( int i = 0; i < 3; i++ )
	{
		QWidget * de = new QWidget;
		de->setLayout( new QVBoxLayout );

	
		QCheckBox * check = new QCheckBox;
		check->setChecked( false );
		check->setText( "Enabled" );
		de->layout()->addWidget( check );

	
		de->layout()->addWidget( new QLabel( signatures[i] ) );
//.........这里部分代码省略.........
开发者ID:JonECG,项目名称:Raypoint,代码行数:101,代码来源:ObjectEditorWidget.cpp

示例13: DatasetTestModel

/**
 * Loads model from xml file.
 */
DatasetTestModel* DatasetTestMdlParser::load(QString path) const{
	DatasetTestModel* mdl = new DatasetTestModel();

	QFile file(path);
	bool succ = file.open(QIODevice::ReadOnly);

	if(!succ){
		QMessageBox msgBox;
        msgBox.setWindowTitle(tr("Open dataset test"));
        msgBox.setText(tr("Dataset test file can't be opened !!!"));
        msgBox.setInformativeText(tr("Check if file exists or program have permission to read it."));
		msgBox.setIcon(QMessageBox::Critical);
		msgBox.exec();
		delete mdl;
		return NULL;
	}

	QXmlStreamReader rd;
	rd.setDevice(&file);

	QString elemName;
	int state = 0;

	//reading
	while (!rd.atEnd()) {
		switch(rd.readNext()){
			case QXmlStreamReader::StartElement:
				elemName = rd.name().toString();
				if(rd.name() == "header"){
					state = 1;
				}
				break;

			case QXmlStreamReader::EndElement:
				elemName = "";
				if(rd.name() == "header"){
					state = 0;
				}
				break;

			case QXmlStreamReader::Characters:
				switch(state){
					case 1:
						if(elemName == "name") mdl->setName(rd.text().toString());
						if(elemName == "network") mdl->selectNetwork(rd.text().toString());
						if(elemName == "dataset") mdl->selectDataset(rd.text().toString());
						break;
				}
				break;

			default:
				break;
		}
	}

	//error handling
	if(rd.hasError()){
		QMessageBox msgBox;
        msgBox.setWindowTitle(tr("Open dataset test"));
        msgBox.setText(tr("Error parsing dataset test file !!!"));
		msgBox.setInformativeText(rd.errorString());
		msgBox.setIcon(QMessageBox::Critical);
		msgBox.exec();
		file.close();
		delete mdl;
		return NULL;
	}

	file.close();
	return mdl;
}
开发者ID:kacerpetr,项目名称:NNCreator,代码行数:74,代码来源:DatasetTestMdlParser.cpp

示例14: guardado

void ui_agregaraccesorios::on_pushButton_agregar_clicked()
{


    if(!verificarRestricciones())
        return;

    tuaccesorio.setCodigo(ui->lineEdit_codigo->text());
    tuaccesorio.setDescripcion(ui->lineEdit_descripcion->text());
    tuaccesorio.setPrecioCompra(ui->doubleSpinBox_precio_compra->text());
    tuaccesorio.setPrecioVenta(ui->doubleSpinBox_precio_venta->text());
    tuaccesorio.setPrecioDescuento(ui->doubleSpinBox_precio_descuento->text());
    tuaccesorio.setAccesorios(ui->lineEdit_accesorios->text());
    tuaccesorio.setStock(ui->spinBox_stock->text());
    tuaccesorio.setObservaciones(ui->lineEdit_observaciones->text());
    estado pEstado;pEstado.setNombre(ui->comboBox_estado->currentText());
    pEstado.setIdEstado(QString::number(ui->comboBox_estado->getId(ui->comboBox_estado->currentText())));
    m_marca pMarca;pMarca.setNombre(ui->comboBox_marca->currentText());
    pMarca.setIdMarca(QString::number(ui->comboBox_marca->getId(ui->comboBox_marca->currentText())));
    //colaborador
    color pColor;pColor.setNombre(ui->comboBox_color->currentText());
    pColor.setIdColor(QString::number(ui->comboBox_color->getId(ui->comboBox_color->currentText())));
    tamanio pTamanio;pTamanio.setNombre(ui->comboBox_tamanio->currentText());
    pTamanio.setIdTamanio(QString::number(ui->comboBox_tamanio->getId(ui->comboBox_tamanio->currentText())));
    calidad pCalidad;pCalidad.setNombre(ui->comboBox_calidad->currentText());
    pCalidad.setIdCalidad(QString::number(ui->comboBox_calidad->getId(ui->comboBox_calidad->currentText())));
    genero pGenero; pGenero.setNombre(ui->comboBox_genero->currentText());
    pGenero.setIdgenero(QString::number(ui->comboBox_genero->getId(ui->comboBox_genero->currentText())));

    tuaccesorio.setEstado(pEstado);
    tuaccesorio.setMarca(pMarca);
    //colaborador

    tuaccesorio.setColor(pColor);
    tuaccesorio.setTamanio(pTamanio);
    tuaccesorio.setCalidad(pCalidad);
    tuaccesorio.setGenero(pGenero);

    if(modo==0)
    {

        if(tuaccesorio.agregar())
        {

            emit guardado();
        }
        else
        {
            QMessageBox box;
            box.setIcon(QMessageBox::Critical);
            box.setWindowTitle("Error");
            box.setText("El producto no se pudo agregar!");
            box.setStandardButtons(QMessageBox::Ok);
            box.setDefaultButton(QMessageBox::Ok);
            box.exec();
        }
    }
    else//actualizo
    {
        if(tuaccesorio.actualizar())
        {
            emit guardado();
        }
        else
        {
            QMessageBox box;
            box.setIcon(QMessageBox::Critical);
            box.setWindowTitle("Error");
            box.setText("El producto no se pudo actualizar!");
            box.setStandardButtons(QMessageBox::Ok);
            box.setDefaultButton(QMessageBox::Ok);
            box.exec();
        }
    }
    this->close();

}
开发者ID:rodety,项目名称:opticam,代码行数:77,代码来源:ui_agregaraccesorios.cpp

示例15: while

void NineMLLayout::load(QDomDocument *doc)
{
    QDomNode n = doc->documentElement().firstChild();
    while( !n.isNull() )
    {
        QDomElement e = n.toElement();
        if( e.tagName() == "LayoutClass" )
        {
            this->name = e.attribute("name","");
            // default to unsorted in no type found
            //this->type = e.attribute("type", "unsorted");
            QDomNode n2 = e.firstChild();
            while( !n2.isNull() )
            {
                QDomElement e2 = n2.toElement();
                if( e2.tagName() == "Parameter" )
                {
                    Parameter *tempPar = new Parameter;
                    tempPar->readIn(e2);
                    this->ParameterList.push_back(tempPar);
                }
                if( e2.tagName() == "Spatial" )
                {
                    QDomNode n3 = e2.firstChild();
                    while( !n3.isNull() )
                    {
                        QDomElement e3 = n3.toElement();
                        if( e3.tagName() == "Regime" )
                        {
                            RegimeSpace *tempRegime  = new RegimeSpace;
                            tempRegime->readIn(e3);
                            this->RegimeList.push_back(tempRegime);
                        }
                        if( e3.tagName() == "StateVariable" )
                        {
                            StateVariable *tempSV  = new StateVariable;
                            tempSV->readIn(e3);
                            this->StateVariableList.push_back(tempSV);
                        }
                        if( e3.tagName() == "Alias" )
                        {
                            Alias *tempAlias  = new Alias;
                            tempAlias->readIn(e3);
                            this->AliasList.push_back(tempAlias);
                        }

                        n3 = n3.nextSibling();
                    }
                }
                n2 = n2.nextSibling();
            }

        }
        n = n.nextSibling();
    }

    // validate this
    QStringList validated = validateComponent();
    if (validated.size() > 1) {
        QMessageBox msgBox;
        QString message;
        for (uint i = 0; i < (uint) validated.size(); ++i) {
            message += validated[i] + "\n";
        }
        msgBox.setText(message);
        msgBox.exec();
    }
}
开发者ID:MuriloDAG,项目名称:SpineCreator,代码行数:68,代码来源:nineml_layout_classes.cpp


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