mirror of
https://github.com/stemoretti/BaseUI.git
synced 2025-05-25 15:20:23 -04:00
Update
This commit is contained in:
parent
768bb75de4
commit
51e8aad0d9
@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.19)
|
|||||||
|
|
||||||
project(BaseUI VERSION 1.0 LANGUAGES CXX)
|
project(BaseUI VERSION 1.0 LANGUAGES CXX)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
@ -89,19 +87,6 @@ set_target_properties(baseui PROPERTIES
|
|||||||
target_compile_definitions(baseui
|
target_compile_definitions(baseui
|
||||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
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
|
target_link_libraries(baseui
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Qt::Core
|
Qt::Core
|
||||||
@ -110,9 +95,3 @@ target_link_libraries(baseui
|
|||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::QuickControls2
|
Qt::QuickControls2
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS baseui
|
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
||||||
BUNDLE DESTINATION "."
|
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
||||||
)
|
|
||||||
|
@ -13,8 +13,8 @@ UI.App {
|
|||||||
|
|
||||||
property string primary: Material.primary
|
property string primary: Material.primary
|
||||||
property string accent: Material.accent
|
property string accent: Material.accent
|
||||||
property bool theme: Material.theme === Material.Dark
|
property bool isDarkTheme: Material.theme === Material.Dark
|
||||||
property string themeStyle: "System"
|
property string theme: "System"
|
||||||
|
|
||||||
initialPage: UI.AppStackPage {
|
initialPage: UI.AppStackPage {
|
||||||
id: homePage
|
id: homePage
|
||||||
@ -196,7 +196,7 @@ UI.App {
|
|||||||
|
|
||||||
UI.SettingsItem {
|
UI.SettingsItem {
|
||||||
title: "Theme"
|
title: "Theme"
|
||||||
subtitle: root.themeStyle
|
subtitle: root.theme
|
||||||
onClicked: themeDialog.open()
|
onClicked: themeDialog.open()
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@ -299,13 +299,13 @@ UI.App {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
checked: modelData === root.themeStyle
|
checked: modelData === root.theme
|
||||||
text: modelData
|
text: modelData
|
||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
onClicked: {
|
onClicked: {
|
||||||
themeDialog.close()
|
themeDialog.close()
|
||||||
root.themeStyle = modelData
|
root.theme = modelData
|
||||||
root.theme = root.Material.theme === Material.Dark
|
root.isDarkTheme = root.Material.theme === Material.Dark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ UI.App {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
UI.Style.primaryColor = Qt.binding(function() { return root.primary })
|
UI.Style.primaryColor = Qt.binding(function() { return root.primary })
|
||||||
UI.Style.accentColor = Qt.binding(function() { return root.accent })
|
UI.Style.accentColor = Qt.binding(function() { return root.accent })
|
||||||
UI.Style.isDarkTheme = Qt.binding(function() { return root.theme })
|
UI.Style.isDarkTheme = Qt.binding(function() { return root.isDarkTheme })
|
||||||
UI.Style.theme = Qt.binding(function() { return root.themeStyle })
|
UI.Style.theme = Qt.binding(function() { return root.theme })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string locale: "en_US"
|
property string locale: "en_US"
|
||||||
|
property bool selected: false
|
||||||
property date selectedDate: new Date()
|
property date selectedDate: new Date()
|
||||||
|
|
||||||
readonly property int day: selectedDate.getDate()
|
readonly property int day: selectedDate.getDate()
|
||||||
@ -16,6 +17,8 @@ Item {
|
|||||||
readonly property int year: selectedDate.getFullYear()
|
readonly property int year: selectedDate.getFullYear()
|
||||||
readonly property string dateString: year + "-" + _zeroPad(month + 1) + "-" + _zeroPad(day)
|
readonly property string dateString: year + "-" + _zeroPad(month + 1) + "-" + _zeroPad(day)
|
||||||
|
|
||||||
|
signal tappedOnADate()
|
||||||
|
|
||||||
function _zeroPad(n) { return n > 9 ? n : '0' + n }
|
function _zeroPad(n) { return n > 9 ? n : '0' + n }
|
||||||
|
|
||||||
implicitHeight: column.implicitHeight
|
implicitHeight: column.implicitHeight
|
||||||
@ -113,7 +116,7 @@ Item {
|
|||||||
// Important: check the month to avoid clicking on days outside where opacity 0
|
// Important: check the month to avoid clicking on days outside where opacity 0
|
||||||
if (d.getMonth() === monthGrid.month) {
|
if (d.getMonth() === monthGrid.month) {
|
||||||
root.selectedDate = d
|
root.selectedDate = d
|
||||||
console.log("tapped on a date ")
|
root.tappedOnADate()
|
||||||
} else {
|
} else {
|
||||||
console.log("outside valid month " + d.getMonth())
|
console.log("outside valid month " + d.getMonth())
|
||||||
}
|
}
|
||||||
@ -123,7 +126,8 @@ Item {
|
|||||||
id: dayLabel
|
id: dayLabel
|
||||||
|
|
||||||
readonly property bool selected:
|
readonly property bool selected:
|
||||||
model.day === root.day
|
root.selected
|
||||||
|
&& model.day === root.day
|
||||||
&& model.month === root.month
|
&& model.month === root.month
|
||||||
&& model.year === root.year
|
&& model.year === root.year
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
|
|
||||||
static void registerIcons(QQmlEngine *engine, const QString &fontPath,
|
static void registerIcons(QQmlEngine *engine, const QString &fontPath,
|
||||||
const QString &fontName, const QString &codesPath);
|
const QString &fontName, const QString &codesPath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename DerivedType>
|
template <typename DerivedType>
|
||||||
explicit Icons(DerivedType *derived, QObject *parent = nullptr)
|
explicit Icons(DerivedType *derived, QObject *parent = nullptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user