void Login::error(QString title, QString messages) { QErrorMessage *message = new QErrorMessage(this); message->setWindowTitle(title); message->showMessage(messages); return; }
void MyGL::slot_symEdgeButtonPressed() { if (edgeSelection != nullptr) { if (edgeSelection->sym != nullptr) { edgeSelection = edgeSelection->sym; } else { QErrorMessage* errorMessageDialog = new QErrorMessage(this); errorMessageDialog->setWindowTitle(QString("Error: No sym found!")); errorMessageDialog->showMessage(QString("This Half-Edge has no symmetrical edge value")); } } }
void MyGL::slot_nextEdgeButtonPressed() { if (edgeSelection != nullptr) { if (edgeSelection->next != nullptr) { edgeSelection = edgeSelection->next; //The selection in the widget doesn't update 504 } else { QErrorMessage* errorMessageDialog = new QErrorMessage(this); errorMessageDialog->setWindowTitle(QString("Error: No next found!")); errorMessageDialog->showMessage(QString("This Half-Edge has no next edge value")); } } }
void MyGL::slot_bindAtIndex(int idx) { if (meshes.size() > idx && joints[idx]!=nullptr) { meshes[idx]->bindVertices(joints[idx]); glm::mat4 transMats[100]; glm::mat4 bindMats[100]; joints[0]->getTransMats(transMats); joints[0]->getBindMats(bindMats); prog_mesh.setBindMatrices(bindMats); prog_mesh.setTransMatrices(transMats); } else { QErrorMessage* errorMessageDialog = new QErrorMessage(this); errorMessageDialog->setWindowTitle(QString("Error: Root Joint Not Selected!")); errorMessageDialog->showMessage(QString("Select Root Joint to Bind")); } }
void XSLExpress::process() { QString xslFile = ui->xslFile->text(); QString replaceThis = ui->replaceThis->text(); QString replaceWith = ui->replaceWith->text(); QStringList inputFiles = ui->inputFiles->toPlainText().split("\n", QString::SkipEmptyParts ); if( xslFile.isEmpty() ) return; if( inputFiles.isEmpty() ) return; QString failures; // so for whatever reason this isn't working QProgressDialog progress( tr("Processing files..."), tr("Cancel"), 0, inputFiles.count(), 0); progress.setWindowModality(Qt::WindowModal); Xsltproc transform; QString lastXmlErrorMessage; int xmlErrors = 0; QErrorMessage *errDialog = new QErrorMessage(this); QFont font("Courier"); font.setStyleHint(QFont::TypeWriter); errDialog->setFont(font); errDialog->resize(600,300); for( int i=0; i<inputFiles.count(); i++) { progress.setValue(i); if (progress.wasCanceled()) break; QString outputFile = inputFiles.at(i); outputFile.replace(QRegExp(replaceThis), replaceWith); if( inputFiles.at(i) == outputFile && !ui->allowOverwrite->isChecked() ) { failures += inputFiles.at(i) + tr(" (overwrite prevented)\n"); continue; } QFileInfo info(inputFiles.at(i)); QString errorFilename = QDir::temp().filePath( tr(".~err-%1!").arg( info.fileName() ) ); QFileInfo errorFileInfo(errorFilename); QHash<QString,QString> parameters; for(int j=0; j<aParameterValues.count(); j++) if( !aParameterNames.at(j)->text().isEmpty() ) parameters.insert( aParameterNames.at(j)->text() , aParameterValues.at(j)->text() ); transform.setStyleSheet(xslFile); transform.setXmlFilename( inputFiles.at(i) ); transform.setOutputFilename(outputFile); transform.setErrorFilename(errorFilename); transform.setParameters(parameters); Xsltproc::ReturnValue retval = transform.execute(); QString errorMessage; QFile data(errorFileInfo.absoluteFilePath()); if (data.open(QFile::ReadOnly)) { QTextStream in(&data); errorMessage = in.readAll(); errorMessage.replace("\n","<p>").replace(" "," "); } switch(retval) { case Xsltproc::InvalidStylesheet: progress.cancel(); errDialog->setWindowTitle(tr("XSL Stylesheet Error")); errDialog->showMessage(errorMessage); return; case Xsltproc::InvalidXmlFile: lastXmlErrorMessage = errorMessage; xmlErrors++; failures += inputFiles.at(i) + tr(" (invalid input file)\n"); break; case Xsltproc::CouldNotOpenOutput: failures += inputFiles.at(i) + tr(" (could not open output file)\n"); break; case Xsltproc::GenericFailure: failures += inputFiles.at(i) + tr(" (unknown error)\n"); break; case Xsltproc::Success: break; } QFile::remove(errorFilename); } progress.setValue(inputFiles.count()); if(xmlErrors > 1) { QMessageBox::information(this,tr("Error Report"),tr("These files quit with an error:\n%1").arg(failures.trimmed())); errDialog->setWindowTitle(tr("Most recent XML Input Error")); errDialog->showMessage(lastXmlErrorMessage); } else if(xmlErrors > 0) { errDialog->setWindowTitle(tr("XML Input Error")); errDialog->showMessage(lastXmlErrorMessage); } }
// 错误信息对话框 void MyWidget::on_pushButton_7_clicked() { QErrorMessage *dialog = new QErrorMessage(this); dialog->setWindowTitle(tr("错误信息对话框")); dialog->showMessage(tr("这里是出错信息!")); }