本文整理汇总了C++中SubQFontComboBox::setCurrentFont方法的典型用法代码示例。如果您正苦于以下问题:C++ SubQFontComboBox::setCurrentFont方法的具体用法?C++ SubQFontComboBox::setCurrentFont怎么用?C++ SubQFontComboBox::setCurrentFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubQFontComboBox
的用法示例。
在下文中一共展示了SubQFontComboBox::setCurrentFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qfontcombobox
void tst_QFontComboBox::qfontcombobox()
{
SubQFontComboBox box;
QCOMPARE(box.currentFont(), QFont());
QCOMPARE(box.fontFilters(), QFontComboBox::AllFonts);
box.setCurrentFont(QFont());
box.setFontFilters(QFontComboBox::AllFonts);
box.setWritingSystem(QFontDatabase::Any);
QVERIFY(box.sizeHint() != QSize());
QCOMPARE(box.writingSystem(), QFontDatabase::Any);
box.call_currentFontChanged(QFont());
QEvent event(QEvent::None);
QCOMPARE(box.call_event(&event), false);
}
示例2: currentFontChanged
// protected void currentFontChanged(QFont const& f)
void tst_QFontComboBox::currentFontChanged()
{
SubQFontComboBox box;
QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont)));
if (box.model()->rowCount() > 2) {
QTest::keyPress(&box, Qt::Key_Down);
QCOMPARE(spy0.count(), 1);
QFont f( "Sans Serif" );
box.setCurrentFont(f);
QCOMPARE(spy0.count(), 2);
} else
qWarning("Not enough fonts installed on test system. Consider adding some");
}
示例3: currentFont
// public QFont currentFont() const
void tst_QFontComboBox::currentFont()
{
QFETCH(QFont, currentFont);
SubQFontComboBox box;
QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont const&)));
QFont oldCurrentFont = box.currentFont();
box.setCurrentFont(currentFont);
QString boxFontFamily = QFontInfo(box.currentFont()).family();
QRegExp foundry(" \\[.*\\]");
if (!currentFont.family().contains(foundry))
boxFontFamily.remove(foundry);
QCOMPARE(boxFontFamily, currentFont.family());
if (oldCurrentFont != box.currentFont()) {
//the signal may be emit twice if there is a foundry into brackets
QVERIFY(spy0.count() >= 1);
}
}