Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: from linuxdeepin/dtkdeclarative #20

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
6 changes: 3 additions & 3 deletions linglong.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ 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: googletest/1.8.1

source:
Expand Down
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
}
}

}