From 4e029b08effcab3a88101031e896176f16c7fc3f Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Mon, 25 Dec 2023 08:46:53 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkdeclarative Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: https://github.com/linuxdeepin/dtkdeclarative/pull/265 --- cmake/DtkBuildConfig.cmake | 6 ---- linglong.yaml | 15 +++++--- qt6/src/CMakeLists.txt | 5 ++- qt6/src/qml/FlowStyle.qml | 7 ++++ qt6/src/qml/TextField.qml | 55 +++++++++++++++++++++++++++++ qt6/src/qml/private/CMakeLists.txt | 1 + qt6/src/qml/settings/CMakeLists.txt | 5 ++- src/qml/TextField.qml | 55 +++++++++++++++++++++++++++++ 8 files changed, 132 insertions(+), 17 deletions(-) diff --git a/cmake/DtkBuildConfig.cmake b/cmake/DtkBuildConfig.cmake index 699d3e7b..5dc354c8 100644 --- a/cmake/DtkBuildConfig.cmake +++ b/cmake/DtkBuildConfig.cmake @@ -88,7 +88,6 @@ function(dtk_extend_target TARGET) set(args_option) set(args_single EnableCov - SkipRPATH ) cmake_parse_arguments(PARSE_ARGV 1 arg "${args_option}" "${args_single}" "${args_multi}") @@ -100,9 +99,4 @@ function(dtk_extend_target TARGET) endif() target_link_libraries(${TARGET} PRIVATE gcov) endif() - - # skip RUNPATH avoid to `Insecure RUNPATH` - if (arg_SkipRPATH) - set_target_properties(${TARGET} PROPERTIES SKIP_BUILD_RPATH ${arg_SkipRPATH}) - endif() endfunction() diff --git a/linglong.yaml b/linglong.yaml index 81b63bbb..611ff8b3 100644 --- a/linglong.yaml +++ b/linglong.yaml @@ -19,9 +19,11 @@ depends: - id: qtquickcontrols2/5.15.7 - id: qtdeclarative/5.15.7 - id: qttools/5.15.7 - - id: dtkcommon/5.6.3 - - id: dtkcore/5.6.3 - - id: dtkgui/5.6.3 + - id: dtkcommon/5.6.0 + - id: dtkcore/5.6.0 + - id: dtkgui/5.6.0 + - id: fmtlib/10.1.2 + - id: spdlog/1.10.0 #- id: googletest/1.8.1 source: @@ -29,7 +31,10 @@ source: variables: extra_args: | - DTK_VERSION=${VERSION} + -DBUILD_EXAMPLE=OFF \ + -DBUILD_DOCS=OFF \ + -DDTK_VERSION=${VERSION} \ + -DVERSION=${VERSION} build: - kind: qmake + kind: cmake diff --git a/qt6/src/CMakeLists.txt b/qt6/src/CMakeLists.txt index 175bb9b8..aaba78e8 100644 --- a/qt6/src/CMakeLists.txt +++ b/qt6/src/CMakeLists.txt @@ -20,9 +20,7 @@ qt_add_qml_module(${LIB_NAME} ) dtk_extend_target(${LIB_NAME} EnableCov ${ENABLE_COV}) -dtk_extend_target(${PLUGIN_NAME} EnableCov ${ENABLE_COV} - SkipRPATH ON -) +dtk_extend_target(${PLUGIN_NAME} EnableCov ${ENABLE_COV}) qt_add_translations(${LIB_NAME} TS_FILES ${TS_FILES} @@ -78,4 +76,5 @@ install(EXPORT Dtk${DTK_VERSION_MAJOR}DeclarativeTargets NAMESPACE Dtk${DTK_VERS # Install translations install(FILES ${QM_FILES} DESTINATION "${TRANSLATIONS_INSTALL_PATH}") # Install plugin +install(TARGETS ${PLUGIN_NAME} DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}") install(DIRECTORY "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/" DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}") diff --git a/qt6/src/qml/FlowStyle.qml b/qt6/src/qml/FlowStyle.qml index fbc0ba7e..9d887a2d 100644 --- a/qt6/src/qml/FlowStyle.qml +++ b/qt6/src/qml/FlowStyle.qml @@ -294,8 +294,11 @@ QtObject { property D.Palette text : D.Palette { normal: D.DTK.makeColor(D.Color.HighlightedText) + normalDark: D.DTK.makeColor(D.Color.HighlightedText) hovered: D.DTK.makeColor(D.Color.HighlightedText).lightness(+10) + hoveredDark: D.DTK.makeColor(D.Color.HighlightedText).lightness(+10) pressed: D.DTK.makeColor(D.Color.HighlightedText).opacity(-20) + pressedDark: D.DTK.makeColor(D.Color.HighlightedText).opacity(-20) } property D.Palette dropShadow : D.Palette { @@ -655,13 +658,17 @@ QtObject { property D.Palette background: D.Palette { normal: D.DTK.makeColor(D.Color.Highlight) + normalDark: D.DTK.makeColor(D.Color.Highlight) hovered: D.DTK.makeColor(D.Color.Highlight).lightness(+10) + hoveredDark: D.DTK.makeColor(D.Color.Highlight).lightness(+10) } property D.Palette dropShadow: D.Palette { normal: D.DTK.makeColor(D.Color.Highlight).lightness(+20) + normalDark: D.DTK.makeColor(D.Color.Highlight).lightness(+20) } property D.Palette innerShadow: D.Palette { normal: D.DTK.makeColor(D.Color.Highlight).lightness(-20) + normalDark: D.DTK.makeColor(D.Color.Highlight).lightness(-20) } } diff --git a/qt6/src/qml/TextField.qml b/qt6/src/qml/TextField.qml index b0789328..a438f5f6 100644 --- a/qt6/src/qml/TextField.qml +++ b/qt6/src/qml/TextField.qml @@ -54,4 +54,59 @@ T.TextField { implicitWidth: DS.Style.edit.width implicitHeight: DS.Style.edit.textFieldHeight } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.RightButton + + onClicked: { + contextMenu.popup(mouse.x, mouse.y) + } + } + + Menu { + id: contextMenu + + MenuItem + { + text: qsTr("Copy") + onTriggered: control.copy() + enabled: control.selectedText.length + } + + MenuItem + { + text: qsTr("Cut") + onTriggered: control.cut() + enabled: control.selectedText.length + } + + MenuItem + { + text: qsTr("Paste") + onTriggered: control.paste() + } + + MenuItem + { + text: qsTr("Select All") + onTriggered: control.selectAll() + enabled: control.text.length + } + + MenuItem + { + text: qsTr("Undo") + onTriggered: control.undo() + enabled: control.canUndo + } + + MenuItem + { + text: qsTr("Redo") + onTriggered: control.redo() + enabled: control.canRedo + } + } + } diff --git a/qt6/src/qml/private/CMakeLists.txt b/qt6/src/qml/private/CMakeLists.txt index ef689e41..5cd782b6 100644 --- a/qt6/src/qml/private/CMakeLists.txt +++ b/qt6/src/qml/private/CMakeLists.txt @@ -26,4 +26,5 @@ PRIVATE Qt${QT_VERSION_MAJOR}::Quick ) +install(TARGETS dtkdeclarativeprivatesplugin DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}/private") install(DIRECTORY "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/private/" DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}/private") diff --git a/qt6/src/qml/settings/CMakeLists.txt b/qt6/src/qml/settings/CMakeLists.txt index 36cbcf16..b4c78865 100644 --- a/qt6/src/qml/settings/CMakeLists.txt +++ b/qt6/src/qml/settings/CMakeLists.txt @@ -22,9 +22,7 @@ qt_add_qml_module(dtkdeclarativesettingsplugin "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/settings" ) -dtk_extend_target(dtkdeclarativesettingsplugin EnableCov ${ENABLE_COV} - SkipRPATH ON -) +dtk_extend_target(dtkdeclarativesettingsplugin EnableCov ${ENABLE_COV}) target_link_libraries(dtkdeclarativesettingsplugin PRIVATE @@ -37,4 +35,5 @@ PRIVATE ${LIB_NAME} ) +install(TARGETS dtkdeclarativesettingsplugin DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}/settings") install(DIRECTORY "${PLUGIN_OUTPUT_DIR}/${URI_PATH}/settings/" DESTINATION "${QML_INSTALL_DIR}/${URI_PATH}/settings") diff --git a/src/qml/TextField.qml b/src/qml/TextField.qml index 08ce9970..3f12f06b 100644 --- a/src/qml/TextField.qml +++ b/src/qml/TextField.qml @@ -53,4 +53,59 @@ T.TextField { implicitWidth: DS.Style.edit.width implicitHeight: DS.Style.edit.textFieldHeight } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.RightButton + + onClicked: { + contextMenu.popup(mouse.x, mouse.y) + } + } + + Menu { + id: contextMenu + + MenuItem + { + text: qsTr("Copy") + onTriggered: control.copy() + enabled: control.selectedText.length + } + + MenuItem + { + text: qsTr("Cut") + onTriggered: control.cut() + enabled: control.selectedText.length + } + + MenuItem + { + text: qsTr("Paste") + onTriggered: control.paste() + } + + MenuItem + { + text: qsTr("Select All") + onTriggered: control.selectAll() + enabled: control.text.length + } + + MenuItem + { + text: qsTr("Undo") + onTriggered: control.undo() + enabled: control.canUndo + } + + MenuItem + { + text: qsTr("Redo") + onTriggered: control.redo() + enabled: control.canRedo + } + } + }