qt quick standart prj
This commit is contained in:
+74
-166
@@ -1,176 +1,84 @@
|
|||||||
# ---> Python
|
# This file is used to ignore files which are generated
|
||||||
# Byte-compiled / optimized / DLL files
|
# ----------------------------------------------------------------------------
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# C extensions
|
*~
|
||||||
|
*.autosave
|
||||||
|
*.a
|
||||||
|
*.core
|
||||||
|
*.moc
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
*.so
|
*.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
|
||||||
|
**/.qmlls.ini
|
||||||
|
|
||||||
# Distribution / packaging
|
# qtcreator generated files
|
||||||
.Python
|
*.pro.user*
|
||||||
build/
|
*.qbs.user*
|
||||||
develop-eggs/
|
CMakeLists.txt.user*
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
MANIFEST
|
|
||||||
|
|
||||||
# PyInstaller
|
# xemacs temporary files
|
||||||
# Usually these files are written by a python script from a template
|
*.flc
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
# Vim temporary files
|
||||||
pip-log.txt
|
.*.swp
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Visual Studio generated files
|
||||||
htmlcov/
|
*.ib_pdb_index
|
||||||
.tox/
|
*.idb
|
||||||
.nox/
|
*.ilk
|
||||||
.coverage
|
*.pdb
|
||||||
.coverage.*
|
*.sln
|
||||||
.cache
|
*.suo
|
||||||
nosetests.xml
|
*.vcproj
|
||||||
coverage.xml
|
*vcproj.*.*.user
|
||||||
*.cover
|
*.ncb
|
||||||
*.py,cover
|
*.sdf
|
||||||
.hypothesis/
|
*.opensdf
|
||||||
.pytest_cache/
|
*.vcxproj
|
||||||
cover/
|
*vcxproj.*
|
||||||
|
|
||||||
# Translations
|
# MinGW generated files
|
||||||
*.mo
|
*.Debug
|
||||||
*.pot
|
*.Release
|
||||||
|
|
||||||
# Django stuff:
|
# Python byte code
|
||||||
*.log
|
*.pyc
|
||||||
local_settings.py
|
|
||||||
db.sqlite3
|
|
||||||
db.sqlite3-journal
|
|
||||||
|
|
||||||
# Flask stuff:
|
# Binaries
|
||||||
instance/
|
# --------
|
||||||
.webassets-cache
|
*.dll
|
||||||
|
*.exe
|
||||||
# Scrapy stuff:
|
|
||||||
.scrapy
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
.pybuilder/
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Jupyter Notebook
|
|
||||||
.ipynb_checkpoints
|
|
||||||
|
|
||||||
# IPython
|
|
||||||
profile_default/
|
|
||||||
ipython_config.py
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
# For a library or package, you might want to ignore these files since the code is
|
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
|
||||||
# .python-version
|
|
||||||
|
|
||||||
# pipenv
|
|
||||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
||||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
||||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
||||||
# install all needed dependencies.
|
|
||||||
#Pipfile.lock
|
|
||||||
|
|
||||||
# UV
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
||||||
# commonly ignored for libraries.
|
|
||||||
#uv.lock
|
|
||||||
|
|
||||||
# poetry
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
||||||
# commonly ignored for libraries.
|
|
||||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
||||||
#poetry.lock
|
|
||||||
|
|
||||||
# pdm
|
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
||||||
#pdm.lock
|
|
||||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
||||||
# in version control.
|
|
||||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
||||||
.pdm.toml
|
|
||||||
.pdm-python
|
|
||||||
.pdm-build/
|
|
||||||
|
|
||||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
||||||
__pypackages__/
|
|
||||||
|
|
||||||
# Celery stuff
|
|
||||||
celerybeat-schedule
|
|
||||||
celerybeat.pid
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Spyder project settings
|
|
||||||
.spyderproject
|
|
||||||
.spyproject
|
|
||||||
|
|
||||||
# Rope project settings
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
.dmypy.json
|
|
||||||
dmypy.json
|
|
||||||
|
|
||||||
# Pyre type checker
|
|
||||||
.pyre/
|
|
||||||
|
|
||||||
# pytype static type analyzer
|
|
||||||
.pytype/
|
|
||||||
|
|
||||||
# Cython debug symbols
|
|
||||||
cython_debug/
|
|
||||||
|
|
||||||
# PyCharm
|
|
||||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
||||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
||||||
#.idea/
|
|
||||||
|
|
||||||
# Ruff stuff:
|
|
||||||
.ruff_cache/
|
|
||||||
|
|
||||||
# PyPI configuration file
|
|
||||||
.pypirc
|
|
||||||
|
|
||||||
|
# Directories with generated files
|
||||||
|
.moc/
|
||||||
|
.obj/
|
||||||
|
.pch/
|
||||||
|
.rcc/
|
||||||
|
.uic/
|
||||||
|
/build*/
|
||||||
|
/.qtcreator/
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
project(Zenith VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||||
|
|
||||||
|
qt_standard_project_setup(REQUIRES 6.10)
|
||||||
|
|
||||||
|
# Content of downloaded design from Figma to Qt or similar
|
||||||
|
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/importedcontent/CMakeLists.txt")
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/importedcontent)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qt_add_executable(appZenith
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_qml_module(appZenith
|
||||||
|
URI Zenith
|
||||||
|
QML_FILES
|
||||||
|
Main.qml
|
||||||
|
)
|
||||||
|
|
||||||
|
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||||
|
# If you are developing for iOS or macOS you should consider setting an
|
||||||
|
# explicit, fixed bundle identifier manually though.
|
||||||
|
set_target_properties(appZenith PROPERTIES
|
||||||
|
# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appZenith
|
||||||
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(appZenith
|
||||||
|
PRIVATE Qt6::Quick
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS appZenith
|
||||||
|
BUNDLE DESTINATION .
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
|
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: window
|
||||||
|
width: 640
|
||||||
|
height: 480
|
||||||
|
minimumWidth: 200
|
||||||
|
minimumHeight: 250
|
||||||
|
visible: true
|
||||||
|
title: qsTr("Hello World")
|
||||||
|
property bool lightMode: Application.styleHints.colorScheme === Qt.Light
|
||||||
|
property color reallyDark: "#1f1f1f"
|
||||||
|
property color dark: "#262626"
|
||||||
|
property color reallyLight: "#e7e7e7"
|
||||||
|
property color light: "#e0e0e0"
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
id: grid
|
||||||
|
columns: width < 400 ? 1 : 2
|
||||||
|
rowSpacing: 0
|
||||||
|
columnSpacing: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: rectangle1
|
||||||
|
color: window.lightMode ? window.reallyLight : window.reallyDark
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: text1
|
||||||
|
color: window.lightMode ? window.dark : window.light
|
||||||
|
font.pixelSize: 120
|
||||||
|
fontSizeMode: Text.Fit
|
||||||
|
text: qsTr("Hello World")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.margins: 16
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: rectangle2
|
||||||
|
color: window.lightMode ? window.light : window.dark
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: button1
|
||||||
|
text: window.lightMode ? qsTr("\u263D Dark mode")
|
||||||
|
: qsTr("\u263C Light mode")
|
||||||
|
Layout.bottomMargin: 16
|
||||||
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||||
|
|
||||||
|
contentItem: Text {
|
||||||
|
text: button1.text
|
||||||
|
color: window.lightMode ? window.light : window.dark
|
||||||
|
font: button1.font
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: 120
|
||||||
|
implicitHeight: 36
|
||||||
|
radius: 8
|
||||||
|
color: window.lightMode ? window.dark : window.light
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: window.lightMode = !window.lightMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Downloaded Design from Figma to Qt
|
||||||
|
|
||||||
|
Save the downloaded design from Figma to Qt here, including the CMakeLists.txt.
|
||||||
|
The main project CMakeLists.txt picks this up automatically.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
QObject::connect(
|
||||||
|
&engine,
|
||||||
|
&QQmlApplicationEngine::objectCreationFailed,
|
||||||
|
&app,
|
||||||
|
[]() { QCoreApplication::exit(-1); },
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
engine.loadFromModule("Zenith", "Main");
|
||||||
|
|
||||||
|
return QGuiApplication::exec();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user