| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2023~2023 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
* |
| 6 |
*/ |
| 7 |
#include <QGuiApplication> |
| 8 |
#include <iostream> |
| 9 |
#include <private/qguiapplication_p.h> |
| 10 |
#include <qpa/qplatforminputcontext.h> |
| 11 |
#include <qpa/qplatforminputcontextfactory_p.h> |
| 12 |
#include <qpa/qplatformintegration.h> |
| 13 |
|
| 14 |
int main(int argc, char *argv[]) { |
| 15 |
QGuiApplication app(argc, argv); |
| 16 |
std::cout << "QT_QPA_PLATFORM=" << app.platformName().toStdString() |
| 17 |
<< std::endl; |
| 18 |
// This should work regardless QPlatformInputContextFactory::requested |
| 19 |
// returns QString or QStringList |
| 20 |
QStringList immodules{QPlatformInputContextFactory::requested()}; |
| 21 |
if (immodules.size() > 1) { |
| 22 |
std::cout << "QT_IM_MODULES=\"" << immodules.join(";").toStdString() |
| 23 |
<< "\"" << std::endl; |
| 24 |
} else if (immodules.size() == 1) { |
| 25 |
std::cout << "QT_IM_MODULE=" << immodules[0].toStdString() << std::endl; |
| 26 |
} else { |
| 27 |
std::cout << "QT_IM_MODULE=" << std::endl; |
| 28 |
} |
| 29 |
auto inputContext = |
| 30 |
QGuiApplicationPrivate::platformIntegration()->inputContext(); |
| 31 |
std::cout << "IM_MODULE_CLASSNAME="; |
| 32 |
if (inputContext) { |
| 33 |
std::cout << inputContext->metaObject()->className(); |
| 34 |
} |
| 35 |
std::cout << std::endl; |
| 36 |
return 0; |
| 37 |
} |