Add a basic Kirigami application
This commit is contained in:
parent
e64edc5c5a
commit
c9b7d9bd1b
5 changed files with 67 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(KMessageBox)
|
||||
add_subdirectory(TextEditor)
|
||||
add_subdirectory(KirigamiHelloWorld)
|
||||
|
|
19
src/KirigamiHelloWorld/CMakeLists.txt
Normal file
19
src/KirigamiHelloWorld/CMakeLists.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
|
||||
Quick
|
||||
QuickControls2
|
||||
)
|
||||
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
Kirigami2
|
||||
)
|
||||
|
||||
add_executable(KirigamiHelloWorld main.cc resources.qrc)
|
||||
target_link_libraries(KirigamiHelloWorld
|
||||
Qt5::Quick
|
||||
Qt5::Qml
|
||||
Qt5::Gui
|
||||
Qt5::QuickControls2
|
||||
Qt5::Widgets
|
||||
KF5::Kirigami2
|
||||
KF5::I18n
|
||||
)
|
26
src/KirigamiHelloWorld/main.cc
Normal file
26
src/KirigamiHelloWorld/main.cc
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <KLocalizedContext>
|
||||
#include <KLocalizedString>
|
||||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QUrl>
|
||||
#include <QtQml>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
KLocalizedString::setApplicationDomain("KirigamiHelloWorld");
|
||||
QCoreApplication::setOrganizationName("Fries");
|
||||
QCoreApplication::setOrganizationName("fries.gay");
|
||||
QCoreApplication::setApplicationName("HelloWorld");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
|
||||
if (engine.rootObjects().isEmpty())
|
||||
return -1;
|
||||
|
||||
return app.exec();
|
||||
}
|
5
src/KirigamiHelloWorld/resources.qrc
Normal file
5
src/KirigamiHelloWorld/resources.qrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="main.qml">ui/main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
16
src/KirigamiHelloWorld/ui/main.qml
Normal file
16
src/KirigamiHelloWorld/ui/main.qml
Normal file
|
@ -0,0 +1,16 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as Controls
|
||||
import QtQuick.Layouts 1.15
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: root
|
||||
|
||||
title: i18nc("@title:window", "HelloWorld")
|
||||
pageStack.initialPage: Kirigami.Page {
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: i18n("Meow!")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue