-
Notifications
You must be signed in to change notification settings - Fork 55
fix(network): improve copy button interaction and icon on network details page #578
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,28 +60,42 @@ DccObject { | |||||
| text: dccObj.displayName | ||||||
| elide: Text.ElideMiddle | ||||||
| } | ||||||
| D.IconLabel { | ||||||
| D.ActionButton { | ||||||
| property bool clipboard: false | ||||||
| Layout.alignment: Qt.AlignRight | ||||||
| Layout.alignment: Qt.AlignRight | Qt.AlignVCenter | ||||||
| Layout.preferredWidth: 30 | ||||||
| Layout.preferredHeight: 30 | ||||||
| icon { | ||||||
| name: "copy" | ||||||
| palette: D.DTK.makeIconPalette(palette) | ||||||
| width: 16 | ||||||
| height: 16 | ||||||
| } | ||||||
| D.ToolTip { | ||||||
| id: tip | ||||||
| palette: parent.palette | ||||||
| } | ||||||
| MouseArea { | ||||||
| hoverEnabled: true | ||||||
| background: Rectangle { | ||||||
| anchors.fill: parent | ||||||
| acceptedButtons: Qt.LeftButton | ||||||
| onClicked: { | ||||||
| let text = [infoItem.name] | ||||||
| for (let i in infoItem.details) { | ||||||
| text.push(infoItem.details[i][0] + "\t" + infoItem.details[i][1]) | ||||||
| } | ||||||
| dccData.setClipboard(text.join("\n")) | ||||||
| tip.show(qsTr("Details has been copied"), 2000) | ||||||
| property D.Palette pressedColor: D.Palette { | ||||||
| normal: Qt.rgba(0, 0, 0, 0.2) | ||||||
| normalDark: Qt.rgba(1, 1, 1, 0.25) | ||||||
| } | ||||||
| property D.Palette hoveredColor: D.Palette { | ||||||
| normal: Qt.rgba(0, 0, 0, 0.1) | ||||||
| normalDark: Qt.rgba(1, 1, 1, 0.1) | ||||||
| } | ||||||
| radius: 6 | ||||||
| color: parent.pressed ? D.ColorSelector.pressedColor : (parent.hovered ? D.ColorSelector.hoveredColor : "transparent") | ||||||
| } | ||||||
| focusPolicy: Qt.StrongFocus | ||||||
| onClicked: { | ||||||
| let text = [infoItem.name] | ||||||
| for (let i in infoItem.details) { | ||||||
| text.push(infoItem.details[i][0] + "\t" + infoItem.details[i][1]) | ||||||
| } | ||||||
| dccData.setClipboard(text.join("\n")) | ||||||
| tip.show(qsTr("Details has been copied"), 2000) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): Tooltip text is slightly ungrammatical and might be clearer as plural. Minor wording nit: consider changing
Suggested change
|
||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -107,6 +121,7 @@ DccObject { | |||||
| delegate: ItemDelegate { | ||||||
| implicitHeight: 36 | ||||||
| text: modelData[0] | ||||||
| font: D.DTK.fontManager.t6 | ||||||
| checked: false | ||||||
| backgroundVisible: true | ||||||
| corners: getCornersForBackground(index, repeater.count) | ||||||
|
|
@@ -118,6 +133,7 @@ DccObject { | |||||
| id: textInput | ||||||
| text: modelData[1] | ||||||
| color: palette.text | ||||||
| font: D.DTK.fontManager.t7 | ||||||
| selectedTextColor: palette.highlightedText | ||||||
| selectionColor: palette.highlight | ||||||
| readOnly: true | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Rectangle color binding ignores the local pressed/hovered palettes and may use the wrong type/value.
pressedColorandhoveredColorare declared asD.Palette, but thecolorbinding usesD.ColorSelector.pressedColor/hoveredColorinstead, leaving the local palettes unused and risking a type mismatch ifD.ColorSelector.*isn’t a plain color. Bindcolorto the local palettes instead, e.g.color: parent.pressed ? pressedColor.normal : parent.hovered ? hoveredColor.normal : "transparent", or whichever variant matches your theme API.