Move project files to repo root
This commit is contained in:
82
QYRComponents/.gitignore
vendored
Executable file
82
QYRComponents/.gitignore
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
# This file is used to ignore files which are generated
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.a
|
||||
*.core
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
*.qbs.user*
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
# Directories with generated files
|
||||
.moc/
|
||||
.obj/
|
||||
.pch/
|
||||
.rcc/
|
||||
.uic/
|
||||
/build*/
|
||||
11
QYRComponents/ApplicationWindow.qml
Normal file
11
QYRComponents/ApplicationWindow.qml
Normal file
@@ -0,0 +1,11 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
import QtQuick.Controls.Basic as QC
|
||||
|
||||
QC.ApplicationWindow {
|
||||
visible: true
|
||||
|
||||
background: Rectangle {
|
||||
color: Colors.background
|
||||
}
|
||||
}
|
||||
21
QYRComponents/Button.qml
Executable file
21
QYRComponents/Button.qml
Executable file
@@ -0,0 +1,21 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
import QtQuick.Controls.Basic as QC
|
||||
|
||||
QC.Button {
|
||||
// highlighted: true
|
||||
background: Rectangle {
|
||||
color: hovered ? Colors.primaryAlt : Colors.primary
|
||||
radius: 5
|
||||
}
|
||||
|
||||
// width: player.playing ? 60 : 56
|
||||
implicitHeight: 36
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
contentItem.color = Colors.text;
|
||||
font.family = Colors.fontFamily;
|
||||
font.pointSize = Colors.fontSize.base;
|
||||
}
|
||||
}
|
||||
38
QYRComponents/CMakeLists.txt
Executable file
38
QYRComponents/CMakeLists.txt
Executable file
@@ -0,0 +1,38 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(QYRComponents VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
|
||||
|
||||
set_source_files_properties(Colors.qml
|
||||
PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
|
||||
|
||||
qt_add_library(QYRComponents STATIC)
|
||||
qt_add_qml_module(QYRComponents
|
||||
URI QYRComponents
|
||||
VERSION 1.0
|
||||
RESOURCE_PREFIX /qt/qml
|
||||
QML_FILES Button.qml
|
||||
QML_FILES Colors.qml
|
||||
QML_FILES ApplicationWindow.qml
|
||||
QML_FILES CheckBox.qml
|
||||
QML_FILES Slider.qml
|
||||
QML_FILES Label.qml
|
||||
# SOURCES qyrcomponents.cpp qyrcomponents.h
|
||||
)
|
||||
|
||||
set_target_properties(QYRComponents PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
target_compile_definitions(QYRComponents
|
||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
target_link_libraries(QYRComponents
|
||||
PRIVATE Qt6::Quick)
|
||||
|
||||
target_include_directories(QYRComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
15
QYRComponents/CheckBox.qml
Normal file
15
QYRComponents/CheckBox.qml
Normal file
@@ -0,0 +1,15 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
import QtQuick.Controls.Basic as QC
|
||||
|
||||
QC.CheckBox {
|
||||
implicitWidth: 14
|
||||
implicitHeight: 14
|
||||
contentItem: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 2
|
||||
color: parent.checked ? (parent.hovered ? Colors.primaryAlt : Colors.primary) : "#fff"
|
||||
border.color: parent.checked ? (parent.hovered ? Colors.primaryAlt : Colors.primary) : "#fff"
|
||||
border.width: 1
|
||||
}
|
||||
}
|
||||
49
QYRComponents/Colors.qml
Normal file
49
QYRComponents/Colors.qml
Normal file
@@ -0,0 +1,49 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick 6.8
|
||||
|
||||
Item {
|
||||
QtObject {
|
||||
id: themes
|
||||
|
||||
readonly property var light: ({
|
||||
text: "#1f1f1f",
|
||||
primary: "#007bff",
|
||||
primaryAlt: "#0056b3",
|
||||
surface1: "#323232",
|
||||
surface0: "#282828",
|
||||
background: "#f4f4f4"
|
||||
})
|
||||
|
||||
readonly property var dark: ({
|
||||
text: "#f4f4f4",
|
||||
primary: "#007bff",
|
||||
primaryAlt: "#0056b3",
|
||||
surface1: "#323232",
|
||||
surface0: "#282828",
|
||||
background: "#1f1f1f"
|
||||
})
|
||||
}
|
||||
|
||||
readonly property string fontFamily: "Arial"
|
||||
readonly property var fontSize: ({
|
||||
h1: 32,
|
||||
h2: 24,
|
||||
h3: 18,
|
||||
h4: 16,
|
||||
h5: 13,
|
||||
h6: 10,
|
||||
p: 12,
|
||||
base: 12
|
||||
})
|
||||
|
||||
property var currentTheme: themes.dark
|
||||
// property alias themes: themes
|
||||
|
||||
readonly property string text: currentTheme.text
|
||||
readonly property string primary: currentTheme.primary
|
||||
readonly property string primaryAlt: currentTheme.primaryAlt
|
||||
readonly property string surface1: currentTheme.surface1
|
||||
readonly property string surface0: currentTheme.surface0
|
||||
readonly property string background: currentTheme.background
|
||||
}
|
||||
10
QYRComponents/Label.qml
Normal file
10
QYRComponents/Label.qml
Normal file
@@ -0,0 +1,10 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
import QtQuick.Controls.Basic as QC
|
||||
|
||||
QC.Label {
|
||||
property string heading: "base"
|
||||
|
||||
font.family: Colors.fontFamily
|
||||
font.pixelSize: Colors.fontSize[heading]
|
||||
}
|
||||
39
QYRComponents/Slider.qml
Normal file
39
QYRComponents/Slider.qml
Normal file
@@ -0,0 +1,39 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
import QtQuick.Controls.Basic as QC
|
||||
|
||||
QC.Slider {
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
implicitWidth: 130
|
||||
implicitHeight: 20
|
||||
|
||||
// OpacityAnimator on opacity{
|
||||
// from: 0.7
|
||||
// to: 1
|
||||
// duration: 200
|
||||
// target: parent
|
||||
// running: parent.hovered
|
||||
// }
|
||||
// OpacityAnimator on opacity{
|
||||
// from: 1
|
||||
// to: 0.7
|
||||
// duration: 200
|
||||
// target: parent
|
||||
// running: !parent.hovered
|
||||
// }
|
||||
|
||||
background: Rectangle {
|
||||
color: "#555"
|
||||
radius: 5
|
||||
}
|
||||
|
||||
handle: Rectangle {
|
||||
x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width)
|
||||
y: parent.topPadding + parent.availableHeight / 2 - height / 2
|
||||
width: 20
|
||||
height: 20
|
||||
radius: 10
|
||||
color: Colors.primary
|
||||
}
|
||||
}
|
||||
4
QYRComponents/qmldir
Executable file
4
QYRComponents/qmldir
Executable file
@@ -0,0 +1,4 @@
|
||||
module QYRComponents
|
||||
|
||||
Button 1.0 Button.qml
|
||||
singleton Colors 1.0 Colors.qml
|
||||
27
QYRComponents/qyrcomponents.cpp
Executable file
27
QYRComponents/qyrcomponents.cpp
Executable file
@@ -0,0 +1,27 @@
|
||||
#include "qyrcomponents.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
QYRComponents::QYRComponents(QQuickItem *parent)
|
||||
: QQuickPaintedItem(parent)
|
||||
{
|
||||
// By default, QQuickItem does not draw anything. If you subclass
|
||||
// QQuickItem to create a visual item, you will need to uncomment the
|
||||
// following line and re-implement updatePaintNode()
|
||||
|
||||
// setFlag(ItemHasContents, true);
|
||||
}
|
||||
|
||||
void QYRComponents::paint(QPainter *painter)
|
||||
{
|
||||
QPen pen(QColorConstants::Red, 2);
|
||||
QBrush brush(QColorConstants::Red);
|
||||
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(brush);
|
||||
painter->drawRect(0, 0, 100, 100);
|
||||
}
|
||||
|
||||
QYRComponents::~QYRComponents()
|
||||
{
|
||||
}
|
||||
17
QYRComponents/qyrcomponents.h
Executable file
17
QYRComponents/qyrcomponents.h
Executable file
@@ -0,0 +1,17 @@
|
||||
#ifndef QYRCOMPONENTS_H
|
||||
#define QYRCOMPONENTS_H
|
||||
|
||||
#include <QtQuick/QQuickPaintedItem>
|
||||
|
||||
class QYRComponents : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_DISABLE_COPY(QYRComponents)
|
||||
public:
|
||||
explicit QYRComponents(QQuickItem *parent = nullptr);
|
||||
void paint(QPainter *painter) override;
|
||||
~QYRComponents() override;
|
||||
};
|
||||
|
||||
#endif // QYRCOMPONENTS_H
|
||||
Reference in New Issue
Block a user