Complete files
This commit is contained in:
parent
ea91d2b5f1
commit
a009fc3566
6 changed files with 139 additions and 1 deletions
|
|
@ -0,0 +1,36 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
project(kirigami-testing)
|
||||
|
||||
find_package(ECM 6.0.0 REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
include(ECMFindQmlModule)
|
||||
include(ECMQmlModule)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS
|
||||
Core
|
||||
Quick
|
||||
Test
|
||||
Gui
|
||||
QuickControls2
|
||||
Widgets
|
||||
)
|
||||
|
||||
find_package(KF6 REQUIRED COMPONENTS
|
||||
Kirigami
|
||||
I18n
|
||||
CoreAddons
|
||||
QQC2DesktopStyle
|
||||
IconThemes
|
||||
)
|
||||
|
||||
ecm_find_qmlmodule(org.kde.kirigami)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
install(PROGRAMS xyz.toast003.kirigami-testing.desktop DESTINATION ${KDE_INSTALL_APPDIR})
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
lib = nixpkgs.lib;
|
||||
in
|
||||
{
|
||||
devShells.x86_64-linux.default = pkgs.mkShellNoCC {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
name = "kirigami-devshell";
|
||||
packages =
|
||||
let
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[Desktop Entry]
|
||||
Name=Kirigami testing
|
||||
Name[es]=Prueba de kirigami
|
||||
Exec=kirigami-testing
|
||||
Icon=kde
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Categories=Utility
|
||||
Loading…
Add table
Add a link
Reference in a new issue