diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:16 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 17:46:34 +0200 |
commit | 440286655e0ca271506cf7cc02ad0dbf4baef9ca (patch) | |
tree | 896fa81adb8b14a69355a3a6cf64d06ec8173c9a /examples/widgets/tools/codecs/previewform.cpp | |
parent | 1e27ad1697187549151657ba187928e439300db7 (diff) | |
parent | e164d61ca8263fc4b46fdd916e1ea77c7dd2b735 (diff) | |
download | qtbase-440286655e0ca271506cf7cc02ad0dbf4baef9ca.tar.gz |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
Diffstat (limited to 'examples/widgets/tools/codecs/previewform.cpp')
-rw-r--r-- | examples/widgets/tools/codecs/previewform.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/examples/widgets/tools/codecs/previewform.cpp b/examples/widgets/tools/codecs/previewform.cpp index 206b5757cd..ec75ebb9fa 100644 --- a/examples/widgets/tools/codecs/previewform.cpp +++ b/examples/widgets/tools/codecs/previewform.cpp @@ -48,10 +48,19 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "previewform.h" +#include <QApplication> +#include <QComboBox> +#include <QDesktopWidget> +#include <QDialogButtonBox> +#include <QGridLayout> +#include <QLabel> +#include <QPlainTextEdit> +#include <QPushButton> +#include <QTextCodec> +#include <QTextStream> + // Helpers for creating hex dumps static void indent(QTextStream &str, int indent) { @@ -83,8 +92,7 @@ static void formatHex(QTextStream &str, const QByteArray &data) static void formatPrintableCharacters(QTextStream &str, const QByteArray &data) { - for (int i = 0, size = data.size(); i < size; ++i) { - const char c = data.at(i); + for (const char c : data) { switch (c) { case '\0': str << "\\0"; @@ -179,7 +187,7 @@ PreviewForm::PreviewForm(QWidget *parent) resize(screenGeometry.width() * 2 / 5, screenGeometry.height() / 2); } -void PreviewForm::setCodecList(const QList<QTextCodec *> &list) +void PreviewForm::setCodecList(const QVector<QTextCodec *> &list) { encodingComboBox->clear(); for (const QTextCodec *codec : list) { @@ -226,10 +234,10 @@ void PreviewForm::updateTextEdit() statusLabel->setText(message); statusLabel->setStyleSheet(QStringLiteral("background-color: \"red\";")); } else if (state.invalidChars) { - statusLabel->setText(tr("%1: %n invalid characters", 0, state.invalidChars).arg(name)); + statusLabel->setText(tr("%1: %n invalid characters", nullptr, state.invalidChars).arg(name)); statusLabel->setStyleSheet(QStringLiteral("background-color: \"yellow\";")); } else { - statusLabel->setText(tr("%1: %n bytes converted", 0, encodedData.size()).arg(name)); + statusLabel->setText(tr("%1: %n bytes converted", nullptr, encodedData.size()).arg(name)); statusLabel->setStyleSheet(QString()); } if (success) |