File: kfontchooserdialogtest.cpp

package info (click to toggle)
kwidgetsaddons 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,836 kB
  • sloc: cpp: 32,526; python: 677; sh: 14; makefile: 7
file content (40 lines) | stat: -rw-r--r-- 1,279 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
    SPDX-FileCopyrightText: 1996 Bernd Johannes Wuebben <wuebben@math.cornell.edu>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "kfontchooserdialog.h"

#include <QApplication>
#include <QDebug>

int main(int argc, char **argv)
{
    QApplication::setApplicationName(QStringLiteral("KFontChooserDialogTest"));

    QApplication app(argc, argv);

    QFont font;
    // Use a font with an unusual styleName
    font.fromString(QStringLiteral("Noto Sans,13,-1,5,87,1,0,0,0,0,Black Italic"));

    qDebug() << "Default use case, all bells and whistles";
    int nRet = KFontChooserDialog::getFont(font);
    qDebug() << font.toString();

    qDebug() << "Only show monospaced fonts, FixedOnly checkbox is _not_ shown";
    nRet = KFontChooserDialog::getFont(font, KFontChooser::FixedFontsOnly);
    qDebug() << font.toString();

    KFontChooser::FontDiffFlags diffFlags;
    qDebug() << "ShowDifferences mode";
    nRet = KFontChooserDialog::getFontDiff(font, diffFlags);
    qDebug() << font.toString();

    qDebug() << "ShowDifferences mode and only showing monospaced fonts (the FixedOnly checkbox is _not_ shown)";
    nRet = KFontChooserDialog::getFontDiff(font, diffFlags, KFontChooser::FixedFontsOnly);
    qDebug() << font.toString();

    return nRet;
}