File indexing completed on 2024-04-21 15:05:25

0001 /*
0002     SPDX-FileCopyrightText: 1996 Bernd Johannes Wuebben <wuebben@math.cornell.edu>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "kfontchooserdialog.h"
0008 
0009 #include <QApplication>
0010 #include <QDebug>
0011 
0012 int main(int argc, char **argv)
0013 {
0014     QApplication::setApplicationName(QStringLiteral("KFontChooserDialogTest"));
0015 
0016     QApplication app(argc, argv);
0017 
0018     QFont font;
0019     // Use a font with an unusual styleName
0020     font.fromString(QStringLiteral("Noto Sans,13,-1,5,87,1,0,0,0,0,Black Italic"));
0021 
0022     qDebug() << "Default use case, all bells and whistles";
0023     int nRet = KFontChooserDialog::getFont(font);
0024     qDebug() << font.toString();
0025 
0026     qDebug() << "Only show monospaced fonts, FixedOnly checkbox is _not_ shown";
0027     nRet = KFontChooserDialog::getFont(font, KFontChooser::FixedFontsOnly);
0028     qDebug() << font.toString();
0029 
0030     KFontChooser::FontDiffFlags diffFlags;
0031     qDebug() << "ShowDifferences mode";
0032     nRet = KFontChooserDialog::getFontDiff(font, diffFlags);
0033     qDebug() << font.toString();
0034 
0035     qDebug() << "ShowDifferences mode and only showing monospaced fonts (the FixedOnly checkbox is _not_ shown)";
0036     nRet = KFontChooserDialog::getFontDiff(font, diffFlags, KFontChooser::FixedFontsOnly);
0037     qDebug() << font.toString();
0038 
0039     return nRet;
0040 }