Merge 8b9f0066ee into 3a0e226597
This commit is contained in:
commit
74320b47a3
|
|
@ -0,0 +1,178 @@
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: Chromium
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveMacros: false
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveBitFields: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: MultiLine
|
||||||
|
AfterEnum: true
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: true
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
AfterExternBlock: true
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: true
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
# BreakBeforeInheritanceComma: true
|
||||||
|
BreakInheritanceList: BeforeComma
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakAfterJavaFieldAnnotations: true
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IncludeCategories:
|
||||||
|
# Standard library headers come before anything else
|
||||||
|
- Regex: '^<[a-z_]+>'
|
||||||
|
Priority: -1
|
||||||
|
- Regex: '^<.+\.h(pp)?>'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: ''
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentExternBlock: NoIndent
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertTrailingCommas: Wrapped
|
||||||
|
JavaScriptQuotes: Double
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Never
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 1
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 200
|
||||||
|
PointerAlignment: Left
|
||||||
|
RawStringFormats:
|
||||||
|
- Language: Cpp
|
||||||
|
Delimiters:
|
||||||
|
- cc
|
||||||
|
- CC
|
||||||
|
- cpp
|
||||||
|
- Cpp
|
||||||
|
- CPP
|
||||||
|
- 'c++'
|
||||||
|
- 'C++'
|
||||||
|
CanonicalDelimiter: ''
|
||||||
|
BasedOnStyle: google
|
||||||
|
- Language: TextProto
|
||||||
|
Delimiters:
|
||||||
|
- pb
|
||||||
|
- PB
|
||||||
|
- proto
|
||||||
|
- PROTO
|
||||||
|
EnclosingFunctions:
|
||||||
|
- EqualsProto
|
||||||
|
- EquivToProto
|
||||||
|
- PARSE_PARTIAL_TEXT_PROTO
|
||||||
|
- PARSE_TEST_PROTO
|
||||||
|
- PARSE_TEXT_PROTO
|
||||||
|
- ParseTextOrDie
|
||||||
|
- ParseTextProtoOrDie
|
||||||
|
- ParseTestProto
|
||||||
|
- ParsePartialTestProto
|
||||||
|
CanonicalDelimiter: ''
|
||||||
|
BasedOnStyle: google
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: true
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: true
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 2
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
Standard: Auto
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 8
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: Never
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- STRINGIZE
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
---
|
||||||
|
# Enable ALL the things! Except not really
|
||||||
|
# misc-non-private-member-variables-in-classes: the options don't do anything
|
||||||
|
# modernize-use-nodiscard: too aggressive, attribute is situationally useful
|
||||||
|
Checks: "*,\
|
||||||
|
-google-readability-todo,\
|
||||||
|
-altera-*,\
|
||||||
|
-fuchsia-*,\
|
||||||
|
fuchsia-multiple-inheritance,\
|
||||||
|
-llvm-header-guard,\
|
||||||
|
-llvm-include-order,\
|
||||||
|
-llvmlibc-*,\
|
||||||
|
-modernize-use-nodiscard,\
|
||||||
|
-misc-non-private-member-variables-in-classes"
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
CheckOptions:
|
||||||
|
- key: 'bugprone-argument-comment.StrictMode'
|
||||||
|
value: 'true'
|
||||||
|
# Prefer using enum classes with 2 values for parameters instead of bools
|
||||||
|
- key: 'bugprone-argument-comment.CommentBoolLiterals'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-simplify-boolean-expr.ChainedConditionalReturn'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-uniqueptr-delete-release.PreferResetCall'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'cppcoreguidelines-init-variables.MathHeader'
|
||||||
|
value: '<cmath>'
|
||||||
|
- key: 'cppcoreguidelines-narrowing-conversions.PedanticMode'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-else-after-return.WarnOnUnfixable'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-else-after-return.WarnOnConditionVariables'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-inconsistent-declaration-parameter-name.Strict'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-qualified-auto.AddConstToQualified'
|
||||||
|
value: 'true'
|
||||||
|
- key: 'readability-redundant-access-specifiers.CheckFirstDeclaration'
|
||||||
|
value: 'true'
|
||||||
|
# These seem to be the most common identifier styles
|
||||||
|
- key: 'readability-identifier-naming.AbstractClassCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ClassCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ClassConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ClassMemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ClassMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstantMemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstantParameterCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstantPointerParameterCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstexprFunctionCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstexprMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ConstexprVariableCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.EnumCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.EnumConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.FunctionCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.GlobalConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.GlobalConstantPointerCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.GlobalFunctionCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.GlobalPointerCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.GlobalVariableCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.InlineNamespaceCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.LocalConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.LocalConstantPointerCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.LocalPointerCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.LocalVariableCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.MacroDefinitionCase'
|
||||||
|
value: 'UPPER_CASE'
|
||||||
|
- key: 'readability-identifier-naming.MemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.MethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.NamespaceCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ParameterCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ParameterPackCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.PointerParameterCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.PrivateMemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.PrivateMemberPrefix'
|
||||||
|
value: 'm_'
|
||||||
|
- key: 'readability-identifier-naming.PrivateMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ProtectedMemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ProtectedMemberPrefix'
|
||||||
|
value: 'm_'
|
||||||
|
- key: 'readability-identifier-naming.ProtectedMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.PublicMemberCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.PublicMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ScopedEnumConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.StaticConstantCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.StaticVariableCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.StructCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.TemplateParameterCase'
|
||||||
|
value: 'CamelCase'
|
||||||
|
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
|
||||||
|
value: 'CamelCase'
|
||||||
|
- key: 'readability-identifier-naming.TypeAliasCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.TypedefCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
|
||||||
|
value: 'CamelCase'
|
||||||
|
- key: 'readability-identifier-naming.UnionCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
|
||||||
|
value: 'CamelCase'
|
||||||
|
- key: 'readability-identifier-naming.VariableCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
- key: 'readability-identifier-naming.VirtualMethodCase'
|
||||||
|
value: 'lower_case'
|
||||||
|
...
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
[codespell]
|
||||||
|
builtin = clear,rare,en-GB_to_en-US,names,informal,code
|
||||||
|
check-filenames =
|
||||||
|
check-hidden =
|
||||||
|
skip = */.git,*/build,*/prefix
|
||||||
|
quiet-level = 2
|
||||||
|
|
@ -1 +1,11 @@
|
||||||
*.pro.user
|
.idea/
|
||||||
|
.vs/
|
||||||
|
.vscode/
|
||||||
|
build/
|
||||||
|
cmake/open-cpp-coverage.cmake
|
||||||
|
cmake-build-*/
|
||||||
|
prefix/
|
||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeUserPresets.json
|
||||||
|
.cache
|
||||||
|
compile_commands.json
|
||||||
|
|
@ -0,0 +1,185 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||||
|
|
||||||
|
include(prelude)
|
||||||
|
|
||||||
|
project(
|
||||||
|
qt-material-widgets
|
||||||
|
VERSION 0.1.0
|
||||||
|
DESCRIPTION "Qt Material Design Desktop Widgets"
|
||||||
|
LANGUAGES CXX
|
||||||
|
)
|
||||||
|
|
||||||
|
include(project-is-top-level)
|
||||||
|
include(variables)
|
||||||
|
include(link_qt)
|
||||||
|
|
||||||
|
if(NOT Qt6_FOUND)
|
||||||
|
qt5_add_resources(
|
||||||
|
style_res
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/qt_material_widgets.qrc
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
qt_add_resources(
|
||||||
|
style_res
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/qt_material_widgets.qrc
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
qt-material-widgets
|
||||||
|
${style_res}
|
||||||
|
|
||||||
|
include/qt-material-widgets/component/qtmaterialappbar.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialautocomplete.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialavatar.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialbadge.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialcheckbox.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialcircularprogress.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialdialog.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialdrawer.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialfab.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialflatbutton.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialiconbutton.h
|
||||||
|
include/qt-material-widgets/component/qtmateriallist.h
|
||||||
|
include/qt-material-widgets/component/qtmateriallistitem.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialmenu.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialpaper.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialprogress.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialradiobutton.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialraisedbutton.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialscrollbar.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialslider.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialsnackbar.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialtable.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialtabs.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialtextfield.h
|
||||||
|
include/qt-material-widgets/component/qtmaterialtoggle.h
|
||||||
|
include/qt-material-widgets/layouts/qtmaterialsnackbarlayout.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialcheckable.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialoverlaywidget.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialripple.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialrippleoverlay.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialstatetransition.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialstatetransitionevent.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialstyle.h
|
||||||
|
include/qt-material-widgets/lib/qtmaterialtheme.h
|
||||||
|
|
||||||
|
source/component/qtmaterialappbar.cpp
|
||||||
|
source/component/qtmaterialautocomplete.cpp
|
||||||
|
source/component/qtmaterialautocomplete_internal.cpp
|
||||||
|
source/component/qtmaterialavatar.cpp
|
||||||
|
source/component/qtmaterialbadge.cpp
|
||||||
|
source/component/qtmaterialcheckbox.cpp
|
||||||
|
source/component/qtmaterialcircularprogress.cpp
|
||||||
|
source/component/qtmaterialcircularprogress_internal.cpp
|
||||||
|
source/component/qtmaterialdialog.cpp
|
||||||
|
source/component/qtmaterialdialog_internal.cpp
|
||||||
|
source/component/qtmaterialdrawer.cpp
|
||||||
|
source/component/qtmaterialdrawer_internal.cpp
|
||||||
|
source/component/qtmaterialfab.cpp
|
||||||
|
source/component/qtmaterialflatbutton.cpp
|
||||||
|
source/component/qtmaterialflatbutton_internal.cpp
|
||||||
|
source/component/qtmaterialiconbutton.cpp
|
||||||
|
source/component/qtmateriallist.cpp
|
||||||
|
source/component/qtmateriallistitem.cpp
|
||||||
|
source/component/qtmaterialmenu.cpp
|
||||||
|
source/component/qtmaterialmenu_internal.cpp
|
||||||
|
source/component/qtmaterialpaper.cpp
|
||||||
|
source/component/qtmaterialprogress.cpp
|
||||||
|
source/component/qtmaterialprogress_internal.cpp
|
||||||
|
source/component/qtmaterialradiobutton.cpp
|
||||||
|
source/component/qtmaterialraisedbutton.cpp
|
||||||
|
source/component/qtmaterialscrollbar.cpp
|
||||||
|
source/component/qtmaterialscrollbar_internal.cpp
|
||||||
|
source/component/qtmaterialslider.cpp
|
||||||
|
source/component/qtmaterialslider_internal.cpp
|
||||||
|
source/component/qtmaterialsnackbar.cpp
|
||||||
|
source/component/qtmaterialsnackbar_internal.cpp
|
||||||
|
source/component/qtmaterialtable.cpp
|
||||||
|
source/component/qtmaterialtabs.cpp
|
||||||
|
source/component/qtmaterialtabs_internal.cpp
|
||||||
|
source/component/qtmaterialtextfield.cpp
|
||||||
|
source/component/qtmaterialtextfield_internal.cpp
|
||||||
|
source/component/qtmaterialtoggle.cpp
|
||||||
|
source/component/qtmaterialtoggle_internal.cpp
|
||||||
|
source/layouts/qtmaterialsnackbarlayout.cpp
|
||||||
|
source/lib/qtmaterialcheckable.cpp
|
||||||
|
source/lib/qtmaterialcheckable_internal.cpp
|
||||||
|
source/lib/qtmaterialoverlaywidget.cpp
|
||||||
|
source/lib/qtmaterialripple.cpp
|
||||||
|
source/lib/qtmaterialrippleoverlay.cpp
|
||||||
|
source/lib/qtmaterialstatetransition.cpp
|
||||||
|
source/lib/qtmaterialstyle.cpp
|
||||||
|
source/lib/qtmaterialtheme.cpp
|
||||||
|
)
|
||||||
|
add_library(qt-material-widgets::qt-material-widgets ALIAS qt-material-widgets)
|
||||||
|
|
||||||
|
target_link_libraries(qt-material-widgets PUBLIC ${QT_LIBRARIES})
|
||||||
|
|
||||||
|
include(GenerateExportHeader)
|
||||||
|
generate_export_header(
|
||||||
|
qt-material-widgets
|
||||||
|
BASE_NAME qt-material-widgets
|
||||||
|
EXPORT_FILE_NAME export/qt-material-widgets/qt-material-widgets_export.hpp
|
||||||
|
CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(qt-material-widgets PUBLIC QT_MATERIAL_WIDGETS_STATIC_DEFINE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
qt-material-widgets PROPERTIES
|
||||||
|
CXX_VISIBILITY_PRESET hidden
|
||||||
|
VISIBILITY_INLINES_HIDDEN YES
|
||||||
|
VERSION "${PROJECT_VERSION}"
|
||||||
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||||
|
EXPORT_NAME qt-material-widgets
|
||||||
|
OUTPUT_NAME qt-material-widgets
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(
|
||||||
|
qt-material-widgets ${warning_guard}
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(
|
||||||
|
qt-material-widgets SYSTEM
|
||||||
|
PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(
|
||||||
|
qt-material-widgets ${warning_guard}
|
||||||
|
PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/qt-material-widgets>"
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/qt-material-widgets/component>"
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_features(qt-material-widgets PUBLIC cxx_std_11)
|
||||||
|
|
||||||
|
|
||||||
|
# ---- Examples ----
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
option(BUILD_EXAMPLES "Build examples tree." "${qt-material-widgets_DEVELOPER_MODE}")
|
||||||
|
|
||||||
|
if(BUILD_EXAMPLES)
|
||||||
|
set(PROJECT_ROOT_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
add_subdirectory(example)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ---- Developer mode ----
|
||||||
|
if(NOT qt-material-widgets_DEVELOPER_MODE)
|
||||||
|
return()
|
||||||
|
elseif(NOT PROJECT_IS_TOP_LEVEL)
|
||||||
|
message(
|
||||||
|
AUTHOR_WARNING
|
||||||
|
"Developer mode is intended for developers of qt-material-widgets"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(dev-mode)
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"cmakeMinimumRequired": {
|
||||||
|
"major": 3,
|
||||||
|
"minor": 14,
|
||||||
|
"patch": 0
|
||||||
|
},
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "cmake-pedantic",
|
||||||
|
"hidden": true,
|
||||||
|
"warnings": {
|
||||||
|
"dev": true,
|
||||||
|
"deprecated": true,
|
||||||
|
"unusedCli": true,
|
||||||
|
"systemVars": false
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"dev": true,
|
||||||
|
"deprecated": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dev-mode",
|
||||||
|
"hidden": true,
|
||||||
|
"inherits": "cmake-pedantic",
|
||||||
|
"cacheVariables": {
|
||||||
|
"qt-material-widgets_DEVELOPER_MODE": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cppcheck",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang-tidy",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=^${sourceDir}/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-std",
|
||||||
|
"description": "This preset makes sure the project actually builds with at least the specified standard",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_EXTENSIONS": "OFF",
|
||||||
|
"CMAKE_CXX_STANDARD": "11",
|
||||||
|
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
|
||||||
|
"CMAKE_SKIP_INSTALL_RULES": true,
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flags-unix",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wshadow -Wformat=2 -Wundef -Werror=float-equal "
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flags-windows",
|
||||||
|
"description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_FLAGS": " /W4 /permissive- /volatile:iso /Zc:preprocessor /EHsc /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /wd5105"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-unix",
|
||||||
|
"generator": "Unix Makefiles",
|
||||||
|
"hidden": true,
|
||||||
|
"inherits": [
|
||||||
|
"flags-unix",
|
||||||
|
"ci-std"
|
||||||
|
],
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-win64",
|
||||||
|
"inherits": [
|
||||||
|
"flags-windows",
|
||||||
|
"ci-std"
|
||||||
|
],
|
||||||
|
"generator": "Visual Studio 17 2022",
|
||||||
|
"architecture": "x64",
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-win64-ninja",
|
||||||
|
"inherits": [
|
||||||
|
"flags-windows",
|
||||||
|
"ci-std"
|
||||||
|
],
|
||||||
|
"generator": "Ninja",
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "coverage-unix",
|
||||||
|
"binaryDir": "${sourceDir}/build/coverage",
|
||||||
|
"inherits": "ci-unix",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"ENABLE_COVERAGE": "ON",
|
||||||
|
"CMAKE_BUILD_TYPE": "Coverage",
|
||||||
|
"CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-inline-functions -fkeep-static-functions",
|
||||||
|
"CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage",
|
||||||
|
"CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-coverage",
|
||||||
|
"inherits": [
|
||||||
|
"coverage-unix",
|
||||||
|
"dev-mode"
|
||||||
|
],
|
||||||
|
"cacheVariables": {
|
||||||
|
"COVERAGE_HTML_COMMAND": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-sanitize",
|
||||||
|
"binaryDir": "${sourceDir}/build/sanitize",
|
||||||
|
"inherits": [
|
||||||
|
"ci-unix",
|
||||||
|
"dev-mode"
|
||||||
|
],
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Sanitize",
|
||||||
|
"CMAKE_CXX_FLAGS_SANITIZE": "-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-build",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-macos",
|
||||||
|
"inherits": [
|
||||||
|
"ci-build",
|
||||||
|
"ci-unix",
|
||||||
|
"dev-mode"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-ubuntu",
|
||||||
|
"inherits": [
|
||||||
|
"ci-build",
|
||||||
|
"ci-unix",
|
||||||
|
"clang-tidy",
|
||||||
|
"cppcheck",
|
||||||
|
"dev-mode"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-windows",
|
||||||
|
"inherits": [
|
||||||
|
"ci-build",
|
||||||
|
"ci-win64",
|
||||||
|
"dev-mode"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ci-windows-ninja",
|
||||||
|
"inherits": [
|
||||||
|
"ci-build",
|
||||||
|
"ci-win64-ninja",
|
||||||
|
"dev-mode"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
# ---- Variables ----
|
||||||
|
|
||||||
|
# We use variables separate from what CTest uses, because those have
|
||||||
|
# customization issues
|
||||||
|
set(
|
||||||
|
COVERAGE_TRACE_COMMAND
|
||||||
|
lcov -c -q
|
||||||
|
-o "${PROJECT_BINARY_DIR}/coverage.info"
|
||||||
|
-d "${PROJECT_BINARY_DIR}"
|
||||||
|
--include "${PROJECT_SOURCE_DIR}/*"
|
||||||
|
CACHE STRING
|
||||||
|
"; separated command to generate a trace for the 'coverage' target"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(
|
||||||
|
COVERAGE_HTML_COMMAND
|
||||||
|
genhtml --legend -f -q
|
||||||
|
"${PROJECT_BINARY_DIR}/coverage.info"
|
||||||
|
-p "${PROJECT_SOURCE_DIR}"
|
||||||
|
-o "${PROJECT_BINARY_DIR}/coverage_html"
|
||||||
|
CACHE STRING
|
||||||
|
"; separated command to generate an HTML report for the 'coverage' target"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- Coverage target ----
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
coverage
|
||||||
|
COMMAND ${COVERAGE_TRACE_COMMAND}
|
||||||
|
COMMAND ${COVERAGE_HTML_COMMAND}
|
||||||
|
COMMENT "Generating coverage report"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
include(cmake/folders.cmake)
|
||||||
|
option(BUILD_MCSS_DOCS "Build documentation using Doxygen and m.css" OFF)
|
||||||
|
|
||||||
|
if(BUILD_MCSS_DOCS)
|
||||||
|
include(cmake/docs.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_COVERAGE "Enable coverage support separate from CTest's" OFF)
|
||||||
|
|
||||||
|
if(ENABLE_COVERAGE)
|
||||||
|
include(cmake/coverage.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
include(cmake/open-cpp-coverage.cmake OPTIONAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(cmake/lint-targets.cmake)
|
||||||
|
include(cmake/spell-targets.cmake)
|
||||||
|
|
||||||
|
add_folders(Project)
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
foreach(var IN ITEMS PROJECT_BINARY_DIR PROJECT_SOURCE_DIR)
|
||||||
|
if(NOT DEFINED "${var}")
|
||||||
|
message(FATAL_ERROR "${var} must be defined")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(bin "${PROJECT_BINARY_DIR}")
|
||||||
|
set(src "${PROJECT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# ---- Dependencies ----
|
||||||
|
|
||||||
|
set(mcss_SOURCE_DIR "${bin}/docs/.ci")
|
||||||
|
if(NOT IS_DIRECTORY "${mcss_SOURCE_DIR}")
|
||||||
|
file(MAKE_DIRECTORY "${mcss_SOURCE_DIR}")
|
||||||
|
file(
|
||||||
|
DOWNLOAD
|
||||||
|
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
|
||||||
|
"${mcss_SOURCE_DIR}/mcss.zip"
|
||||||
|
STATUS status
|
||||||
|
EXPECTED_MD5 00cd2757ebafb9bcba7f5d399b3bec7f
|
||||||
|
)
|
||||||
|
if(NOT status MATCHES "^0;")
|
||||||
|
message(FATAL_ERROR "Download failed with ${status}")
|
||||||
|
endif()
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E tar xf mcss.zip
|
||||||
|
WORKING_DIRECTORY "${mcss_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
if(NOT result EQUAL "0")
|
||||||
|
message(FATAL_ERROR "Extraction failed with ${result}")
|
||||||
|
endif()
|
||||||
|
file(REMOVE "${mcss_SOURCE_DIR}/mcss.zip")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(Python3_EXECUTABLE NAMES python3 python)
|
||||||
|
if(NOT Python3_EXECUTABLE)
|
||||||
|
message(FATAL_ERROR "Python executable was not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ---- Process project() call in CMakeLists.txt ----
|
||||||
|
|
||||||
|
file(READ "${src}/CMakeLists.txt" content)
|
||||||
|
|
||||||
|
string(FIND "${content}" "project(" index)
|
||||||
|
if(index EQUAL "-1")
|
||||||
|
message(FATAL_ERROR "Could not find \"project(\"")
|
||||||
|
endif()
|
||||||
|
string(SUBSTRING "${content}" "${index}" -1 content)
|
||||||
|
|
||||||
|
string(FIND "${content}" "\n)\n" index)
|
||||||
|
if(index EQUAL "-1")
|
||||||
|
message(FATAL_ERROR "Could not find \"\\n)\\n\"")
|
||||||
|
endif()
|
||||||
|
string(SUBSTRING "${content}" 0 "${index}" content)
|
||||||
|
|
||||||
|
file(WRITE "${bin}/docs-ci.project.cmake" "docs_${content}\n)\n")
|
||||||
|
|
||||||
|
macro(list_pop_front list out)
|
||||||
|
list(GET "${list}" 0 "${out}")
|
||||||
|
list(REMOVE_AT "${list}" 0)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(docs_project name)
|
||||||
|
cmake_parse_arguments(PARSE_ARGV 1 "" "" "VERSION;DESCRIPTION;HOMEPAGE_URL" LANGUAGES)
|
||||||
|
set(PROJECT_NAME "${name}" PARENT_SCOPE)
|
||||||
|
if(DEFINED _VERSION)
|
||||||
|
set(PROJECT_VERSION "${_VERSION}" PARENT_SCOPE)
|
||||||
|
string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*" versions "${_VERSION}")
|
||||||
|
string(REPLACE . ";" versions "${versions}")
|
||||||
|
set(suffixes MAJOR MINOR PATCH TWEAK)
|
||||||
|
while(NOT versions STREQUAL "" AND NOT suffixes STREQUAL "")
|
||||||
|
list_pop_front(versions version)
|
||||||
|
list_pop_front(suffixes suffix)
|
||||||
|
set("PROJECT_VERSION_${suffix}" "${version}" PARENT_SCOPE)
|
||||||
|
endwhile()
|
||||||
|
endif()
|
||||||
|
if(DEFINED _DESCRIPTION)
|
||||||
|
set(PROJECT_DESCRIPTION "${_DESCRIPTION}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if(DEFINED _HOMEPAGE_URL)
|
||||||
|
set(PROJECT_HOMEPAGE_URL "${_HOMEPAGE_URL}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
include("${bin}/docs-ci.project.cmake")
|
||||||
|
|
||||||
|
# ---- Generate docs ----
|
||||||
|
|
||||||
|
if(NOT DEFINED DOXYGEN_OUTPUT_DIRECTORY)
|
||||||
|
set(DOXYGEN_OUTPUT_DIRECTORY "${bin}/docs")
|
||||||
|
endif()
|
||||||
|
set(out "${DOXYGEN_OUTPUT_DIRECTORY}")
|
||||||
|
|
||||||
|
foreach(file IN ITEMS Doxyfile conf.py)
|
||||||
|
configure_file("${src}/docs/${file}.in" "${bin}/docs/${file}" @ONLY)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py")
|
||||||
|
set(config "${bin}/docs/conf.py")
|
||||||
|
|
||||||
|
file(REMOVE_RECURSE "${out}/html" "${out}/xml")
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}"
|
||||||
|
WORKING_DIRECTORY "${bin}/docs"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
if(NOT result EQUAL "0")
|
||||||
|
message(FATAL_ERROR "m.css returned with ${result}")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
# ---- Dependencies ----
|
||||||
|
|
||||||
|
set(extract_timestamps "")
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
||||||
|
set(extract_timestamps DOWNLOAD_EXTRACT_TIMESTAMP YES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
mcss URL
|
||||||
|
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
|
||||||
|
URL_MD5 00cd2757ebafb9bcba7f5d399b3bec7f
|
||||||
|
SOURCE_DIR "${PROJECT_BINARY_DIR}/mcss"
|
||||||
|
UPDATE_DISCONNECTED YES
|
||||||
|
${extract_timestamps}
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(mcss)
|
||||||
|
|
||||||
|
find_package(Python3 3.6 REQUIRED)
|
||||||
|
|
||||||
|
# ---- Declare documentation target ----
|
||||||
|
|
||||||
|
set(
|
||||||
|
DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/docs"
|
||||||
|
CACHE PATH "Path for the generated Doxygen documentation"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(working_dir "${PROJECT_BINARY_DIR}/docs")
|
||||||
|
|
||||||
|
foreach(file IN ITEMS Doxyfile conf.py)
|
||||||
|
configure_file("docs/${file}.in" "${working_dir}/${file}" @ONLY)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py")
|
||||||
|
set(config "${working_dir}/conf.py")
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
docs
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E remove_directory
|
||||||
|
"${DOXYGEN_OUTPUT_DIRECTORY}/html"
|
||||||
|
"${DOXYGEN_OUTPUT_DIRECTORY}/xml"
|
||||||
|
COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}"
|
||||||
|
COMMENT "Building documentation using Doxygen and m.css"
|
||||||
|
WORKING_DIRECTORY "${working_dir}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
|
||||||
|
|
||||||
|
# Call this function at the end of a directory scope to assign a folder to
|
||||||
|
# targets created in that directory. Utility targets will be assigned to the
|
||||||
|
# UtilityTargets folder, otherwise to the ${name}Targets folder. If a target
|
||||||
|
# already has a folder assigned, then that target will be skipped.
|
||||||
|
function(add_folders name)
|
||||||
|
get_property(targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
|
||||||
|
foreach(target IN LISTS targets)
|
||||||
|
get_property(folder TARGET "${target}" PROPERTY FOLDER)
|
||||||
|
if(DEFINED folder)
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
set(folder Utility)
|
||||||
|
get_property(type TARGET "${target}" PROPERTY TYPE)
|
||||||
|
if(NOT type STREQUAL "UTILITY")
|
||||||
|
set(folder "${name}")
|
||||||
|
endif()
|
||||||
|
set_property(TARGET "${target}" PROPERTY FOLDER "${folder}Targets")
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/qt-material-widgetsTargets.cmake")
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
set(
|
||||||
|
CMAKE_INSTALL_INCLUDEDIR "include/qt-material-widgets-${PROJECT_VERSION}"
|
||||||
|
CACHE PATH ""
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# find_package(<package>) call for consumers to find this project
|
||||||
|
set(package qt-material-widgets)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY
|
||||||
|
include/
|
||||||
|
"${PROJECT_BINARY_DIR}/export/"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
|
COMPONENT qt-material-widgets_Development
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS qt-material-widgets
|
||||||
|
EXPORT qt-material-widgetsTargets
|
||||||
|
RUNTIME #
|
||||||
|
COMPONENT qt-material-widgets_Runtime
|
||||||
|
LIBRARY #
|
||||||
|
COMPONENT qt-material-widgets_Runtime
|
||||||
|
NAMELINK_COMPONENT qt-material-widgets_Development
|
||||||
|
ARCHIVE #
|
||||||
|
COMPONENT qt-material-widgets_Development
|
||||||
|
INCLUDES #
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${package}ConfigVersion.cmake"
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
# Allow package maintainers to freely override the path for the configs
|
||||||
|
set(
|
||||||
|
qt-material-widgets_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}"
|
||||||
|
CACHE PATH "CMake package config location relative to the install prefix"
|
||||||
|
)
|
||||||
|
mark_as_advanced(qt-material-widgets_INSTALL_CMAKEDIR)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES cmake/install-config.cmake
|
||||||
|
DESTINATION "${qt-material-widgets_INSTALL_CMAKEDIR}"
|
||||||
|
RENAME "${package}Config.cmake"
|
||||||
|
COMPONENT qt-material-widgets_Development
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
|
||||||
|
DESTINATION "${qt-material-widgets_INSTALL_CMAKEDIR}"
|
||||||
|
COMPONENT qt-material-widgets_Development
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
EXPORT qt-material-widgetsTargets
|
||||||
|
NAMESPACE qt-material-widgets::
|
||||||
|
DESTINATION "${qt-material-widgets_INSTALL_CMAKEDIR}"
|
||||||
|
COMPONENT qt-material-widgets_Development
|
||||||
|
)
|
||||||
|
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
include(CPack)
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
# Link Qt
|
||||||
|
set(QT_LIBRARIES_NAMES
|
||||||
|
Core
|
||||||
|
Gui
|
||||||
|
Widgets
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
|
||||||
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS ${QT_LIBRARIES_NAMES})
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_LIBRARIES_NAMES})
|
||||||
|
include_directories(%{Qt:QT_INSTALL_PREFIX})
|
||||||
|
|
||||||
|
list(APPEND QT_LIBRARIES
|
||||||
|
Qt${QT_VERSION_MAJOR}::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Gui
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
set(
|
||||||
|
FORMAT_PATTERNS
|
||||||
|
source/*.cpp source/*.hpp
|
||||||
|
include/*.hpp
|
||||||
|
test/*.cpp test/*.hpp
|
||||||
|
example/*.cpp example/*.hpp
|
||||||
|
CACHE STRING
|
||||||
|
"; separated patterns relative to the project source dir to format"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FORMAT_COMMAND clang-format CACHE STRING "Formatter to use")
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
format-check
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
||||||
|
-D "PATTERNS=${FORMAT_PATTERNS}"
|
||||||
|
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
|
COMMENT "Linting the code"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
format-fix
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
||||||
|
-D "PATTERNS=${FORMAT_PATTERNS}"
|
||||||
|
-D FIX=YES
|
||||||
|
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
|
COMMENT "Fixing the code"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
macro(default name)
|
||||||
|
if(NOT DEFINED "${name}")
|
||||||
|
set("${name}" "${ARGN}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
default(FORMAT_COMMAND clang-format)
|
||||||
|
default(
|
||||||
|
PATTERNS
|
||||||
|
source/*.cpp source/*.hpp
|
||||||
|
include/*.hpp
|
||||||
|
test/*.cpp test/*.hpp
|
||||||
|
example/*.cpp example/*.hpp
|
||||||
|
)
|
||||||
|
default(FIX NO)
|
||||||
|
|
||||||
|
set(flag --output-replacements-xml)
|
||||||
|
set(args OUTPUT_VARIABLE output)
|
||||||
|
if(FIX)
|
||||||
|
set(flag -i)
|
||||||
|
set(args "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(GLOB_RECURSE files ${PATTERNS})
|
||||||
|
set(badly_formatted "")
|
||||||
|
set(output "")
|
||||||
|
string(LENGTH "${CMAKE_SOURCE_DIR}/" path_prefix_length)
|
||||||
|
|
||||||
|
foreach(file IN LISTS files)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${FORMAT_COMMAND}" --style=file "${flag}" "${file}"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
${args}
|
||||||
|
)
|
||||||
|
if(NOT result EQUAL "0")
|
||||||
|
message(FATAL_ERROR "'${file}': formatter returned with ${result}")
|
||||||
|
endif()
|
||||||
|
if(NOT FIX AND output MATCHES "\n<replacement offset")
|
||||||
|
string(SUBSTRING "${file}" "${path_prefix_length}" -1 relative_file)
|
||||||
|
list(APPEND badly_formatted "${relative_file}")
|
||||||
|
endif()
|
||||||
|
set(output "")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT badly_formatted STREQUAL "")
|
||||||
|
list(JOIN badly_formatted "\n" bad_list)
|
||||||
|
message("The following files are badly formatted:\n\n${bad_list}\n")
|
||||||
|
message(FATAL_ERROR "Run again with FIX=YES to fix these files.")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Example file to run OpenCppCoverage on Windows
|
||||||
|
|
||||||
|
include(ProcessorCount)
|
||||||
|
ProcessorCount(N)
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/opencppcoverage")
|
||||||
|
|
||||||
|
# Convert delimiters to Windows ones
|
||||||
|
string(REPLACE "/" "\\" binary_dir "${PROJECT_BINARY_DIR}")
|
||||||
|
string(REPLACE "/" "\\" source_dir "${PROJECT_SOURCE_DIR}")
|
||||||
|
string(REPLACE "/" "\\" ctest "${CMAKE_CTEST_COMMAND}")
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
win-cov
|
||||||
|
COMMAND OpenCppCoverage -q
|
||||||
|
# We want coverage from the child processes of CTest
|
||||||
|
--cover_children
|
||||||
|
# Subdirectory where the tests reside in the binary directory
|
||||||
|
--modules "${binary_dir}\\test"
|
||||||
|
# This command is for the developer, so export as html instead of cobertura
|
||||||
|
--export_type "html:${binary_dir}\\opencppcoverage"
|
||||||
|
# Source (not header) file locations
|
||||||
|
--sources "${source_dir}\\source"
|
||||||
|
--sources "${source_dir}\\test\\source"
|
||||||
|
# Working directory for CTest, which should be the binary directory
|
||||||
|
--working_dir "${binary_dir}"
|
||||||
|
# OpenCppCoverage should be run only with the Debug configuration tests
|
||||||
|
-- "${ctest}" -C Debug --output-on-failure -j "${N}"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# ---- In-source guard ----
|
||||||
|
|
||||||
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"In-source builds are not supported. "
|
||||||
|
"Please read the BUILDING document before trying to build this project. "
|
||||||
|
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# This variable is set by project() in CMake 3.21+
|
||||||
|
string(
|
||||||
|
COMPARE EQUAL
|
||||||
|
"${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
|
||||||
|
PROJECT_IS_TOP_LEVEL
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
set(SPELL_COMMAND codespell CACHE STRING "Spell checker to use")
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
spell-check
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "SPELL_COMMAND=${SPELL_COMMAND}"
|
||||||
|
-P "${PROJECT_SOURCE_DIR}/cmake/spell.cmake"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
|
COMMENT "Checking spelling"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
spell-fix
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "SPELL_COMMAND=${SPELL_COMMAND}"
|
||||||
|
-D FIX=YES
|
||||||
|
-P "${PROJECT_SOURCE_DIR}/cmake/spell.cmake"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
|
COMMENT "Fixing spelling errors"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
macro(default name)
|
||||||
|
if(NOT DEFINED "${name}")
|
||||||
|
set("${name}" "${ARGN}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
default(SPELL_COMMAND codespell)
|
||||||
|
default(FIX NO)
|
||||||
|
|
||||||
|
set(flag "")
|
||||||
|
if(FIX)
|
||||||
|
set(flag -w)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${SPELL_COMMAND}" ${flag}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
|
||||||
|
if(result EQUAL "65")
|
||||||
|
message(FATAL_ERROR "Run again with FIX=YES to fix these errors.")
|
||||||
|
elseif(result EQUAL "64")
|
||||||
|
message(FATAL_ERROR "Spell checker printed the usage info. Bad arguments?")
|
||||||
|
elseif(NOT result EQUAL "0")
|
||||||
|
message(FATAL_ERROR "Spell checker returned with ${result}")
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
# ---- Developer mode ----
|
||||||
|
|
||||||
|
# Developer mode enables targets and code paths in the CMake scripts that are
|
||||||
|
# only relevant for the developer(s) of qt-material-widgets
|
||||||
|
# Targets necessary to build the project must be provided unconditionally, so
|
||||||
|
# consumers can trivially build and package the project
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
option(qt-material-widgets_DEVELOPER_MODE "Enable developer mode" OFF)
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libs." OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ---- Suppress C4251 on Windows ----
|
||||||
|
|
||||||
|
# Please see include/qt-material-widgets/qt-material-widgets.hpp for more details
|
||||||
|
set(pragma_suppress_c4251 "
|
||||||
|
/* This needs to suppress only for MSVC */
|
||||||
|
#if defined(_MSC_VER) && !defined(__ICL)
|
||||||
|
# define QT_MATERIAL_WIDGETS_SUPPRESS_C4251 _Pragma(\"warning(suppress:4251)\")
|
||||||
|
#else
|
||||||
|
# define QT_MATERIAL_WIDGETS_SUPPRESS_C4251
|
||||||
|
#endif
|
||||||
|
")
|
||||||
|
|
||||||
|
# ---- Warning guard ----
|
||||||
|
|
||||||
|
# target_include_directories with the SYSTEM modifier will request the compiler
|
||||||
|
# to omit warnings from the provided paths, if the compiler supports that
|
||||||
|
# This is to provide a user experience similar to find_package when
|
||||||
|
# add_subdirectory or FetchContent is used to consume this project
|
||||||
|
set(warning_guard "")
|
||||||
|
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||||
|
option(
|
||||||
|
qt-material-widgets_INCLUDES_WITH_SYSTEM
|
||||||
|
"Use SYSTEM modifier for qt-material-widgets's includes, disabling warnings"
|
||||||
|
ON
|
||||||
|
)
|
||||||
|
mark_as_advanced(qt-material-widgets_INCLUDES_WITH_SYSTEM)
|
||||||
|
if(qt-material-widgets_INCLUDES_WITH_SYSTEM)
|
||||||
|
set(warning_guard SYSTEM)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
# This function will add shared libraries to the PATH when running the test, so
|
||||||
|
# they can be found. Windows does not support RPATH or similar. See:
|
||||||
|
# https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order
|
||||||
|
# Usage: windows_set_path(<test> <target>...)
|
||||||
|
function(windows_set_path TEST)
|
||||||
|
if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(path "")
|
||||||
|
set(glue "")
|
||||||
|
foreach(target IN LISTS ARGN)
|
||||||
|
if(TARGET "${target}")
|
||||||
|
get_target_property(type "${target}" TYPE)
|
||||||
|
if(type STREQUAL "SHARED_LIBRARY")
|
||||||
|
set(path "${path}${glue}$<TARGET_FILE_DIR:${target}>")
|
||||||
|
set(glue "\;") # backslash is important
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(NOT path STREQUAL "")
|
||||||
|
set_property(TEST "${TEST}" PROPERTY ENVIRONMENT "PATH=${path}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
@ -1,130 +0,0 @@
|
||||||
TEMPLATE = lib
|
|
||||||
CONFIG += staticlib
|
|
||||||
SOURCES = \
|
|
||||||
qtmaterialavatar.cpp \
|
|
||||||
lib/qtmaterialstyle.cpp \
|
|
||||||
lib/qtmaterialtheme.cpp \
|
|
||||||
qtmaterialbadge.cpp \
|
|
||||||
lib/qtmaterialoverlaywidget.cpp \
|
|
||||||
qtmaterialcheckbox.cpp \
|
|
||||||
lib/qtmaterialcheckable_internal.cpp \
|
|
||||||
lib/qtmaterialcheckable.cpp \
|
|
||||||
lib/qtmaterialripple.cpp \
|
|
||||||
lib/qtmaterialrippleoverlay.cpp \
|
|
||||||
qtmaterialfab.cpp \
|
|
||||||
qtmaterialraisedbutton.cpp \
|
|
||||||
qtmaterialflatbutton_internal.cpp \
|
|
||||||
qtmaterialflatbutton.cpp \
|
|
||||||
lib/qtmaterialstatetransition.cpp \
|
|
||||||
qtmaterialiconbutton.cpp \
|
|
||||||
qtmaterialprogress_internal.cpp \
|
|
||||||
qtmaterialprogress.cpp \
|
|
||||||
qtmaterialcircularprogress_internal.cpp \
|
|
||||||
qtmaterialcircularprogress.cpp \
|
|
||||||
qtmaterialslider_internal.cpp \
|
|
||||||
qtmaterialslider.cpp \
|
|
||||||
qtmaterialsnackbar_internal.cpp \
|
|
||||||
qtmaterialsnackbar.cpp \
|
|
||||||
qtmaterialradiobutton.cpp \
|
|
||||||
qtmaterialtoggle_internal.cpp \
|
|
||||||
qtmaterialtoggle.cpp \
|
|
||||||
qtmaterialtextfield_internal.cpp \
|
|
||||||
qtmaterialtextfield.cpp \
|
|
||||||
qtmaterialtabs_internal.cpp \
|
|
||||||
qtmaterialtabs.cpp \
|
|
||||||
qtmaterialscrollbar_internal.cpp \
|
|
||||||
qtmaterialscrollbar.cpp \
|
|
||||||
qtmaterialdialog_internal.cpp \
|
|
||||||
qtmaterialdialog.cpp \
|
|
||||||
qtmaterialdrawer_internal.cpp \
|
|
||||||
qtmaterialdrawer.cpp \
|
|
||||||
qtmaterialappbar.cpp \
|
|
||||||
qtmaterialautocomplete.cpp \
|
|
||||||
qtmaterialpaper.cpp \
|
|
||||||
qtmaterialtable.cpp \
|
|
||||||
layouts/qtmaterialsnackbarlayout.cpp \
|
|
||||||
qtmaterialautocomplete_internal.cpp \
|
|
||||||
qtmaterialmenu.cpp \
|
|
||||||
qtmaterialmenu_internal.cpp \
|
|
||||||
qtmateriallist.cpp \
|
|
||||||
qtmateriallistitem.cpp
|
|
||||||
HEADERS = \
|
|
||||||
qtmaterialavatar_p.h \
|
|
||||||
qtmaterialavatar.h \
|
|
||||||
lib/qtmaterialstyle_p.h \
|
|
||||||
lib/qtmaterialstyle.h \
|
|
||||||
lib/qtmaterialtheme_p.h \
|
|
||||||
lib/qtmaterialtheme.h \
|
|
||||||
qtmaterialbadge_p.h \
|
|
||||||
qtmaterialbadge.h \
|
|
||||||
lib/qtmaterialoverlaywidget.h \
|
|
||||||
qtmaterialcheckbox_p.h \
|
|
||||||
qtmaterialcheckbox.h \
|
|
||||||
lib/qtmaterialcheckable_internal.h \
|
|
||||||
lib/qtmaterialcheckable_p.h \
|
|
||||||
lib/qtmaterialripple.h \
|
|
||||||
lib/qtmaterialrippleoverlay.h \
|
|
||||||
lib/qtmaterialcheckable.h \
|
|
||||||
qtmaterialfab_p.h \
|
|
||||||
qtmaterialfab.h \
|
|
||||||
qtmaterialraisedbutton_p.h \
|
|
||||||
qtmaterialraisedbutton.h \
|
|
||||||
qtmaterialflatbutton_internal.h \
|
|
||||||
qtmaterialflatbutton_p.h \
|
|
||||||
qtmaterialflatbutton.h \
|
|
||||||
lib/qtmaterialstatetransition.h \
|
|
||||||
lib/qtmaterialstatetransitionevent.h \
|
|
||||||
qtmaterialiconbutton_p.h \
|
|
||||||
qtmaterialiconbutton.h \
|
|
||||||
qtmaterialprogress_internal.h \
|
|
||||||
qtmaterialprogress_p.h \
|
|
||||||
qtmaterialprogress.h \
|
|
||||||
qtmaterialcircularprogress_internal.h \
|
|
||||||
qtmaterialcircularprogress_p.h \
|
|
||||||
qtmaterialcircularprogress.h \
|
|
||||||
qtmaterialslider_internal.h \
|
|
||||||
qtmaterialslider_p.h \
|
|
||||||
qtmaterialslider.h \
|
|
||||||
qtmaterialsnackbar_internal.h \
|
|
||||||
qtmaterialsnackbar_p.h \
|
|
||||||
qtmaterialsnackbar.h \
|
|
||||||
qtmaterialradiobutton_p.h \
|
|
||||||
qtmaterialradiobutton.h \
|
|
||||||
qtmaterialtoggle_internal.h \
|
|
||||||
qtmaterialtoggle_p.h \
|
|
||||||
qtmaterialtoggle.h \
|
|
||||||
qtmaterialtextfield_internal.h \
|
|
||||||
qtmaterialtextfield_p.h \
|
|
||||||
qtmaterialtextfield.h \
|
|
||||||
qtmaterialtabs_internal.h \
|
|
||||||
qtmaterialtabs_p.h \
|
|
||||||
qtmaterialtabs.h \
|
|
||||||
qtmaterialscrollbar_internal.h \
|
|
||||||
qtmaterialscrollbar_p.h \
|
|
||||||
qtmaterialscrollbar.h \
|
|
||||||
qtmaterialdialog_internal.h \
|
|
||||||
qtmaterialdialog_p.h \
|
|
||||||
qtmaterialdialog.h \
|
|
||||||
qtmaterialdrawer_internal.h \
|
|
||||||
qtmaterialdrawer_p.h \
|
|
||||||
qtmaterialdrawer.h \
|
|
||||||
qtmaterialappbar.h \
|
|
||||||
qtmaterialappbar_p.h \
|
|
||||||
qtmaterialautocomplete.h \
|
|
||||||
qtmaterialautocomplete_p.h \
|
|
||||||
qtmaterialpaper.h \
|
|
||||||
qtmaterialpaper_p.h \
|
|
||||||
qtmaterialtable.h \
|
|
||||||
qtmaterialtable_p.h \
|
|
||||||
layouts/qtmaterialsnackbarlayout.h \
|
|
||||||
layouts/qtmaterialsnackbarlayout_p.h \
|
|
||||||
qtmaterialautocomplete_internal.h \
|
|
||||||
qtmaterialmenu.h \
|
|
||||||
qtmaterialmenu_p.h \
|
|
||||||
qtmaterialmenu_internal.h \
|
|
||||||
qtmateriallist.h \
|
|
||||||
qtmateriallist_p.h \
|
|
||||||
qtmateriallistitem.h \
|
|
||||||
qtmateriallistitem_p.h
|
|
||||||
RESOURCES += \
|
|
||||||
resources.qrc
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef QTMATERIALOVERLAYWIDGET_H
|
|
||||||
#define QTMATERIALOVERLAYWIDGET_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
|
||||||
|
|
||||||
class QtMaterialOverlayWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialOverlayWidget(QWidget *parent = 0);
|
|
||||||
~QtMaterialOverlayWidget();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
virtual QRect overlayGeometry() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialOverlayWidget)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALOVERLAYWIDGET_H
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
||||||
#include "qtmaterialripple.h"
|
|
||||||
#include "lib/qtmaterialrippleoverlay.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \class QtMaterialRipple
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
|
|
||||||
QtMaterialRipple::QtMaterialRipple(const QPoint ¢er, QObject *parent)
|
|
||||||
: QParallelAnimationGroup(parent),
|
|
||||||
m_overlay(0),
|
|
||||||
m_radiusAnimation(animate("radius")),
|
|
||||||
m_opacityAnimation(animate("opacity")),
|
|
||||||
m_radius(0),
|
|
||||||
m_opacity(0),
|
|
||||||
m_center(center)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
QtMaterialRipple::QtMaterialRipple(const QPoint ¢er,
|
|
||||||
QtMaterialRippleOverlay *overlay,
|
|
||||||
QObject *parent)
|
|
||||||
: QParallelAnimationGroup(parent),
|
|
||||||
m_overlay(overlay),
|
|
||||||
m_radiusAnimation(animate("radius")),
|
|
||||||
m_opacityAnimation(animate("opacity")),
|
|
||||||
m_radius(0),
|
|
||||||
m_opacity(0),
|
|
||||||
m_center(center)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
QtMaterialRipple::~QtMaterialRipple()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialRipple::setRadius(qreal radius)
|
|
||||||
{
|
|
||||||
Q_ASSERT(m_overlay);
|
|
||||||
|
|
||||||
if (m_radius == radius) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_radius = radius;
|
|
||||||
m_overlay->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialRipple::setOpacity(qreal opacity)
|
|
||||||
{
|
|
||||||
Q_ASSERT(m_overlay);
|
|
||||||
|
|
||||||
if (m_opacity == opacity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_opacity = opacity;
|
|
||||||
m_overlay->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialRipple::setColor(const QColor &color)
|
|
||||||
{
|
|
||||||
if (m_brush.color() == color) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_brush.setColor(color);
|
|
||||||
|
|
||||||
if (m_overlay) {
|
|
||||||
m_overlay->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialRipple::setBrush(const QBrush &brush)
|
|
||||||
{
|
|
||||||
m_brush = brush;
|
|
||||||
|
|
||||||
if (m_overlay) {
|
|
||||||
m_overlay->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialRipple::destroy()
|
|
||||||
{
|
|
||||||
Q_ASSERT(m_overlay);
|
|
||||||
|
|
||||||
m_overlay->removeRipple(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
QPropertyAnimation *QtMaterialRipple::animate(const QByteArray &property,
|
|
||||||
const QEasingCurve &easing,
|
|
||||||
int duration)
|
|
||||||
{
|
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation;
|
|
||||||
animation->setTargetObject(this);
|
|
||||||
animation->setPropertyName(property);
|
|
||||||
animation->setEasingCurve(easing);
|
|
||||||
animation->setDuration(duration);
|
|
||||||
addAnimation(animation);
|
|
||||||
return animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
void QtMaterialRipple::init()
|
|
||||||
{
|
|
||||||
setOpacityStartValue(0.5);
|
|
||||||
setOpacityEndValue(0);
|
|
||||||
setRadiusStartValue(0);
|
|
||||||
setRadiusEndValue(300);
|
|
||||||
|
|
||||||
m_brush.setColor(Qt::black);
|
|
||||||
m_brush.setStyle(Qt::SolidPattern);
|
|
||||||
|
|
||||||
connect(this, SIGNAL(finished()), this, SLOT(destroy()));
|
|
||||||
}
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
#ifndef QTMATERIALRIPPLE_H
|
|
||||||
#define QTMATERIALRIPPLE_H
|
|
||||||
|
|
||||||
#include <QParallelAnimationGroup>
|
|
||||||
#include <QEasingCurve>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QPoint>
|
|
||||||
#include <QBrush>
|
|
||||||
|
|
||||||
class QtMaterialRippleOverlay;
|
|
||||||
|
|
||||||
class QtMaterialRipple : public QParallelAnimationGroup
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Q_PROPERTY(qreal radius WRITE setRadius READ radius)
|
|
||||||
Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialRipple(const QPoint ¢er, QObject *parent = 0);
|
|
||||||
QtMaterialRipple(const QPoint ¢er, QtMaterialRippleOverlay *overlay, QObject *parent = 0);
|
|
||||||
~QtMaterialRipple();
|
|
||||||
|
|
||||||
inline void setOverlay(QtMaterialRippleOverlay *overlay);
|
|
||||||
|
|
||||||
void setRadius(qreal radius);
|
|
||||||
inline qreal radius() const;
|
|
||||||
|
|
||||||
void setOpacity(qreal opacity);
|
|
||||||
inline qreal opacity() const;
|
|
||||||
|
|
||||||
void setColor(const QColor &color);
|
|
||||||
inline QColor color() const;
|
|
||||||
|
|
||||||
void setBrush(const QBrush &brush);
|
|
||||||
inline QBrush brush() const;
|
|
||||||
|
|
||||||
inline QPoint center() const;
|
|
||||||
|
|
||||||
inline QPropertyAnimation *radiusAnimation() const;
|
|
||||||
inline QPropertyAnimation *opacityAnimation() const;
|
|
||||||
|
|
||||||
inline void setOpacityStartValue(qreal value);
|
|
||||||
inline void setOpacityEndValue(qreal value);
|
|
||||||
inline void setRadiusStartValue(qreal value);
|
|
||||||
inline void setRadiusEndValue(qreal value);
|
|
||||||
inline void setDuration(int msecs);
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void destroy();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialRipple)
|
|
||||||
|
|
||||||
QPropertyAnimation *animate(const QByteArray &property,
|
|
||||||
const QEasingCurve &easing = QEasingCurve::OutQuad,
|
|
||||||
int duration = 800);
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
QtMaterialRippleOverlay *m_overlay;
|
|
||||||
QPropertyAnimation *const m_radiusAnimation;
|
|
||||||
QPropertyAnimation *const m_opacityAnimation;
|
|
||||||
qreal m_radius;
|
|
||||||
qreal m_opacity;
|
|
||||||
QPoint m_center;
|
|
||||||
QBrush m_brush;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setOverlay(QtMaterialRippleOverlay *overlay)
|
|
||||||
{
|
|
||||||
m_overlay = overlay;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline qreal QtMaterialRipple::radius() const
|
|
||||||
{
|
|
||||||
return m_radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline qreal QtMaterialRipple::opacity() const
|
|
||||||
{
|
|
||||||
return m_opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QColor QtMaterialRipple::color() const
|
|
||||||
{
|
|
||||||
return m_brush.color();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QBrush QtMaterialRipple::brush() const
|
|
||||||
{
|
|
||||||
return m_brush;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QPoint QtMaterialRipple::center() const
|
|
||||||
{
|
|
||||||
return m_center;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QPropertyAnimation *QtMaterialRipple::radiusAnimation() const
|
|
||||||
{
|
|
||||||
return m_radiusAnimation;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QPropertyAnimation *QtMaterialRipple::opacityAnimation() const
|
|
||||||
{
|
|
||||||
return m_opacityAnimation;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setOpacityStartValue(qreal value)
|
|
||||||
{
|
|
||||||
m_opacityAnimation->setStartValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setOpacityEndValue(qreal value)
|
|
||||||
{
|
|
||||||
m_opacityAnimation->setEndValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setRadiusStartValue(qreal value)
|
|
||||||
{
|
|
||||||
m_radiusAnimation->setStartValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setRadiusEndValue(qreal value)
|
|
||||||
{
|
|
||||||
m_radiusAnimation->setEndValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRipple::setDuration(int msecs)
|
|
||||||
{
|
|
||||||
m_radiusAnimation->setDuration(msecs);
|
|
||||||
m_opacityAnimation->setDuration(msecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QTMATERIALRIPPLE_H
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
#ifndef QTMATERIALRIPPLEOVERLAY_H
|
|
||||||
#define QTMATERIALRIPPLEOVERLAY_H
|
|
||||||
|
|
||||||
#include <QPainterPath>
|
|
||||||
#include "lib/qtmaterialoverlaywidget.h"
|
|
||||||
|
|
||||||
class QtMaterialRipple;
|
|
||||||
|
|
||||||
class QtMaterialRippleOverlay : public QtMaterialOverlayWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialRippleOverlay(QWidget *parent = 0);
|
|
||||||
~QtMaterialRippleOverlay();
|
|
||||||
|
|
||||||
void addRipple(QtMaterialRipple *ripple);
|
|
||||||
void addRipple(const QPoint &position, qreal radius = 300);
|
|
||||||
|
|
||||||
void removeRipple(QtMaterialRipple *ripple);
|
|
||||||
|
|
||||||
inline void setClipping(bool enable);
|
|
||||||
inline bool hasClipping() const;
|
|
||||||
|
|
||||||
inline void setClipPath(const QPainterPath &path);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
inline QList<QtMaterialRipple *> ripples() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialRippleOverlay)
|
|
||||||
|
|
||||||
void paintRipple(QPainter *painter, QtMaterialRipple *ripple);
|
|
||||||
|
|
||||||
QList<QtMaterialRipple *> m_ripples;
|
|
||||||
QPainterPath m_clipPath;
|
|
||||||
bool m_useClip;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void QtMaterialRippleOverlay::setClipping(bool enable)
|
|
||||||
{
|
|
||||||
m_useClip = enable;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool QtMaterialRippleOverlay::hasClipping() const
|
|
||||||
{
|
|
||||||
return m_useClip;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void QtMaterialRippleOverlay::setClipPath(const QPainterPath &path)
|
|
||||||
{
|
|
||||||
m_clipPath = path;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QList<QtMaterialRipple *> QtMaterialRippleOverlay::ripples() const
|
|
||||||
{
|
|
||||||
return m_ripples;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QTMATERIALRIPPLEOVERLAY_H
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#ifndef QTMATERIALSTATETRANSITION_H
|
|
||||||
#define QTMATERIALSTATETRANSITION_H
|
|
||||||
|
|
||||||
#include <QAbstractTransition>
|
|
||||||
#include "lib/qtmaterialstatetransitionevent.h"
|
|
||||||
|
|
||||||
class QtMaterialStateTransition : public QAbstractTransition
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QtMaterialStateTransition(QtMaterialStateTransitionType type);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool eventTest(QEvent *event);
|
|
||||||
virtual void onTransition(QEvent *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QtMaterialStateTransitionType m_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALSTATETRANSITION_H
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
#ifndef QTMATERIALSTATETRANSITIONEVENT_H
|
|
||||||
#define QTMATERIALSTATETRANSITIONEVENT_H
|
|
||||||
|
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
enum QtMaterialStateTransitionType {
|
|
||||||
// Snackbar
|
|
||||||
SnackbarShowTransition = 1,
|
|
||||||
SnackbarHideTransition,
|
|
||||||
SnackbarWaitTransition,
|
|
||||||
SnackbarNextTransition,
|
|
||||||
// FlatButton
|
|
||||||
FlatButtonPressedTransition,
|
|
||||||
FlatButtonCheckedTransition,
|
|
||||||
FlatButtonUncheckedTransition,
|
|
||||||
// CollapsibleMenu
|
|
||||||
CollapsibleMenuExpand,
|
|
||||||
CollapsibleMenuCollapse,
|
|
||||||
// Slider
|
|
||||||
SliderChangedToMinimum,
|
|
||||||
SliderChangedFromMinimum,
|
|
||||||
SliderNoFocusMouseEnter,
|
|
||||||
SliderNoFocusMouseLeave,
|
|
||||||
// Dialog
|
|
||||||
DialogShowTransition,
|
|
||||||
DialogHideTransition,
|
|
||||||
//
|
|
||||||
MaxTransitionType = 65535
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QtMaterialStateTransitionEvent : public QEvent
|
|
||||||
{
|
|
||||||
QtMaterialStateTransitionEvent(QtMaterialStateTransitionType type)
|
|
||||||
: QEvent(QEvent::Type(QEvent::User + 1)),
|
|
||||||
type(type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QtMaterialStateTransitionType type;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALSTATETRANSITIONEVENT_H
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
#ifndef QTMATERIALSTYLE_H
|
|
||||||
#define QTMATERIALSTYLE_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QCommonStyle>
|
|
||||||
#include "lib/qtmaterialstyle_p.h"
|
|
||||||
|
|
||||||
#define MATERIAL_DISABLE_THEME_COLORS \
|
|
||||||
if (d->useThemeColors == true) { d->useThemeColors = false; }
|
|
||||||
|
|
||||||
class QtMaterialTheme;
|
|
||||||
|
|
||||||
class QtMaterialStyle : public QCommonStyle
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
inline static QtMaterialStyle &instance();
|
|
||||||
|
|
||||||
void setTheme(QtMaterialTheme *theme);
|
|
||||||
QColor themeColor(const QString &key) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const QScopedPointer<QtMaterialStylePrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialStyle)
|
|
||||||
|
|
||||||
QtMaterialStyle();
|
|
||||||
|
|
||||||
QtMaterialStyle(QtMaterialStyle const &);
|
|
||||||
void operator=(QtMaterialStyle const &);
|
|
||||||
};
|
|
||||||
|
|
||||||
inline QtMaterialStyle &QtMaterialStyle::instance()
|
|
||||||
{
|
|
||||||
static QtMaterialStyle instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QTMATERIALSTYLE_H
|
|
||||||
|
|
@ -1,344 +0,0 @@
|
||||||
#ifndef QTMATERIALTHEME_H
|
|
||||||
#define QTMATERIALTHEME_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QScopedPointer>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QIcon>
|
|
||||||
|
|
||||||
namespace Material
|
|
||||||
{
|
|
||||||
enum ButtonPreset {
|
|
||||||
FlatPreset,
|
|
||||||
CheckablePreset
|
|
||||||
};
|
|
||||||
|
|
||||||
enum RippleStyle {
|
|
||||||
CenteredRipple,
|
|
||||||
PositionedRipple,
|
|
||||||
NoRipple
|
|
||||||
};
|
|
||||||
|
|
||||||
enum OverlayStyle {
|
|
||||||
NoOverlay,
|
|
||||||
TintedOverlay,
|
|
||||||
GrayOverlay
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Role {
|
|
||||||
Default,
|
|
||||||
Primary,
|
|
||||||
Secondary
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ButtonIconPlacement {
|
|
||||||
LeftIcon,
|
|
||||||
RightIcon
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ProgressType {
|
|
||||||
DeterminateProgress,
|
|
||||||
IndeterminateProgress
|
|
||||||
};
|
|
||||||
|
|
||||||
enum AvatarType {
|
|
||||||
ImageAvatar,
|
|
||||||
IconAvatar,
|
|
||||||
LetterAvatar
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Color {
|
|
||||||
red50,
|
|
||||||
red100,
|
|
||||||
red200,
|
|
||||||
red300,
|
|
||||||
red400,
|
|
||||||
red500,
|
|
||||||
red600,
|
|
||||||
red700,
|
|
||||||
red800,
|
|
||||||
red900,
|
|
||||||
redA100,
|
|
||||||
redA200,
|
|
||||||
redA400,
|
|
||||||
redA700,
|
|
||||||
pink50,
|
|
||||||
pink100,
|
|
||||||
pink200,
|
|
||||||
pink300,
|
|
||||||
pink400,
|
|
||||||
pink500,
|
|
||||||
pink600,
|
|
||||||
pink700,
|
|
||||||
pink800,
|
|
||||||
pink900,
|
|
||||||
pinkA100,
|
|
||||||
pinkA200,
|
|
||||||
pinkA400,
|
|
||||||
pinkA700,
|
|
||||||
purple50,
|
|
||||||
purple100,
|
|
||||||
purple200,
|
|
||||||
purple300,
|
|
||||||
purple400,
|
|
||||||
purple500,
|
|
||||||
purple600,
|
|
||||||
purple700,
|
|
||||||
purple800,
|
|
||||||
purple900,
|
|
||||||
purpleA100,
|
|
||||||
purpleA200,
|
|
||||||
purpleA400,
|
|
||||||
purpleA700,
|
|
||||||
deepPurple50,
|
|
||||||
deepPurple100,
|
|
||||||
deepPurple200,
|
|
||||||
deepPurple300,
|
|
||||||
deepPurple400,
|
|
||||||
deepPurple500,
|
|
||||||
deepPurple600,
|
|
||||||
deepPurple700,
|
|
||||||
deepPurple800,
|
|
||||||
deepPurple900,
|
|
||||||
deepPurpleA100,
|
|
||||||
deepPurpleA200,
|
|
||||||
deepPurpleA400,
|
|
||||||
deepPurpleA700,
|
|
||||||
indigo50,
|
|
||||||
indigo100,
|
|
||||||
indigo200,
|
|
||||||
indigo300,
|
|
||||||
indigo400,
|
|
||||||
indigo500,
|
|
||||||
indigo600,
|
|
||||||
indigo700,
|
|
||||||
indigo800,
|
|
||||||
indigo900,
|
|
||||||
indigoA100,
|
|
||||||
indigoA200,
|
|
||||||
indigoA400,
|
|
||||||
indigoA700,
|
|
||||||
blue50,
|
|
||||||
blue100,
|
|
||||||
blue200,
|
|
||||||
blue300,
|
|
||||||
blue400,
|
|
||||||
blue500,
|
|
||||||
blue600,
|
|
||||||
blue700,
|
|
||||||
blue800,
|
|
||||||
blue900,
|
|
||||||
blueA100,
|
|
||||||
blueA200,
|
|
||||||
blueA400,
|
|
||||||
blueA700,
|
|
||||||
lightBlue50,
|
|
||||||
lightBlue100,
|
|
||||||
lightBlue200,
|
|
||||||
lightBlue300,
|
|
||||||
lightBlue400,
|
|
||||||
lightBlue500,
|
|
||||||
lightBlue600,
|
|
||||||
lightBlue700,
|
|
||||||
lightBlue800,
|
|
||||||
lightBlue900,
|
|
||||||
lightBlueA100,
|
|
||||||
lightBlueA200,
|
|
||||||
lightBlueA400,
|
|
||||||
lightBlueA700,
|
|
||||||
cyan50,
|
|
||||||
cyan100,
|
|
||||||
cyan200,
|
|
||||||
cyan300,
|
|
||||||
cyan400,
|
|
||||||
cyan500,
|
|
||||||
cyan600,
|
|
||||||
cyan700,
|
|
||||||
cyan800,
|
|
||||||
cyan900,
|
|
||||||
cyanA100,
|
|
||||||
cyanA200,
|
|
||||||
cyanA400,
|
|
||||||
cyanA700,
|
|
||||||
teal50,
|
|
||||||
teal100,
|
|
||||||
teal200,
|
|
||||||
teal300,
|
|
||||||
teal400,
|
|
||||||
teal500,
|
|
||||||
teal600,
|
|
||||||
teal700,
|
|
||||||
teal800,
|
|
||||||
teal900,
|
|
||||||
tealA100,
|
|
||||||
tealA200,
|
|
||||||
tealA400,
|
|
||||||
tealA700,
|
|
||||||
green50,
|
|
||||||
green100,
|
|
||||||
green200,
|
|
||||||
green300,
|
|
||||||
green400,
|
|
||||||
green500,
|
|
||||||
green600,
|
|
||||||
green700,
|
|
||||||
green800,
|
|
||||||
green900,
|
|
||||||
greenA100,
|
|
||||||
greenA200,
|
|
||||||
greenA400,
|
|
||||||
greenA700,
|
|
||||||
lightGreen50,
|
|
||||||
lightGreen100,
|
|
||||||
lightGreen200,
|
|
||||||
lightGreen300,
|
|
||||||
lightGreen400,
|
|
||||||
lightGreen500,
|
|
||||||
lightGreen600,
|
|
||||||
lightGreen700,
|
|
||||||
lightGreen800,
|
|
||||||
lightGreen900,
|
|
||||||
lightGreenA100,
|
|
||||||
lightGreenA200,
|
|
||||||
lightGreenA400,
|
|
||||||
lightGreenA700,
|
|
||||||
lime50,
|
|
||||||
lime100,
|
|
||||||
lime200,
|
|
||||||
lime300,
|
|
||||||
lime400,
|
|
||||||
lime500,
|
|
||||||
lime600,
|
|
||||||
lime700,
|
|
||||||
lime800,
|
|
||||||
lime900,
|
|
||||||
limeA100,
|
|
||||||
limeA200,
|
|
||||||
limeA400,
|
|
||||||
limeA700,
|
|
||||||
yellow50,
|
|
||||||
yellow100,
|
|
||||||
yellow200,
|
|
||||||
yellow300,
|
|
||||||
yellow400,
|
|
||||||
yellow500,
|
|
||||||
yellow600,
|
|
||||||
yellow700,
|
|
||||||
yellow800,
|
|
||||||
yellow900,
|
|
||||||
yellowA100,
|
|
||||||
yellowA200,
|
|
||||||
yellowA400,
|
|
||||||
yellowA700,
|
|
||||||
amber50,
|
|
||||||
amber100,
|
|
||||||
amber200,
|
|
||||||
amber300,
|
|
||||||
amber400,
|
|
||||||
amber500,
|
|
||||||
amber600,
|
|
||||||
amber700,
|
|
||||||
amber800,
|
|
||||||
amber900,
|
|
||||||
amberA100,
|
|
||||||
amberA200,
|
|
||||||
amberA400,
|
|
||||||
amberA700,
|
|
||||||
orange50,
|
|
||||||
orange100,
|
|
||||||
orange200,
|
|
||||||
orange300,
|
|
||||||
orange400,
|
|
||||||
orange500,
|
|
||||||
orange600,
|
|
||||||
orange700,
|
|
||||||
orange800,
|
|
||||||
orange900,
|
|
||||||
orangeA100,
|
|
||||||
orangeA200,
|
|
||||||
orangeA400,
|
|
||||||
orangeA700,
|
|
||||||
deepOrange50,
|
|
||||||
deepOrange100,
|
|
||||||
deepOrange200,
|
|
||||||
deepOrange300,
|
|
||||||
deepOrange400,
|
|
||||||
deepOrange500,
|
|
||||||
deepOrange600,
|
|
||||||
deepOrange700,
|
|
||||||
deepOrange800,
|
|
||||||
deepOrange900,
|
|
||||||
deepOrangeA100,
|
|
||||||
deepOrangeA200,
|
|
||||||
deepOrangeA400,
|
|
||||||
deepOrangeA700,
|
|
||||||
brown50,
|
|
||||||
brown100,
|
|
||||||
brown200,
|
|
||||||
brown300,
|
|
||||||
brown400,
|
|
||||||
brown500,
|
|
||||||
brown600,
|
|
||||||
brown700,
|
|
||||||
brown800,
|
|
||||||
brown900,
|
|
||||||
blueGrey50,
|
|
||||||
blueGrey100,
|
|
||||||
blueGrey200,
|
|
||||||
blueGrey300,
|
|
||||||
blueGrey400,
|
|
||||||
blueGrey500,
|
|
||||||
blueGrey600,
|
|
||||||
blueGrey700,
|
|
||||||
blueGrey800,
|
|
||||||
blueGrey900,
|
|
||||||
grey50,
|
|
||||||
grey100,
|
|
||||||
grey200,
|
|
||||||
grey300,
|
|
||||||
grey400,
|
|
||||||
grey500,
|
|
||||||
grey600,
|
|
||||||
grey700,
|
|
||||||
grey800,
|
|
||||||
grey900,
|
|
||||||
black,
|
|
||||||
white,
|
|
||||||
transparent,
|
|
||||||
fullBlack,
|
|
||||||
darkBlack,
|
|
||||||
lightBlack,
|
|
||||||
minBlack,
|
|
||||||
faintBlack,
|
|
||||||
fullWhite,
|
|
||||||
darkWhite,
|
|
||||||
lightWhite
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class QtMaterialThemePrivate;
|
|
||||||
|
|
||||||
class QtMaterialTheme : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialTheme(QObject *parent = 0);
|
|
||||||
~QtMaterialTheme();
|
|
||||||
|
|
||||||
QColor getColor(const QString &key) const;
|
|
||||||
|
|
||||||
void setColor(const QString &key, const QColor &color);
|
|
||||||
void setColor(const QString &key, Material::Color color);
|
|
||||||
|
|
||||||
static QIcon icon(QString category, QString icon);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const QScopedPointer<QtMaterialThemePrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialTheme)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialTheme)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALTHEME_H
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
#ifndef QTMATERIALAPPBAR_H
|
|
||||||
#define QTMATERIALAPPBAR_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
|
||||||
#include <QtWidgets/QHBoxLayout>
|
|
||||||
|
|
||||||
class QtMaterialAppBarPrivate;
|
|
||||||
|
|
||||||
class QtMaterialAppBar : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
|
|
||||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialAppBar(QWidget *parent = 0);
|
|
||||||
~QtMaterialAppBar();
|
|
||||||
|
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
void setUseThemeColors(bool value);
|
|
||||||
bool useThemeColors() const;
|
|
||||||
|
|
||||||
void setForegroundColor(const QColor &color);
|
|
||||||
QColor foregroundColor() const;
|
|
||||||
|
|
||||||
void setBackgroundColor(const QColor &color);
|
|
||||||
QColor backgroundColor() const;
|
|
||||||
|
|
||||||
inline QHBoxLayout *appBarLayout() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
const QScopedPointer<QtMaterialAppBarPrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialAppBar)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialAppBar)
|
|
||||||
};
|
|
||||||
|
|
||||||
inline QHBoxLayout *QtMaterialAppBar::appBarLayout() const
|
|
||||||
{
|
|
||||||
return static_cast<QHBoxLayout *>(layout());
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QTMATERIALAPPBAR_H
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
#ifndef QTMATERIALAUTOCOMPLETE_H
|
|
||||||
#define QTMATERIALAUTOCOMPLETE_H
|
|
||||||
|
|
||||||
#include "qtmaterialtextfield.h"
|
|
||||||
|
|
||||||
class QtMaterialAutoCompletePrivate;
|
|
||||||
|
|
||||||
class QtMaterialAutoComplete : public QtMaterialTextField
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialAutoComplete(QWidget *parent = 0);
|
|
||||||
~QtMaterialAutoComplete();
|
|
||||||
|
|
||||||
void setDataSource(const QStringList &data);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void itemSelected(QString);
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void updateResults(QString text);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialAutoComplete)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialAutoComplete)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALAUTOCOMPLETE_H
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#include "qtmaterialautocomplete_internal.h"
|
|
||||||
#include <QSignalTransition>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QtWidgets/QGraphicsOpacityEffect>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \class QtMaterialAutoCompleteStateMachine
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
QtMaterialAutoCompleteStateMachine::QtMaterialAutoCompleteStateMachine(QWidget *menu)
|
|
||||||
: QStateMachine(menu),
|
|
||||||
m_menu(menu),
|
|
||||||
m_closedState(new QState),
|
|
||||||
m_openState(new QState),
|
|
||||||
m_closingState(new QState)
|
|
||||||
{
|
|
||||||
Q_ASSERT(menu);
|
|
||||||
|
|
||||||
addState(m_closedState);
|
|
||||||
addState(m_openState);
|
|
||||||
addState(m_closingState);
|
|
||||||
setInitialState(m_closedState);
|
|
||||||
|
|
||||||
QSignalTransition *transition;
|
|
||||||
|
|
||||||
transition = new QSignalTransition(this, SIGNAL(shouldOpen()));
|
|
||||||
transition->setTargetState(m_openState);
|
|
||||||
m_closedState->addTransition(transition);
|
|
||||||
|
|
||||||
transition = new QSignalTransition(this, SIGNAL(shouldClose()));
|
|
||||||
transition->setTargetState(m_closedState);
|
|
||||||
m_openState->addTransition(transition);
|
|
||||||
|
|
||||||
transition = new QSignalTransition(this, SIGNAL(shouldFade()));
|
|
||||||
transition->setTargetState(m_closingState);
|
|
||||||
m_openState->addTransition(transition);
|
|
||||||
|
|
||||||
m_closedState->assignProperty(menu, "visible", false);
|
|
||||||
m_openState->assignProperty(menu, "visible", true);
|
|
||||||
|
|
||||||
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
|
|
||||||
menu->setGraphicsEffect(effect);
|
|
||||||
|
|
||||||
m_openState->assignProperty(effect, "opacity", 1);
|
|
||||||
m_closingState->assignProperty(effect, "opacity", 0);
|
|
||||||
m_closedState->assignProperty(effect, "opacity", 0);
|
|
||||||
|
|
||||||
QPropertyAnimation *animation;
|
|
||||||
|
|
||||||
animation = new QPropertyAnimation(effect, "opacity", this);
|
|
||||||
animation->setDuration(240);
|
|
||||||
addDefaultAnimation(animation);
|
|
||||||
|
|
||||||
transition = new QSignalTransition(animation, SIGNAL(finished()));
|
|
||||||
transition->setTargetState(m_closedState);
|
|
||||||
m_closingState->addTransition(transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
QtMaterialAutoCompleteStateMachine::~QtMaterialAutoCompleteStateMachine()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef QTMATERIALAUTOCOMPLETE_P_H
|
|
||||||
#define QTMATERIALAUTOCOMPLETE_P_H
|
|
||||||
|
|
||||||
#include "qtmaterialtextfield_p.h"
|
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QtMaterialAutoCompleteOverlay;
|
|
||||||
class QtMaterialAutoCompleteStateMachine;
|
|
||||||
|
|
||||||
class QtMaterialAutoCompletePrivate : public QtMaterialTextFieldPrivate
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(QtMaterialAutoCompletePrivate)
|
|
||||||
Q_DECLARE_PUBLIC(QtMaterialAutoComplete)
|
|
||||||
|
|
||||||
public:
|
|
||||||
QtMaterialAutoCompletePrivate(QtMaterialAutoComplete *q);
|
|
||||||
virtual ~QtMaterialAutoCompletePrivate();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
QWidget *menu;
|
|
||||||
QWidget *frame;
|
|
||||||
QtMaterialAutoCompleteStateMachine *stateMachine;
|
|
||||||
QVBoxLayout *menuLayout;
|
|
||||||
QStringList dataSource;
|
|
||||||
int maxWidth;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALAUTOCOMPLETE_P_H
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
#ifndef QTMATERIALAVATAR_H
|
|
||||||
#define QTMATERIALAVATAR_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
|
||||||
#include "lib/qtmaterialtheme.h"
|
|
||||||
|
|
||||||
class QtMaterialAvatarPrivate;
|
|
||||||
|
|
||||||
class QtMaterialAvatar : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialAvatar(QWidget *parent = 0);
|
|
||||||
explicit QtMaterialAvatar(const QIcon &icon, QWidget *parent = 0);
|
|
||||||
explicit QtMaterialAvatar(const QChar &letter, QWidget *parent = 0);
|
|
||||||
explicit QtMaterialAvatar(const QImage &image, QWidget *parent = 0);
|
|
||||||
~QtMaterialAvatar();
|
|
||||||
|
|
||||||
void setUseThemeColors(bool value);
|
|
||||||
bool useThemeColors() const;
|
|
||||||
|
|
||||||
void setTextColor(const QColor &color);
|
|
||||||
QColor textColor() const;
|
|
||||||
|
|
||||||
void setBackgroundColor(const QColor &color);
|
|
||||||
QColor backgroundColor() const;
|
|
||||||
|
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
void setSize(int size);
|
|
||||||
int size() const;
|
|
||||||
|
|
||||||
void setLetter(const QChar &letter);
|
|
||||||
void setImage(const QImage &image);
|
|
||||||
void setIcon(const QIcon &icon);
|
|
||||||
|
|
||||||
Material::AvatarType type() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
const QScopedPointer<QtMaterialAvatarPrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialAvatar)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialAvatar)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALAVATAR_H
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
#ifndef QTMATERIALBADGE_H
|
|
||||||
#define QTMATERIALBADGE_H
|
|
||||||
|
|
||||||
#include "lib/qtmaterialoverlaywidget.h"
|
|
||||||
|
|
||||||
class QtMaterialBadgePrivate;
|
|
||||||
|
|
||||||
class QtMaterialBadge : public QtMaterialOverlayWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
|
||||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
|
||||||
Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialBadge(QWidget *parent = 0);
|
|
||||||
explicit QtMaterialBadge(const QIcon &icon, QWidget *parent = 0);
|
|
||||||
explicit QtMaterialBadge(const QString &text, QWidget *parent = 0);
|
|
||||||
~QtMaterialBadge();
|
|
||||||
|
|
||||||
void setUseThemeColors(bool value);
|
|
||||||
bool useThemeColors() const;
|
|
||||||
|
|
||||||
void setTextColor(const QColor &color);
|
|
||||||
QColor textColor() const;
|
|
||||||
|
|
||||||
void setBackgroundColor(const QColor &color);
|
|
||||||
QColor backgroundColor() const;
|
|
||||||
|
|
||||||
void setRelativePosition(const QPointF &pos);
|
|
||||||
void setRelativePosition(qreal x, qreal y);
|
|
||||||
QPointF relativePosition() const;
|
|
||||||
|
|
||||||
void setRelativeXPosition(qreal x);
|
|
||||||
qreal relativeXPosition() const;
|
|
||||||
|
|
||||||
void setRelativeYPosition(qreal y);
|
|
||||||
qreal relativeYPosition() const;
|
|
||||||
|
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
void setIcon(const QIcon &icon);
|
|
||||||
QIcon icon() const;
|
|
||||||
|
|
||||||
void setText(const QString &text);
|
|
||||||
QString text() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
int getDiameter() const;
|
|
||||||
|
|
||||||
const QScopedPointer<QtMaterialBadgePrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialBadge)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialBadge)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALBADGE_H
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
||||||
#include "qtmaterialdialog.h"
|
|
||||||
#include "qtmaterialdialog_p.h"
|
|
||||||
#include <QtWidgets/QStackedLayout>
|
|
||||||
#include <QtWidgets/QGraphicsDropShadowEffect>
|
|
||||||
#include <QStateMachine>
|
|
||||||
#include <QState>
|
|
||||||
#include <QtWidgets/QApplication>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QPainter>
|
|
||||||
#include "qtmaterialdialog_internal.h"
|
|
||||||
#include "lib/qtmaterialstatetransition.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \class QtMaterialDialogPrivate
|
|
||||||
* \internal
|
|
||||||
*/
|
|
||||||
|
|
||||||
QtMaterialDialogPrivate::QtMaterialDialogPrivate(QtMaterialDialog *q)
|
|
||||||
: q_ptr(q)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QtMaterialDialogPrivate::~QtMaterialDialogPrivate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialDialogPrivate::init()
|
|
||||||
{
|
|
||||||
Q_Q(QtMaterialDialog);
|
|
||||||
|
|
||||||
dialogWindow = new QtMaterialDialogWindow(q);
|
|
||||||
proxyStack = new QStackedLayout;
|
|
||||||
stateMachine = new QStateMachine(q);
|
|
||||||
proxy = new QtMaterialDialogProxy(dialogWindow, proxyStack, q);
|
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
|
||||||
q->setLayout(layout);
|
|
||||||
|
|
||||||
QWidget *widget = new QWidget;
|
|
||||||
widget->setLayout(proxyStack);
|
|
||||||
widget->setMinimumWidth(400);
|
|
||||||
|
|
||||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
|
||||||
effect->setColor(QColor(0, 0, 0, 200));
|
|
||||||
effect->setBlurRadius(64);
|
|
||||||
effect->setOffset(0, 13);
|
|
||||||
widget->setGraphicsEffect(effect);
|
|
||||||
|
|
||||||
layout->addWidget(widget);
|
|
||||||
layout->setAlignment(widget, Qt::AlignCenter);
|
|
||||||
|
|
||||||
proxyStack->addWidget(dialogWindow);
|
|
||||||
proxyStack->addWidget(proxy);
|
|
||||||
proxyStack->setCurrentIndex(1);
|
|
||||||
|
|
||||||
q->setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
||||||
|
|
||||||
QState *hiddenState = new QState;
|
|
||||||
QState *visibleState = new QState;
|
|
||||||
|
|
||||||
stateMachine->addState(hiddenState);
|
|
||||||
stateMachine->addState(visibleState);
|
|
||||||
stateMachine->setInitialState(hiddenState);
|
|
||||||
|
|
||||||
QtMaterialStateTransition *transition;
|
|
||||||
|
|
||||||
transition = new QtMaterialStateTransition(DialogShowTransition);
|
|
||||||
transition->setTargetState(visibleState);
|
|
||||||
hiddenState->addTransition(transition);
|
|
||||||
|
|
||||||
transition = new QtMaterialStateTransition(DialogHideTransition);
|
|
||||||
transition->setTargetState(hiddenState);
|
|
||||||
visibleState->addTransition(transition);
|
|
||||||
|
|
||||||
visibleState->assignProperty(proxy, "opacity", 1);
|
|
||||||
visibleState->assignProperty(effect, "color", QColor(0, 0, 0, 200));
|
|
||||||
visibleState->assignProperty(dialogWindow, "offset", 0);
|
|
||||||
hiddenState->assignProperty(proxy, "opacity", 0);
|
|
||||||
hiddenState->assignProperty(effect, "color", QColor(0, 0, 0, 0));
|
|
||||||
hiddenState->assignProperty(dialogWindow, "offset", 200);
|
|
||||||
|
|
||||||
QPropertyAnimation *animation;
|
|
||||||
|
|
||||||
animation = new QPropertyAnimation(proxy, "opacity", q);
|
|
||||||
animation->setDuration(280);
|
|
||||||
stateMachine->addDefaultAnimation(animation);
|
|
||||||
|
|
||||||
animation = new QPropertyAnimation(effect, "color", q);
|
|
||||||
animation->setDuration(280);
|
|
||||||
stateMachine->addDefaultAnimation(animation);
|
|
||||||
|
|
||||||
animation = new QPropertyAnimation(dialogWindow, "offset", q);
|
|
||||||
animation->setDuration(280);
|
|
||||||
animation->setEasingCurve(QEasingCurve::OutCirc);
|
|
||||||
stateMachine->addDefaultAnimation(animation);
|
|
||||||
|
|
||||||
QObject::connect(visibleState, SIGNAL(propertiesAssigned()),
|
|
||||||
proxy, SLOT(makeOpaque()));
|
|
||||||
QObject::connect(hiddenState, SIGNAL(propertiesAssigned()),
|
|
||||||
proxy, SLOT(makeTransparent()));
|
|
||||||
|
|
||||||
stateMachine->start();
|
|
||||||
QCoreApplication::processEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \class QtMaterialDialog
|
|
||||||
*/
|
|
||||||
|
|
||||||
QtMaterialDialog::QtMaterialDialog(QWidget *parent)
|
|
||||||
: QtMaterialOverlayWidget(parent),
|
|
||||||
d_ptr(new QtMaterialDialogPrivate(this))
|
|
||||||
{
|
|
||||||
d_func()->init();
|
|
||||||
}
|
|
||||||
|
|
||||||
QtMaterialDialog::~QtMaterialDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QLayout *QtMaterialDialog::windowLayout() const
|
|
||||||
{
|
|
||||||
Q_D(const QtMaterialDialog);
|
|
||||||
|
|
||||||
return d->dialogWindow->layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialDialog::setWindowLayout(QLayout *layout)
|
|
||||||
{
|
|
||||||
Q_D(QtMaterialDialog);
|
|
||||||
|
|
||||||
d->dialogWindow->setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialDialog::showDialog()
|
|
||||||
{
|
|
||||||
Q_D(QtMaterialDialog);
|
|
||||||
|
|
||||||
d->stateMachine->postEvent(new QtMaterialStateTransitionEvent(DialogShowTransition));
|
|
||||||
raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialDialog::hideDialog()
|
|
||||||
{
|
|
||||||
Q_D(QtMaterialDialog);
|
|
||||||
|
|
||||||
d->stateMachine->postEvent(new QtMaterialStateTransitionEvent(DialogHideTransition));
|
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
||||||
d->proxyStack->setCurrentIndex(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtMaterialDialog::paintEvent(QPaintEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
|
|
||||||
Q_D(QtMaterialDialog);
|
|
||||||
|
|
||||||
QPainter painter(this);
|
|
||||||
|
|
||||||
QBrush brush;
|
|
||||||
brush.setStyle(Qt::SolidPattern);
|
|
||||||
brush.setColor(Qt::black);
|
|
||||||
painter.setBrush(brush);
|
|
||||||
painter.setPen(Qt::NoPen);
|
|
||||||
painter.setOpacity(d->proxy->opacity()/2.4);
|
|
||||||
painter.drawRect(rect());
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef QTMATERIALRAISEDBUTTON_H
|
|
||||||
#define QTMATERIALRAISEDBUTTON_H
|
|
||||||
|
|
||||||
#include "qtmaterialflatbutton.h"
|
|
||||||
|
|
||||||
class QtMaterialRaisedButtonPrivate;
|
|
||||||
|
|
||||||
class QtMaterialRaisedButton : public QtMaterialFlatButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialRaisedButton(QWidget *parent = 0);
|
|
||||||
explicit QtMaterialRaisedButton(const QString &text, QWidget *parent = 0);
|
|
||||||
~QtMaterialRaisedButton();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QtMaterialRaisedButton(QtMaterialRaisedButtonPrivate &d, QWidget *parent = 0);
|
|
||||||
|
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialRaisedButton)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialRaisedButton)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALRAISEDBUTTON_H
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
#ifndef QTMATERIALTABS_H
|
|
||||||
#define QTMATERIALTABS_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
|
||||||
#include <QIcon>
|
|
||||||
#include "lib/qtmaterialtheme.h"
|
|
||||||
|
|
||||||
class QtMaterialTabsPrivate;
|
|
||||||
class QtMaterialTab;
|
|
||||||
|
|
||||||
class QtMaterialTabs : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QtMaterialTabs(QWidget *parent = 0);
|
|
||||||
~QtMaterialTabs();
|
|
||||||
|
|
||||||
void setUseThemeColors(bool value);
|
|
||||||
bool useThemeColors() const;
|
|
||||||
|
|
||||||
void setHaloVisible(bool value);
|
|
||||||
bool isHaloVisible() const;
|
|
||||||
|
|
||||||
void setRippleStyle(Material::RippleStyle style);
|
|
||||||
Material::RippleStyle rippleStyle() const;
|
|
||||||
|
|
||||||
void setInkColor(const QColor &color);
|
|
||||||
QColor inkColor() const;
|
|
||||||
|
|
||||||
void setBackgroundColor(const QColor &color);
|
|
||||||
QColor backgroundColor() const;
|
|
||||||
|
|
||||||
void setTextColor(const QColor &color);
|
|
||||||
QColor textColor() const;
|
|
||||||
|
|
||||||
void addTab(const QString &text, const QIcon &icon = QIcon());
|
|
||||||
|
|
||||||
void setCurrentTab(QtMaterialTab *tab);
|
|
||||||
void setCurrentTab(int index);
|
|
||||||
|
|
||||||
int currentIndex() const;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void currentChanged(int);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setTabActive(int index, bool active = true);
|
|
||||||
void updateTabs();
|
|
||||||
|
|
||||||
const QScopedPointer<QtMaterialTabsPrivate> d_ptr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QtMaterialTabs)
|
|
||||||
Q_DECLARE_PRIVATE(QtMaterialTabs)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QTMATERIALTABS_H
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
project(qt-material-widgetsExamples CXX)
|
||||||
|
|
||||||
|
include(project-is-top-level)
|
||||||
|
include(folders)
|
||||||
|
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
find_package(qt-material-widgets REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT Qt6_FOUND)
|
||||||
|
qt5_add_resources(
|
||||||
|
example_style_res
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/examples.qrc
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
qt_add_resources(
|
||||||
|
example_style_res
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/examples.qrc
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(run-examples)
|
||||||
|
|
||||||
|
function(add_example NAME)
|
||||||
|
add_executable("${NAME}"
|
||||||
|
${example_style_res}
|
||||||
|
appbarsettingseditor.cpp
|
||||||
|
autocompletesettingseditor.cpp
|
||||||
|
avatarsettingseditor.cpp
|
||||||
|
badgesettingseditor.cpp
|
||||||
|
checkboxsettingseditor.cpp
|
||||||
|
circularprogresssettingseditor.cpp
|
||||||
|
dialogsettingseditor.cpp
|
||||||
|
drawersettingseditor.cpp
|
||||||
|
fabsettingseditor.cpp
|
||||||
|
flatbuttonsettingseditor.cpp
|
||||||
|
iconbuttonsettingseditor.cpp
|
||||||
|
main.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
menusettingseditor.cpp
|
||||||
|
progresssettingseditor.cpp
|
||||||
|
radiobuttonsettingseditor.cpp
|
||||||
|
raisedbuttonsettingseditor.cpp
|
||||||
|
scrollbarsettingseditor.cpp
|
||||||
|
slidersettingseditor.cpp
|
||||||
|
snackbarsettingseditor.cpp
|
||||||
|
tabssettingseditor.cpp
|
||||||
|
textfieldsettingseditor.cpp
|
||||||
|
togglesettingseditor.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(
|
||||||
|
"${NAME}"
|
||||||
|
PRIVATE
|
||||||
|
qt-material-widgets::qt-material-widgets
|
||||||
|
)
|
||||||
|
target_compile_features("${NAME}" PRIVATE cxx_std_11)
|
||||||
|
add_custom_target("run_${NAME}" COMMAND "${NAME}" VERBATIM)
|
||||||
|
add_dependencies("run_${NAME}" "${NAME}")
|
||||||
|
add_dependencies(run-examples "run_${NAME}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
add_example(qt-material-widgets-example)
|
||||||
|
|
||||||
|
target_include_directories(qt-material-widgets-example PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_ROOT_DIR}/include/qt-material-widgets>"
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_ROOT_DIR}/include/qt-material-widgets/component>"
|
||||||
|
"$<BUILD_INTERFACE:${PROJECT_ROOT_DIR}/include/qt-material-widgets/lib>"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_folders(Example)
|
||||||
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
Q_INIT_RESOURCE(qt_material_widgets);
|
||||||
|
|
||||||
|
MainWindow window;
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue