本文整理汇总了C++中SubQFontComboBox::setFontFilters方法的典型用法代码示例。如果您正苦于以下问题:C++ SubQFontComboBox::setFontFilters方法的具体用法?C++ SubQFontComboBox::setFontFilters怎么用?C++ SubQFontComboBox::setFontFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubQFontComboBox
的用法示例。
在下文中一共展示了SubQFontComboBox::setFontFilters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fontFilters
// public QFontComboBox::FontFilters fontFilters() const
void tst_QFontComboBox::fontFilters()
{
QFETCH(QFontComboBox::FontFilters, fontFilters);
SubQFontComboBox box;
QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont)));
QFont currentFont = box.currentFont();
box.setFontFilters(fontFilters);
QCOMPARE(box.fontFilters(), fontFilters);
QFontDatabase db;
QStringList list = db.families();
int c = 0;
const int scalableMask = (QFontComboBox::ScalableFonts | QFontComboBox::NonScalableFonts);
const int spacingMask = (QFontComboBox::ProportionalFonts | QFontComboBox::MonospacedFonts);
if((fontFilters & scalableMask) == scalableMask)
fontFilters &= ~scalableMask;
if((fontFilters & spacingMask) == spacingMask)
fontFilters &= ~spacingMask;
for (int i = 0; i < list.count(); ++i) {
if (db.isPrivateFamily(list[i]))
continue;
if (fontFilters & QFontComboBox::ScalableFonts) {
if (!db.isSmoothlyScalable(list[i]))
continue;
} else if (fontFilters & QFontComboBox::NonScalableFonts) {
if (db.isSmoothlyScalable(list[i]))
continue;
}
if (fontFilters & QFontComboBox::MonospacedFonts) {
if (!db.isFixedPitch(list[i]))
continue;
} else if (fontFilters & QFontComboBox::ProportionalFonts) {
if (db.isFixedPitch(list[i]))
continue;
}
c++;
}
QCOMPARE(box.model()->rowCount(), c);
if (c == 0)
QCOMPARE(box.currentFont(), QFont());
QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0);
}