File indexing completed on 2024-04-28 15:19:33
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 0006 */ 0007 0008 #include <QCoreApplication> 0009 #include <QTimer> 0010 #include <QtGlobal> 0011 #include <kconfiggroup.h> 0012 #include <ksharedconfig.h> 0013 #include <stdio.h> 0014 0015 class Tester 0016 { 0017 public: 0018 void initConfig(); 0019 ~Tester(); 0020 }; 0021 0022 void Tester::initConfig() 0023 { 0024 fprintf(stderr, "app Tester\n"); 0025 KConfigGroup group(KSharedConfig::openConfig(), "test"); 0026 group.writeEntry("test", 0); 0027 } 0028 0029 Tester::~Tester() 0030 { 0031 fprintf(stderr, "app ~Tester\n"); 0032 KConfigGroup group(KSharedConfig::openConfig(), "test"); 0033 group.writeEntry("test", 1); 0034 } 0035 0036 Q_GLOBAL_STATIC(Tester, globalTestObject) 0037 0038 int main(int argc, char **argv) 0039 { 0040 qputenv("QT_FATAL_WARNINGS", "1"); 0041 QCoreApplication app(argc, argv); 0042 0043 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0044 0045 Tester *t = globalTestObject(); 0046 t->initConfig(); 0047 0048 QTimer::singleShot(0, qApp, SLOT(quit())); 0049 return app.exec(); 0050 }