Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtWidgets]

This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.

Task-number: QTBUG-21872
Change-Id: Ie8ac500f2f8ebe99b7525feaa7b39247e641a461
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2012-05-02 16:32:26 +02:00 committed by Qt by Nokia
parent 425b925b7e
commit 1eac22a1b9
30 changed files with 107 additions and 107 deletions

View File

@ -277,7 +277,7 @@ public:
*/
void QAccessibleWidget::addControllingSignal(const QString &signal)
{
QByteArray s = QMetaObject::normalizedSignature(signal.toAscii());
QByteArray s = QMetaObject::normalizedSignature(signal.toLatin1());
if (object()->metaObject()->indexOfSignal(s) < 0)
qWarning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className());
d->primarySignals << QLatin1String(s);
@ -388,7 +388,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel
QACConnectionObject *connectionSender = (QACConnectionObject*)sender;
QStringList senderPrimarySignals = static_cast<QAccessibleWidget*>(iface)->d->primarySignals;
for (int sig = 0; sig < senderPrimarySignals.count(); ++sig) {
const QByteArray strSignal = senderPrimarySignals.at(sig).toAscii();
const QByteArray strSignal = senderPrimarySignals.at(sig).toLatin1();
if (connectionSender->isSender(object(), strSignal.constData()))
rels.append(qMakePair(iface, rel));
}
@ -400,7 +400,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel
QObjectList allReceivers;
QACConnectionObject *connectionObject = (QACConnectionObject*)object();
for (int sig = 0; sig < d->primarySignals.count(); ++sig) {
const QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toAscii());
const QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toLatin1());
allReceivers += receivers;
}

View File

