Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#265
  • Loading branch information
deepin-ci-robot committed Dec 25, 2023
1 parent df6517a commit 4e029b0
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 17 deletions.
6 changes: 0 additions & 6 deletions cmake/DtkBuildConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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()
15 changes: 10 additions & 5 deletions linglong.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ 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:
kind: local

variables:
extra_args: |
DTK_VERSION=${VERSION}
-DBUILD_EXAMPLE=OFF \
-DBUILD_DOCS=OFF \
-DDTK_VERSION=${VERSION} \
-DVERSION=${VERSION}
build:
kind: qmake
kind: cmake
5 changes: 2 additions & 3 deletions qt6/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}")
7 changes: 7 additions & 0 deletions qt6/src/qml/FlowStyle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}

Expand Down
55 changes: 55 additions & 0 deletions qt6/src/qml/TextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

}
1 change: 1 addition & 0 deletions qt6/src/qml/private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 2 additions & 3 deletions qt6/src/qml/settings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
55 changes: 55 additions & 0 deletions src/qml/TextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

}

0 comments on commit 4e029b0

Please sign in to comment.