Complete files
This commit is contained in:
parent
ea91d2b5f1
commit
a009fc3566
6 changed files with 139 additions and 1 deletions
|
|
@ -0,0 +1,30 @@
|
|||
add_executable(kirigami-testing)
|
||||
|
||||
ecm_add_qml_module(kirigami-testing
|
||||
URI
|
||||
xyz.toast003.kirigamiTesting
|
||||
)
|
||||
|
||||
target_sources(kirigami-testing
|
||||
PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
|
||||
ecm_target_qml_sources(kirigami-testing
|
||||
SOURCES
|
||||
Main.qml
|
||||
)
|
||||
|
||||
target_link_libraries(kirigami-testing
|
||||
PRIVATE
|
||||
Qt6::Quick
|
||||
Qt6::Qml
|
||||
Qt6::Gui
|
||||
Qt6::QuickControls2
|
||||
Qt6::Widgets
|
||||
KF6::I18n
|
||||
KF6::CoreAddons
|
||||
KF6::IconThemes
|
||||
)
|
||||
|
||||
install(TARGETS kirigami-testing ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
29
src/Main.qml
29
src/Main.qml
|
|
@ -0,0 +1,29 @@
|
|||
// Includes relevant modules used by the QML
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Controls
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
// Provides basic features needed for all kirigami applications
|
||||
Kirigami.ApplicationWindow {
|
||||
// Unique identifier to reference this object
|
||||
id: root
|
||||
|
||||
width: 400
|
||||
height: 300
|
||||
|
||||
// Window title
|
||||
// i18nc() makes a string translatable
|
||||
// and provides additional context for the translators
|
||||
title: i18nc("@title:window", "Hello World")
|
||||
|
||||
// Set the first page that will be loaded when the app opens
|
||||
// This can also be set to an id of a Kirigami.Page
|
||||
pageStack.initialPage: Kirigami.Page {
|
||||
Controls.Label {
|
||||
// Center label horizontally and vertically within parent object
|
||||
anchors.centerIn: parent
|
||||
text: i18n("Hello from kirigami!")
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/main.cpp
35
src/main.cpp
|
|
@ -0,0 +1,35 @@
|
|||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QtQml>
|
||||
#include <QUrl>
|
||||
#include <QQuickStyle>
|
||||
#include <KLocalizedContext>
|
||||
#include <KLocalizedString>
|
||||
#include <KIconTheme>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KIconTheme::initTheme();
|
||||
QApplication app(argc, argv);
|
||||
KLocalizedString::setApplicationDomain("kirigami-testing");
|
||||
QApplication::setOrganizationName(QStringLiteral("Toast"));
|
||||
QApplication::setOrganizationDomain(QStringLiteral("toast003.xyz"));
|
||||
QApplication::setApplicationName(QStringLiteral("Kirigami Testing"));
|
||||
QApplication::setDesktopFileName(QStringLiteral("xyz.toast003.kirigami-testing.desktop"));
|
||||
|
||||
QApplication::setStyle(QStringLiteral("breeze"));
|
||||
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
||||
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
|
||||
}
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
engine.loadFromModule("xyz.toast003.kirigamiTesting", "Main");
|
||||
|
||||
if (engine.rootObjects().isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue