本文整理汇总了C++中poppler::Document::hasOptionalContent方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::hasOptionalContent方法的具体用法?C++ Document::hasOptionalContent怎么用?C++ Document::hasOptionalContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poppler::Document
的用法示例。
在下文中一共展示了Document::hasOptionalContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkNestedLayers
void TestOptionalContent::checkNestedLayers()
{
Poppler::Document *doc;
doc = Poppler::Document::load(TESTDATADIR "/unittestcases/NestedLayers.pdf");
QVERIFY( doc );
QVERIFY( doc->hasOptionalContent() );
Poppler::OptContentModel *optContent = doc->optionalContentModel();
QModelIndex index;
index = optContent->index( 0, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Black Text and Green Snow" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
index = optContent->index( 1, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Mountains and Image" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );
// This is a sub-item of "Mountains and Image"
QModelIndex subindex = optContent->index( 0, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Image" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );
index = optContent->index( 2, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Starburst" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );
index = optContent->index( 3, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Watermark" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
delete doc;
}
示例2: checkNoOptionalContent
void TestOptionalContent::checkNoOptionalContent()
{
Poppler::Document *doc;
doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
QVERIFY( doc );
QCOMPARE( doc->hasOptionalContent(), false );
delete doc;
}
示例3: checkVisPolicy
void TestOptionalContent::checkVisPolicy()
{
Poppler::Document *doc;
doc = Poppler::Document::load(TESTDATADIR "/unittestcases/vis_policy_test.pdf");
QVERIFY( doc );
QVERIFY( doc->hasOptionalContent() );
Poppler::OptContentModel *optContent = doc->optionalContentModel();
QModelIndex index;
index = optContent->index( 0, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "A" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );
index = optContent->index( 1, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "B" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );
delete doc;
}
示例4: checkRadioButtons
void TestOptionalContent::checkRadioButtons()
{
Poppler::Document *doc;
doc = Poppler::Document::load(TESTDATADIR "/unittestcases/ClarityOCGs.pdf");
QVERIFY( doc );
QVERIFY( doc->hasOptionalContent() );
Poppler::OptContentModel *optContent = doc->optionalContentModel();
QModelIndex index;
index = optContent->index( 0, 0, QModelIndex() );
QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Languages" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
// These are sub-items of the "Languages" label
QModelIndex subindex = optContent->index( 0, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "English" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Checked );
subindex = optContent->index( 1, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "French" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 2, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Japanese" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
// RBGroup of languages, so turning on Japanese should turn off English
QVERIFY( optContent->setData( subindex, QVariant( true ), Qt::CheckStateRole ) );
subindex = optContent->index( 0, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "English" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 2, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Japanese" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Checked );
subindex = optContent->index( 1, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "French" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
// and turning on French should turn off Japanese
QVERIFY( optContent->setData( subindex, QVariant( true ), Qt::CheckStateRole ) );
subindex = optContent->index( 0, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "English" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 2, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Japanese" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 1, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "French" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Checked );
// and turning off French should leave them all off
QVERIFY( optContent->setData( subindex, QVariant( false ), Qt::CheckStateRole ) );
subindex = optContent->index( 0, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "English" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 2, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Japanese" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
subindex = optContent->index( 1, 0, index );
QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "French" ) );
QCOMPARE( static_cast<Qt::CheckState>( optContent->data( subindex, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );
delete doc;
}