File indexing completed on 2024-05-12 05:46:39

0001 /* This file is part of the KDE libraries
0002    Copyright (C) 2013 David Edmundson <davidedmundson@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License version 2 as published by the Free Software Foundation.
0007 
0008    This library is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0011    Library General Public License for more details.
0012 
0013    You should have received a copy of the GNU Library General Public License
0014    along with this library; see the file COPYING.LIB.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #include <QApplication>
0020 #include <QVBoxLayout>
0021 
0022 #include <kfontrequester.h>
0023 
0024 class KFontRequesterTest : public QWidget
0025 {
0026 public:
0027     KFontRequesterTest(QWidget *parent = nullptr)
0028         : QWidget(parent)
0029     {
0030         QVBoxLayout *mainLayout = new QVBoxLayout(this);
0031 
0032         KFontRequester *test1 = new KFontRequester(this);
0033         mainLayout->addWidget(test1);
0034 
0035         KFontRequester *test2 = new KFontRequester(this);
0036         test2->setSampleText(QStringLiteral("This is different sample text"));
0037         test2->setTitle(QStringLiteral("A different title"));
0038         test2->setFont(QFont(QStringLiteral("comic-sans"), 12, 1));
0039 
0040         mainLayout->addWidget(test2);
0041     }
0042 };
0043 
0044 int main(int argc, char **argv)
0045 {
0046     QApplication::setApplicationName(QStringLiteral("kfontrequestertest"));
0047     QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0048     QApplication app(argc, argv);
0049 
0050     KFontRequesterTest *mainWidget = new KFontRequesterTest;
0051     mainWidget->show();
0052 
0053     return app.exec();
0054 }