@ -150,7 +150,7 @@ public:
// Creates a bidirectional edge
#if defined(QT_DEBUG) && 0
qDebug("Graph::createEdge(): %s",
qPrintable(QString::fromAscii("%1-%2")
qPrintable(QString::fromLatin1("%1-%2")
.arg(first->toString()).arg(second->toString())));
#endif
if (edgeData(first, second)) {
@ -167,7 +167,7 @@ public:
// Removes a bidirectional edge
#if defined(QT_DEBUG) && 0
qDebug("Graph::removeEdge(): %s",
qPrintable(QString::fromAscii("%1-%2")
qPrintable(QString::fromLatin1("%1-%2")
.arg(first->toString()).arg(second->toString())));
#endif
EdgeData *data = edgeData(first, second);
@ -180,7 +180,7 @@ public:
{
#if defined(QT_DEBUG) && 0
qDebug("Graph::takeEdge(): %s",
qPrintable(QString::fromAscii("%1-%2")
qPrintable(QString::fromLatin1("%1-%2")
.arg(first->toString()).arg(second->toString())));
#endif
// Removes a bidirectional edge
@ -236,7 +236,7 @@ public:
EdgeData *data = edgeData(v, v1);
bool forward = data->from == v;
if (forward) {
edges += QString::fromAscii("\"%1\"->\"%2\" [label=\"[%3,%4,%5,%6,%7]\" color=\"#000000\"] \n")
edges += QString::fromLatin1("\"%1\"->\"%2\" [label=\"[%3,%4,%5,%6,%7]\" color=\"#000000\"] \n")
.arg(v->toString())
.arg(v1->toString())
.arg(data->minSize)
@ -247,9 +247,9 @@ public:
;
}
}
strVertices += QString::fromAscii("\"%1\" [label=\"%2\"]\n").arg(v->toString()).arg(v->toString());
strVertices += QString::fromLatin1("\"%1\" [label=\"%2\"]\n").arg(v->toString()).arg(v->toString());
}
return QString::fromAscii("%1\n%2\n").arg(strVertices).arg(edges);
return QString::fromLatin1("%1\n%2\n").arg(strVertices).arg(edges);
}
#endif

View File

@ -611,10 +611,10 @@ QString GraphPath::toString() const
{
QString string(QLatin1String("Path: "));
foreach(AnchorData *edge, positives)
string += QString::fromAscii(" (+++) %1").arg(edge->toString());
string += QString::fromLatin1(" (+++) %1").arg(edge->toString());
foreach(AnchorData *edge, negatives)
string += QString::fromAscii(" (---) %1").arg(edge->toString());
string += QString::fromLatin1(" (---) %1").arg(edge->toString());
return string;
}
@ -765,9 +765,9 @@ static AnchorData *createSequence(Graph<AnchorVertex, AnchorData> *graph,
#if defined(QT_DEBUG) && 0
QString strVertices;
for (int i = 0; i < vertices.count(); ++i) {
strVertices += QString::fromAscii("%1 - ").arg(vertices.at(i)->toString());
strVertices += QString::fromLatin1("%1 - ").arg(vertices.at(i)->toString());
}
QString strPath = QString::fromAscii("%1 - %2%3").arg(before->toString(), strVertices, after->toString());
QString strPath = QString::fromLatin1("%1 - %2%3").arg(before->toString(), strVertices, after->toString());
qDebug("simplifying [%s] to [%s - %s]", qPrintable(strPath), qPrintable(before->toString()), qPrintable(after->toString()));
#endif
@ -847,7 +847,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
static int count = 0;
if (orientation == Horizontal) {
count++;
dumpGraph(QString::fromAscii("%1-full").arg(count));
dumpGraph(QString::fromLatin1("%1-full").arg(count));
}
#endif
@ -872,8 +872,8 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
}
#if defined(QT_DEBUG) && 0
dumpGraph(QString::fromAscii("%1-simplified-%2").arg(count).arg(
QString::fromAscii(orientation == Horizontal ? "Horizontal" : "Vertical")));
dumpGraph(QString::fromLatin1("%1-simplified-%2").arg(count).arg(
QString::fromLatin1(orientation == Horizontal ? "Horizontal" : "Vertical")));
#endif
return true;
@ -903,7 +903,7 @@ bool QGraphicsAnchorLayoutPrivate::replaceVertex(Orientation orientation, Anchor
AnchorVertex *otherV = replaceVertex_helper(ad, oldV, newV);
#if defined(QT_DEBUG)
ad->name = QString::fromAscii("%1 --to--> %2").arg(ad->from->toString()).arg(ad->to->toString());
ad->name = QString::fromLatin1("%1 --to--> %2").arg(ad->from->toString()).arg(ad->to->toString());
#endif
bool newFeasible;
@ -1766,7 +1766,7 @@ void QGraphicsAnchorLayoutPrivate::addAnchor_helper(QGraphicsLayoutItem *firstIt
data->from = v1;
data->to = v2;
#ifdef QT_DEBUG
data->name = QString::fromAscii("%1 --to--> %2").arg(v1->toString()).arg(v2->toString());
data->name = QString::fromLatin1("%1 --to--> %2").arg(v1->toString()).arg(v2->toString());
#endif
// ### bit to track internal anchors, since inside AnchorData methods
// we don't have access to the 'q' pointer.
@ -2999,11 +2999,11 @@ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const
#ifdef QT_DEBUG
void QGraphicsAnchorLayoutPrivate::dumpGraph(const QString &name)
{
QFile file(QString::fromAscii("anchorlayout.%1.dot").arg(name));
QFile file(QString::fromLatin1("anchorlayout.%1.dot").arg(name));
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
qWarning("Could not write to %s", file.fileName().toLocal8Bit().constData());
QString str = QString::fromAscii("digraph anchorlayout {\nnode [shape=\"rect\"]\n%1}");
QString str = QString::fromLatin1("digraph anchorlayout {\nnode [shape=\"rect\"]\n%1}");
QString dotContents = graph[0].serializeToDot();
dotContents += graph[1].serializeToDot();
file.write(str.arg(dotContents).toLocal8Bit());

View File

@ -181,7 +181,7 @@ struct AnchorData : public QSimplexVariable {
#ifdef QT_DEBUG
inline QString AnchorData::toString() const
{
return QString::fromAscii("Anchor(%1)").arg(name);
return QString::fromLatin1("Anchor(%1)").arg(name);
}
#endif
@ -193,7 +193,7 @@ struct SequentialAnchorData : public AnchorData
type = AnchorData::Sequential;
orientation = m_edges.at(0)->orientation;
#ifdef QT_DEBUG
name = QString::fromAscii("%1 -- %2").arg(vertices.first()->toString(), vertices.last()->toString());
name = QString::fromLatin1("%1 -- %2").arg(vertices.first()->toString(), vertices.last()->toString());
#endif
}
@ -221,7 +221,7 @@ struct ParallelAnchorData : public AnchorData
from = first->from;
to = first->to;
#ifdef QT_DEBUG
name = QString::fromAscii("%1 | %2").arg(first->toString(), second->toString());
name = QString::fromLatin1("%1 | %2").arg(first->toString(), second->toString());
#endif
}
@ -263,9 +263,9 @@ inline QString AnchorVertex::toString() const
return QLatin1String("NULL");
} else if (m_type == Pair) {
const AnchorVertexPair *vp = static_cast<const AnchorVertexPair *>(this);
return QString::fromAscii("(%1, %2)").arg(vp->m_first->toString()).arg(vp->m_second->toString());
return QString::fromLatin1("(%1, %2)").arg(vp->m_first->toString()).arg(vp->m_second->toString());
} else if (!m_item) {
return QString::fromAscii("NULL_%1").arg(quintptr(this));
return QString::fromLatin1("NULL_%1").arg(quintptr(this));
}
QString edge;
switch (m_edge) {

View File

@ -2410,7 +2410,7 @@ void QGraphicsWidget::dumpFocusChain()
qWarning("Found a focus chain that is not circular, (next == 0)");
break;
}
qDebug() << i++ << QString::number(uint(next), 16) << next->className() << next->data(0) << QString::fromAscii("focusItem:%1").arg(next->hasFocus() ? '1' : '0') << QLatin1String("next:") << next->d_func()->focusNext->data(0) << QLatin1String("prev:") << next->d_func()->focusPrev->data(0);
qDebug() << i++ << QString::number(uint(next), 16) << next->className() << next->data(0) << QString::fromLatin1("focusItem:%1").arg(next->hasFocus() ? '1' : '0') << QLatin1String("next:") << next->d_func()->focusNext->data(0) << QLatin1String("prev:") << next->d_func()->focusPrev->data(0);
if (visited.contains(next)) {
qWarning("Already visited this node. However, I expected to dump until I found myself.");
break;

View File

@ -783,11 +783,11 @@ void QGridLayoutRowInfo::dump(int indent) const
QString message;
if (stretches.value(i).value() >= 0)
message += QString::fromAscii(" stretch %1").arg(stretches.value(i).value());
message += QString::fromLatin1(" stretch %1").arg(stretches.value(i).value());
if (spacings.value(i).value() >= 0.0)
message += QString::fromAscii(" spacing %1").arg(spacings.value(i).value());
message += QString::fromLatin1(" spacing %1").arg(spacings.value(i).value());
if (alignments.value(i) != 0)
message += QString::fromAscii(" alignment %1").arg(int(alignments.value(i)), 16);
message += QString::fromLatin1(" alignment %1").arg(int(alignments.value(i)), 16);
if (!message.isEmpty() || boxes.value(i) != QGridLayoutBox()) {
qDebug("%*s Row %d:%s", indent, "", i, qPrintable(message));

View File

@ -356,14 +356,14 @@ void QSimplex::dumpMatrix()
QString str(QLatin1String(" "));
for (int j = 0; j < columns; ++j)
str += QString::fromAscii(" <%1 >").arg(j, 2);
str += QString::fromLatin1(" <%1 >").arg(j, 2);
qDebug("%s", qPrintable(str));
for (int i = 0; i < rows; ++i) {
str = QString::fromAscii("Row %1:").arg(i, 2);
str = QString::fromLatin1("Row %1:").arg(i, 2);
qreal *row = matrix + i * columns;
for (int j = 0; j < columns; ++j)
str += QString::fromAscii("%1").arg(row[j], 7, 'f', 2);
str += QString::fromLatin1("%1").arg(row[j], 7, 'f', 2);
qDebug("%s", qPrintable(str));
}
qDebug("------------------------\n");

View File

@ -123,22 +123,22 @@ struct QSimplexConstraint
#ifdef QT_DEBUG
QString toString() {
QString result;
result += QString::fromAscii("-- QSimplexConstraint %1 --").arg(quintptr(this), 0, 16);
result += QString::fromLatin1("-- QSimplexConstraint %1 --").arg(quintptr(this), 0, 16);
QHash<QSimplexVariable *, qreal>::const_iterator iter;
for (iter = variables.constBegin(); iter != variables.constEnd(); ++iter) {
result += QString::fromAscii(" %1 x %2").arg(iter.value()).arg(quintptr(iter.key()), 0, 16);
result += QString::fromLatin1(" %1 x %2").arg(iter.value()).arg(quintptr(iter.key()), 0, 16);
}
switch (ratio) {
case LessOrEqual:
result += QString::fromAscii(" (less) <= %1").arg(constant);
result += QString::fromLatin1(" (less) <= %1").arg(constant);
break;
case MoreOrEqual:
result += QString::fromAscii(" (more) >= %1").arg(constant);
result += QString::fromLatin1(" (more) >= %1").arg(constant);
break;
default:
result += QString::fromAscii(" (eqal) == %1").arg(constant);
result += QString::fromLatin1(" (eqal) == %1").arg(constant);
}
return result;

View File

@ -691,7 +691,7 @@ static QList<QVariant> subControlLayout(const QString& layout)
{
QList<QVariant> buttons;
for (int i = 0; i < layout.count(); i++) {
int button = layout[i].toAscii();
int button = layout[i].toLatin1();
switch (button) {
case 'm':
buttons.append(PseudoElement_MdiMinButton);

View File

@ -2028,8 +2028,8 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
switch (arg2.type()) {
case QVariant::Date:
Q_ASSERT_X(arg1.type() == QVariant::Date, "QAbstractSpinBoxPrivate::variantCompare",
qPrintable(QString::fromAscii("Internal error 1 (%1)").
arg(QString::fromAscii(arg1.typeName()))));
qPrintable(QString::fromLatin1("Internal error 1 (%1)").
arg(QString::fromLatin1(arg1.typeName()))));
if (arg1.toDate() == arg2.toDate()) {
return 0;
} else if (arg1.toDate() < arg2.toDate()) {
@ -2039,8 +2039,8 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
}
case QVariant::Time:
Q_ASSERT_X(arg1.type() == QVariant::Time, "QAbstractSpinBoxPrivate::variantCompare",
qPrintable(QString::fromAscii("Internal error 2 (%1)").
arg(QString::fromAscii(arg1.typeName()))));
qPrintable(QString::fromLatin1("Internal error 2 (%1)").
arg(QString::fromLatin1(arg1.typeName()))));
if (arg1.toTime() == arg2.toTime()) {
return 0;
} else if (arg1.toTime() < arg2.toTime()) {
@ -2079,9 +2079,9 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
return 0;
default:
Q_ASSERT_X(0, "QAbstractSpinBoxPrivate::variantCompare",
qPrintable(QString::fromAscii("Internal error 3 (%1 %2)").
arg(QString::fromAscii(arg1.typeName())).
arg(QString::fromAscii(arg2.typeName()))));
qPrintable(QString::fromLatin1("Internal error 3 (%1 %2)").
arg(QString::fromLatin1(arg1.typeName())).
arg(QString::fromLatin1(arg2.typeName()))));
}
return -2;
}

View File

@ -2208,7 +2208,7 @@ void QDateTimeEditPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos
currentSectionIndex = s;
Q_ASSERT_X(currentSectionIndex < sectionNodes.size(),
"QDateTimeEditPrivate::_q_editorCursorPositionChanged()",
qPrintable(QString::fromAscii("Internal error (%1 %2)").
qPrintable(QString::fromLatin1("Internal error (%1 %2)").
arg(currentSectionIndex).
arg(sectionNodes.size())));

View File

@ -1702,7 +1702,7 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter)
line.replace(QLatin1Char(' '), QString());
line = line.toUpper();
splitter.restoreState(line.toAscii());
splitter.restoreState(line.toLatin1());
return ts;
}

View File

@ -504,7 +504,7 @@ void tst_QFiledialog::completer()
// press 'keys' for the input
for (int i = 0; i < input.count(); ++i)
QTest::keyPress(lineEdit, input[i].toAscii());
QTest::keyPress(lineEdit, input[i].toLatin1());
QStringList expectedFiles;
if (expected == -1) {

View File

@ -568,7 +568,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
// - No another dir with same start
QString testDir;
foreach (const QString &entry, entryList) {
if (entry.size() > 5 && QString(entry.toAscii()).compare(entry) == 0) {
if (entry.size() > 5 && QString(entry.toLatin1()).compare(entry) == 0) {
bool invalid = false;
for (int i = 0; i < 5; i++) {
if (!entry.at(i).isLetter()) {
@ -605,7 +605,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
//I love testlib :D
for (int i = 0; i < 5; i++)
QTest::keyClick(edit, testDir.at(i).toLower().toAscii() - 'a' + Qt::Key_A);
QTest::keyClick(edit, testDir.at(i).toLower().toLatin1() - 'a' + Qt::Key_A);
#else
QTest::keyClick(edit, Qt::Key_E);
QTest::keyClick(edit, Qt::Key_T);

View File

@ -110,7 +110,7 @@ void testTypingValue(
sbox->selectAll();
for (int i = 0; i < value.size(); ++i) {
const QChar valChar = value[i];
_keyClick(static_cast<QWidget *>(sbox), valChar.toAscii()); // ### always guaranteed to work?
_keyClick(static_cast<QWidget *>(sbox), valChar.toLatin1()); // ### always guaranteed to work?
if (sbox->hasAcceptableInput())
QVERIFY(okButton->isEnabled());
else
@ -123,7 +123,7 @@ void testTypingValue(QLineEdit *ledit, QPushButton *okButton, const QString &val
ledit->selectAll();
for (int i = 0; i < value.size(); ++i) {
const QChar valChar = value[i];
_keyClick(ledit, valChar.toAscii()); // ### always guaranteed to work?
_keyClick(ledit, valChar.toLatin1()); // ### always guaranteed to work?
QVERIFY(ledit->hasAcceptableInput());
QVERIFY(okButton->isEnabled());
}

View File

@ -167,7 +167,7 @@ public:
{
setContentsMargins( 0,0,0,0 );
if (name.isEmpty())
setData(0, QString::fromAscii("w%1").arg(quintptr(this)));
setData(0, QString::fromLatin1("w%1").arg(quintptr(this)));
else
setData(0, name);
}
@ -1711,7 +1711,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
// Create dummy widgets
QList<QGraphicsWidget *> widgets;
for (int i = 0; i < widgetCount; ++i) {
TestWidget *w = new TestWidget(0, QString::fromAscii("W%1").arg(i));
TestWidget *w = new TestWidget(0, QString::fromLatin1("W%1").arg(i));
widgets << w;
}

View File

@ -458,7 +458,7 @@ void tst_QGraphicsGridLayout::addItem_data()
int column = b;
int rowSpan = c;
int columnSpan = d;
QString name = QString::fromAscii("(%1,%2,%3,%4").arg(a).arg(b).arg(c).arg(d);
QString name = QString::fromLatin1("(%1,%2,%3,%4").arg(a).arg(b).arg(c).arg(d);
Qt::Alignment alignment = Qt::AlignLeft;
QTest::newRow(name.toLatin1()) << row << column << rowSpan << columnSpan << alignment;
}}}}
@ -1114,7 +1114,7 @@ void tst_QGraphicsGridLayout::itemAt()
if (i >= 0 && i < layout->count()) {
QVERIFY(layout->itemAt(i));
} else {
QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::itemAt: invalid index %1").arg(i).toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::itemAt: invalid index %1").arg(i).toLatin1().constData());
QCOMPARE(layout->itemAt(i), static_cast<QGraphicsLayoutItem*>(0));
}
}
@ -1146,7 +1146,7 @@ void tst_QGraphicsGridLayout::removeAt()
layout->removeAt(0);
QCOMPARE(item0->parentLayoutItem(), static_cast<QGraphicsLayoutItem *>(0));
QCOMPARE(layout->count(), 0);
QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::removeAt: invalid index 0").toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::removeAt: invalid index 0").toLatin1().constData());
layout->removeAt(0);
QCOMPARE(layout->count(), 0);
delete widget;
@ -1169,11 +1169,11 @@ void tst_QGraphicsGridLayout::removeItem()
QCOMPARE(l->count(), 4);
// Avoid crashing. Note that the warning message might change in the future.
QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
l->removeItem(0);
QCOMPARE(l->count(), 4);
QTest::ignoreMessage(QtWarningMsg, QString::fromAscii("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::removeAt: invalid index -1").toLatin1().constData());
l->removeItem(new QGraphicsWidget);
QCOMPARE(l->count(), 4);
}

View File

@ -1515,7 +1515,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
for (i = 1; i < 4; ++i) {
QGraphicsWidget *wid = new QGraphicsWidget;
wid->setFocusPolicy(Qt::StrongFocus);
wid->setData(0, QString::fromAscii("w%1").arg(i));
wid->setData(0, QString::fromLatin1("w%1").arg(i));
scene.addItem(wid);
if (i == 1)
w1 = wid;
@ -1555,7 +1555,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
for (i = 1; i < 5; ++i) {
QGraphicsWidget *wid = new QGraphicsWidget;
wid->setFocusPolicy(Qt::StrongFocus);
wid->setData(0, QString::fromAscii("w%1").arg(i));
wid->setData(0, QString::fromLatin1("w%1").arg(i));
scene.addItem(wid);
if (i == 1)
w1 = wid;

View File

@ -1545,7 +1545,7 @@ public:
return QVariant();
}
if (role == Qt::DisplayRole) {
return QString::fromAscii("%1,%2").arg(index.row()).arg(index.column());
return QString::fromLatin1("%1,%2").arg(index.row()).arg(index.column());
}
return QVariant();
}

View File

@ -1277,7 +1277,7 @@ void tst_QListView::scrollBarRanges()
QStringListModel model(&lv);
QStringList list;
for (int i = 0; i < rowCount; ++i)
list << QString::fromAscii("Item %1").arg(i);
list << QString::fromLatin1("Item %1").arg(i);
model.setStringList(list);
lv.setModel(&model);
@ -1375,7 +1375,7 @@ void tst_QListView::scrollBarAsNeeded()
QStringList list;
int i;
for (i = 0; i < rowCounts[r]; ++i)
list << QString::fromAscii("Item %1").arg(i);
list << QString::fromLatin1("Item %1").arg(i);
model.setStringList(list);
QApplication::processEvents();
@ -1383,7 +1383,7 @@ void tst_QListView::scrollBarAsNeeded()
QStringList replacement;
for (i = 0; i < itemCount; ++i) {
replacement << QString::fromAscii("Item %1").arg(i);
replacement << QString::fromLatin1("Item %1").arg(i);
}
model.setStringList(replacement);
@ -2059,7 +2059,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout()
QListWidgetItem *item = new QListWidgetItem();
item->setText(QString("Item %L1").arg(i));
lw.addItem(item);
if (!item->text().contains(QString::fromAscii("1")))
if (!item->text().contains(QString::fromLatin1("1")))
item->setHidden(true);
}
lw.show();

View File

@ -2127,12 +2127,12 @@ void tst_QTreeView::resizeColumnToContents()
for (int r = 0; r < model.rowCount(); ++r) {
for (int c = 0; c < model.columnCount(); ++c) {
QModelIndex idx = model.index(r, c);
model.setData(idx, QString::fromAscii("%1,%2").arg(r).arg(c) );
model.setData(idx, QString::fromLatin1("%1,%2").arg(r).arg(c) );
model.insertColumns(0, 2, idx);
model.insertRows(0, 6, idx);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 2 ; ++j) {
model.setData(model.index(i, j, idx), QString::fromAscii("child%1%2").arg(i).arg(j));
model.setData(model.index(i, j, idx), QString::fromLatin1("child%1%2").arg(i).arg(j));
}
}
}

View File

@ -540,7 +540,7 @@ public:
}
private:
void init(int numPixels = -1){
setText(QString::fromAscii("(%1,%2)").arg(sh.width()).arg(sh.height()));
setText(QString::fromLatin1("(%1,%2)").arg(sh.width()).arg(sh.height()));
setFrameStyle(QFrame::Box | QFrame::Plain);
setNumberOfPixels(numPixels);
}
@ -797,12 +797,12 @@ void tst_QGridLayout::minMaxSize_data()
<< SizeInfo(QPoint(10, 10), QSize( 90, 90), QSize(100,100))
<< SizeInfo(QPoint(10 + 100 + 1, 10), QSize( 90, 90))
);
QTest::newRow("2x1 grid, extend to minimumSize, motif") << QString::fromAscii("motif") << 2 << 1
QTest::newRow("2x1 grid, extend to minimumSize, motif") << QString::fromLatin1("motif") << 2 << 1
<< int(QSizePolicy::Preferred) << QSize() << (SizeInfoList()
<< SizeInfo(QPoint(11, 11), QSize( 90, 90), QSize(100,100))
<< SizeInfo(QPoint(11 + 100 + 6, 11), QSize( 90, 90))
);
QTest::newRow("2x1 grid, extend to minimumSize, windows") << QString::fromAscii("windows") << 2 << 1
QTest::newRow("2x1 grid, extend to minimumSize, windows") << QString::fromLatin1("windows") << 2 << 1
<< int(QSizePolicy::Preferred) << QSize() << (SizeInfoList()
<< SizeInfo(QPoint(11, 11), QSize( 90, 90), QSize(100,100))
<< SizeInfo(QPoint(11 + 100 + 6, 11), QSize( 90, 90))
@ -1430,7 +1430,7 @@ void tst_QGridLayout::layoutSpacingImplementation_data()
w->setLayout(layout);
int pw = up->sizeHint().width();
int ph = up->sizeHint().height();
QByteArray testName = QString::fromAscii("arrowpad with %1 empty rows, %2 empty columns").arg(yoff).arg(xoff).toLatin1();
QByteArray testName = QString::fromLatin1("arrowpad with %1 empty rows, %2 empty columns").arg(yoff).arg(xoff).toLatin1();
QTest::newRow(testName.data())
<< w << (PointList()
<< QPoint(0 + pw + 5, 3)

View File

@ -1204,25 +1204,25 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2
k4 &= ~Qt::MODIFIER_MASK;
if (k1 || c1.toAscii()) {
if (k1 || c1.toLatin1()) {
QString c(c1.unicode() == QChar::Null ? QString() : QString(c1));
QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k1), c, b1);
QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k1), c, b1);
}
if (k2 || c2.toAscii()) {
if (k2 || c2.toLatin1()) {
QString c(c2.unicode() == QChar::Null ? QString() : QString(c2));
QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k2), c, b2);
QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k2), c, b2);
}
if (k3 || c3.toAscii()) {
if (k3 || c3.toLatin1()) {
QString c(c3.unicode() == QChar::Null ? QString() : QString(c3));
QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k3), c, b3);
QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k3), c, b3);
}
if (k4 || c4.toAscii()) {
if (k4 || c4.toLatin1()) {
QString c(c4.unicode() == QChar::Null ? QString() : QString(c4));
QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k4), c, b4);
QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k4), c, b4);

