From a27d5be4dc48e3bd7dbb2a624b17821daa60aaf0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 Feb 2012 07:39:45 +0100 Subject: examples: compile w/QT_NO_CAST_FROM_BYTEARRAY, at least on Unix This is all pretty straight-forward, adding .constData() or using QString::fromLatin1() instead of QLatin1String(). Change-Id: I984706452db7d0841620a0f64e179906123f3849 Reviewed-by: Stephen Kelly --- examples/widgets/scribble/mainwindow.cpp | 6 +++--- examples/widgets/stylesheet/stylesheeteditor.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/widgets') diff --git a/examples/widgets/scribble/mainwindow.cpp b/examples/widgets/scribble/mainwindow.cpp index 4a59e93a61..00bf9884c9 100644 --- a/examples/widgets/scribble/mainwindow.cpp +++ b/examples/widgets/scribble/mainwindow.cpp @@ -239,12 +239,12 @@ bool MainWindow::saveFile(const QByteArray &fileFormat) QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), initialPath, tr("%1 Files (*.%2);;All Files (*)") - .arg(QString(fileFormat.toUpper())) - .arg(QString(fileFormat))); + .arg(QString::fromLatin1(fileFormat.toUpper())) + .arg(QString::fromLatin1(fileFormat))); if (fileName.isEmpty()) { return false; } else { - return scribbleArea->saveImage(fileName, fileFormat); + return scribbleArea->saveImage(fileName, fileFormat.constData()); } } //! [20] diff --git a/examples/widgets/stylesheet/stylesheeteditor.cpp b/examples/widgets/stylesheet/stylesheeteditor.cpp index 88f5100d12..5514291a7f 100644 --- a/examples/widgets/stylesheet/stylesheeteditor.cpp +++ b/examples/widgets/stylesheet/stylesheeteditor.cpp @@ -85,7 +85,7 @@ void StyleSheetEditor::loadStyleSheet(const QString &sheetName) { QFile file(":/qss/" + sheetName.toLower() + ".qss"); file.open(QFile::ReadOnly); - QString styleSheet = QLatin1String(file.readAll()); + QString styleSheet = QString::fromLatin1(file.readAll()); ui.styleTextEdit->setPlainText(styleSheet); qApp->setStyleSheet(styleSheet); -- cgit v1.2.3