本文整理汇总了C++中QSourceLocation::setUri方法的典型用法代码示例。如果您正苦于以下问题:C++ QSourceLocation::setUri方法的具体用法?C++ QSourceLocation::setUri怎么用?C++ QSourceLocation::setUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSourceLocation
的用法示例。
在下文中一共展示了QSourceLocation::setUri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equalnessOperator_data
void tst_QSourceLocation::equalnessOperator_data() const
{
QTest::addColumn<QSourceLocation>("v1");
QTest::addColumn<QSourceLocation>("v2");
QTest::addColumn<bool>("True");
{
QTest::newRow("Default constructed values")
<< QSourceLocation()
<< QSourceLocation()
<< true;
}
{
QSourceLocation modified;
modified.setColumn(4);
QTest::newRow("Default constructed, against column-modified")
<< QSourceLocation()
<< modified
<< false;
}
{
QSourceLocation modified;
modified.setLine(5);
QTest::newRow("Default constructed, against line-modified")
<< QSourceLocation()
<< modified
<< false;
}
{
QSourceLocation modified;
modified.setUri(QUrl(QLatin1String("http://example.com/")));
QTest::newRow("Default constructed, against line-modified")
<< QSourceLocation()
<< modified
<< false;
}
{
QSourceLocation modified;
modified.setUri(QUrl(QLatin1String("http://example.com/")));
modified.setLine(5);
modified.setColumn(4);
QTest::newRow("Default constructed, against all-modified")
<< QSourceLocation()
<< modified
<< false;
}
}
示例2: assignmentOperator
void tst_QSourceLocation::assignmentOperator() const
{
/* Assign to self. */
{
QSourceLocation def;
def = def;
QVERIFY(def.isNull());
QCOMPARE(def.line(), qint64(-1));
QCOMPARE(def.column(), qint64(-1));
QCOMPARE(def.uri(), QUrl());
}
/* Assign to default constructed object. */
{
QSourceLocation val;
val.setLine(3);
val.setColumn(4);
val.setUri(QUrl(QLatin1String("http://example.com/2")));
QSourceLocation assigned;
assigned = val;
QCOMPARE(assigned.line(), qint64(3));
QCOMPARE(assigned.column(), qint64(4));
QCOMPARE(assigned.uri(), QUrl(QLatin1String("http://example.com/2")));
}
/* Assign to modified object. */
{
QSourceLocation val;
val.setLine(3);
val.setColumn(4);
val.setUri(QUrl(QLatin1String("http://example.com/2")));
QSourceLocation assigned;
assigned.setLine(700);
assigned.setColumn(4000);
assigned.setUri(QUrl(QLatin1String("http://example.com/3")));
assigned = val;
QCOMPARE(assigned.line(), qint64(3));
QCOMPARE(assigned.column(), qint64(4));
QCOMPARE(assigned.uri(), QUrl(QLatin1String("http://example.com/2")));
}
}
示例3: copyConstructor
void tst_QSourceLocation::copyConstructor() const
{
{
QSourceLocation def;
QSourceLocation copy(def);
QCOMPARE(def.line(), qint64(-1));
QCOMPARE(def.column(), qint64(-1));
QCOMPARE(def.uri(), QUrl());
}
{
QSourceLocation val;
val.setLine(5);
val.setColumn(600);
val.setUri(QUrl(QLatin1String("http://example.com/")));
QSourceLocation copy(val);
QCOMPARE(copy.line(), qint64(5));
QCOMPARE(copy.column(), qint64(600));
QCOMPARE(copy.uri(), QUrl(QLatin1String("http://example.com/")));
}
{
/* Construct from a const object. */
const QSourceLocation val;
const QSourceLocation val2(val);
QCOMPARE(val, val2);
}
}
示例4: setUri
void tst_QSourceLocation::setUri() const
{
QSourceLocation sl;
sl.setUri(QUrl(QLatin1String("http://example.com/")));
QCOMPARE(sl.uri(), QUrl(QLatin1String("http://example.com/")));
}