View File

@ -4332,7 +4332,7 @@ void tst_QWidget::setWindowGeometry_data()
.arg(rect.y())
.arg(rect.width())
.arg(rect.height())
.arg(windowFlag, 0, 16).toAscii())
.arg(windowFlag, 0, 16).toLatin1())
<< l
<< windowFlag;
}

View File

@ -266,7 +266,7 @@ retry:
for (int i = 0; i < step.length(); i++) {
int row = completer->currentRow();
switch (step[i].toUpper().toAscii()) {
switch (step[i].toUpper().toLatin1()) {
case 'P': --row; break;
case 'N': ++row; break;
case 'L': row = completer->completionCount() - 1; break;

View File

@ -1271,7 +1271,7 @@ void tst_QComboBox::insertOnCurrentIndex()
testWidget->addItem("first item");
testWidget->setCurrentIndex(0);
testWidget->insertItem(0, "second item");
QCOMPARE(testWidget->lineEdit()->text(), QString::fromAscii("first item"));
QCOMPARE(testWidget->lineEdit()->text(), QString::fromLatin1("first item"));
}
void tst_QComboBox::textpixmapdata_data()
@ -1669,33 +1669,33 @@ void tst_QComboBox::flaggedItems_data()
KeyList keyMovementList;
keyMovementList << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down;
QTest::newRow(testCase.toAscii() + "normal") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
QTest::newRow(testCase.toLatin1() + "normal") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
deselectFlagList.clear();
disableFlagList.clear();
deselectFlagList << 1 << 3;
QTest::newRow(testCase.toAscii() + "non-selectable") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
QTest::newRow(testCase.toLatin1() + "non-selectable") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
deselectFlagList.clear();
disableFlagList.clear();
disableFlagList << 2;
QTest::newRow(testCase.toAscii() + "disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 5;
QTest::newRow(testCase.toLatin1() + "disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 5;
deselectFlagList.clear();
disableFlagList.clear();
deselectFlagList << 1 << 3;
disableFlagList << 2 << 3;
QTest::newRow(testCase.toAscii() + "mixed") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 6;
QTest::newRow(testCase.toLatin1() + "mixed") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 6;
deselectFlagList.clear();
disableFlagList.clear();
disableFlagList << 0 << 1 << 2 << 3 << 4 << 5 << 6;
QTest::newRow(testCase.toAscii() + "nearly-empty") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 7;
QTest::newRow(testCase.toLatin1() + "nearly-empty") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 7;
deselectFlagList.clear();
disableFlagList.clear();
disableFlagList << 0 << 1 << 2 << 3 << 5 << 6 << 7;
keyMovementList.clear();
QTest::newRow(testCase.toAscii() + "only one enabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
QTest::newRow(testCase.toLatin1() + "only one enabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
if (!editable) {
deselectFlagList.clear();
@ -1703,38 +1703,38 @@ void tst_QComboBox::flaggedItems_data()
keyMovementList.clear();
disableFlagList << 0 << 2 << 3;
keyMovementList << Qt::Key_Down << Qt::Key_Home;
QTest::newRow(testCase.toAscii() + "home-disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 1;
QTest::newRow(testCase.toLatin1() + "home-disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 1;
keyMovementList.clear();
keyMovementList << Qt::Key_End;
QTest::newRow(testCase.toAscii() + "end-key") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 7;
QTest::newRow(testCase.toLatin1() + "end-key") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 7;
disableFlagList.clear();
disableFlagList << 1 ;
keyMovementList << Qt::Key_T;
QTest::newRow(testCase.toAscii() + "keyboard-search") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
QTest::newRow(testCase.toLatin1() + "keyboard-search") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
itemList << "nine" << "ten";
keyMovementList << Qt::Key_T;
QTest::newRow(testCase.toAscii() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 9;
QTest::newRow(testCase.toLatin1() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 9;
keyMovementList.clear();
keyMovementList << Qt::Key_T << Qt::Key_H;
QTest::newRow(testCase.toAscii() + "keyboard search item") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
QTest::newRow(testCase.toLatin1() + "keyboard search item") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
disableFlagList.clear();
disableFlagList << 1 << 3 << 5 << 7 << 9;
keyMovementList.clear();
keyMovementList << Qt::Key_End << Qt::Key_Up << Qt::Key_Up << Qt::Key_PageDown << Qt::Key_PageUp << Qt::Key_PageUp << Qt::Key_Down;
QTest::newRow(testCase.toAscii() + "all key combinations") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
QTest::newRow(testCase.toLatin1() + "all key combinations") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 4;
} else {
deselectFlagList.clear();
disableFlagList.clear();
disableFlagList << 1;
keyMovementList.clear();
keyMovementList << Qt::Key_T << Qt::Key_Enter;
QTest::newRow(testCase.toAscii() + "disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
QTest::newRow(testCase.toAscii() + "broken autocompletion") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
QTest::newRow(testCase.toLatin1() + "disabled") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
QTest::newRow(testCase.toLatin1() + "broken autocompletion") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
}
}
}

View File

@ -980,7 +980,7 @@ void tst_QMenuBar::check_altPress()
{
if ( !qApp->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation) ) {
QSKIP( QString( "this is not supposed to work in the %1 style. Skipping." ).
arg( qApp->style()->objectName() ).toAscii());
arg( qApp->style()->objectName() ).toLatin1());
}
initSimpleMenubar();

View File

@ -345,7 +345,7 @@ void tst_QPlainTextEdit::selectAllSetsNotSelection()
ed->insertPlainText("Hello World");
ed->selectAll();
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromAscii("foobar"));
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromLatin1("foobar"));
}
#endif

View File

@ -561,37 +561,37 @@ void tst_QPushButton::sizeHint_data()
{
QTest::addColumn<QString>("stylename");
#if !defined(QT_NO_STYLE_MOTIF)
QTest::newRow("motif") << QString::fromAscii("motif");
QTest::newRow("motif") << QString::fromLatin1("motif");
#endif
#if !defined(QT_NO_STYLE_CDE)
QTest::newRow("cde") << QString::fromAscii("cde");
QTest::newRow("cde") << QString::fromLatin1("cde");
#endif
#if !defined(QT_NO_STYLE_WINDOWS)
QTest::newRow("windows") << QString::fromAscii("windows");
QTest::newRow("windows") << QString::fromLatin1("windows");
#endif
#if !defined(QT_NO_STYLE_CLEANLOOKS)
QTest::newRow("cleanlooks") << QString::fromAscii("cleanlooks");
QTest::newRow("cleanlooks") << QString::fromLatin1("cleanlooks");
#endif
#if !defined(QT_NO_STYLE_GTK)
QTest::newRow("gtk") << QString::fromAscii("gtk");
QTest::newRow("gtk") << QString::fromLatin1("gtk");
#endif
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
QTest::newRow("mac") << QString::fromAscii("mac");
QTest::newRow("mac") << QString::fromLatin1("mac");
#endif
#if !defined(QT_NO_STYLE_PLASTIQUE)
QTest::newRow("plastique") << QString::fromAscii("plastique");
QTest::newRow("plastique") << QString::fromLatin1("plastique");
#endif
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
QTest::newRow("windowsxp") << QString::fromAscii("windowsxp");
QTest::newRow("windowsxp") << QString::fromLatin1("windowsxp");
#endif
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA)
QTest::newRow("windowsvista") << QString::fromAscii("windowsvista");
QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista");
#endif
#if defined(Q_OS_WINCE) && !defined(QT_NO_STYLE_WINDOWSCE)
QTest::newRow("windowsce") << QString::fromAscii("windowsce");
QTest::newRow("windowsce") << QString::fromLatin1("windowsce");
#endif
#if defined(Q_OS_WINCE_WM) && !defined(QT_NO_STYLE_WINDOWSCE)
QTest::newRow("windowsmobile") << QString::fromAscii("windowsmobile");
QTest::newRow("windowsmobile") << QString::fromLatin1("windowsmobile");
#endif
}

View File

@ -604,7 +604,7 @@ void tst_QTextEdit::selectAllSetsNotSelection()
ed->insertPlainText("Hello World");
ed->selectAll();
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromAscii("foobar"));
QCOMPARE(QApplication::clipboard()->text(QClipboard::Selection), QString::fromLatin1("foobar"));
}
#endif
void tst_QTextEdit::asciiTab()