This commit is contained in:
Stefano Moretti 2023-06-29 13:52:51 +02:00
parent 768bb75de4
commit 51e8aad0d9
4 changed files with 15 additions and 31 deletions

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.19)
project(BaseUI VERSION 1.0 LANGUAGES CXX)
include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@ -89,19 +87,6 @@ set_target_properties(baseui PROPERTIES
target_compile_definitions(baseui
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_compile_options(baseui
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wpedantic
>
$<$<CXX_COMPILER_ID:MSVC>:
/W4
>
)
target_link_libraries(baseui
PRIVATE
Qt::Core
@ -110,9 +95,3 @@ target_link_libraries(baseui
Qt::Quick
Qt::QuickControls2
)
install(TARGETS baseui
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
BUNDLE DESTINATION "."
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

View File

@ -13,8 +13,8 @@ UI.App {
property string primary: Material.primary
property string accent: Material.accent
property bool theme: Material.theme === Material.Dark
property string themeStyle: "System"
property bool isDarkTheme: Material.theme === Material.Dark
property string theme: "System"
initialPage: UI.AppStackPage {
id: homePage
@ -196,7 +196,7 @@ UI.App {
UI.SettingsItem {
title: "Theme"
subtitle: root.themeStyle
subtitle: root.theme
onClicked: themeDialog.open()
Layout.fillWidth: true
}
@ -299,13 +299,13 @@ UI.App {
spacing: 0
RadioButton {
checked: modelData === root.themeStyle
checked: modelData === root.theme
text: modelData
Layout.leftMargin: 4
onClicked: {
themeDialog.close()
root.themeStyle = modelData
root.theme = root.Material.theme === Material.Dark
root.theme = modelData
root.isDarkTheme = root.Material.theme === Material.Dark
}
}
}
@ -389,7 +389,7 @@ UI.App {
Component.onCompleted: {
UI.Style.primaryColor = Qt.binding(function() { return root.primary })
UI.Style.accentColor = Qt.binding(function() { return root.accent })
UI.Style.isDarkTheme = Qt.binding(function() { return root.theme })
UI.Style.theme = Qt.binding(function() { return root.themeStyle })
UI.Style.isDarkTheme = Qt.binding(function() { return root.isDarkTheme })
UI.Style.theme = Qt.binding(function() { return root.theme })
}
}

View File

@ -9,6 +9,7 @@ Item {
id: root
property string locale: "en_US"
property bool selected: false
property date selectedDate: new Date()
readonly property int day: selectedDate.getDate()
@ -16,6 +17,8 @@ Item {
readonly property int year: selectedDate.getFullYear()
readonly property string dateString: year + "-" + _zeroPad(month + 1) + "-" + _zeroPad(day)
signal tappedOnADate()
function _zeroPad(n) { return n > 9 ? n : '0' + n }
implicitHeight: column.implicitHeight
@ -113,7 +116,7 @@ Item {
// Important: check the month to avoid clicking on days outside where opacity 0
if (d.getMonth() === monthGrid.month) {
root.selectedDate = d
console.log("tapped on a date ")
root.tappedOnADate()
} else {
console.log("outside valid month " + d.getMonth())
}
@ -123,7 +126,8 @@ Item {
id: dayLabel
readonly property bool selected:
model.day === root.day
root.selected
&& model.day === root.day
&& model.month === root.month
&& model.year === root.year

View File

@ -21,6 +21,7 @@ public:
static void registerIcons(QQmlEngine *engine, const QString &fontPath,
const QString &fontName, const QString &codesPath);
protected:
template <typename DerivedType>
explicit Icons(DerivedType *derived, QObject *parent = nullptr)