diff --git a/qml/components/AdvertisementDataWidgetAdvanced.qml b/qml/components/AdvertisementDataWidgetAdvanced.qml index 14aa74b..46548b4 100644 --- a/qml/components/AdvertisementDataWidgetAdvanced.qml +++ b/qml/components/AdvertisementDataWidgetAdvanced.qml @@ -199,6 +199,7 @@ Rectangle { Flow { Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true + spacing: 0 Repeater { model: packet.advDataHex_list @@ -223,6 +224,20 @@ Rectangle { } } } + + Item { width: 4; height: 4; } // spacer + + SquareButtonSunken { + width: 26; height: 26; + + tooltipText: qsTr("copy") + tooltipPosition: "right" + source: "qrc:/assets/icons/material-symbols/content_copy.svg" + + onClicked: { + utilsClipboard.setText(packet.advDataHex) + } + } } } @@ -249,6 +264,7 @@ Rectangle { Flow { Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true + spacing: 0 Repeater { model: packet.advDataAscii_list @@ -274,6 +290,20 @@ Rectangle { } } } + + Item { width: 4; height: 4; } // spacer + + SquareButtonSunken { + width: 26; height: 26; + + tooltipText: qsTr("copy") + tooltipPosition: "right" + source: "qrc:/assets/icons/material-symbols/content_copy.svg" + + onClicked: { + utilsClipboard.setText(packet.advDataAscii) + } + } } } diff --git a/qml/components/BleCharacteristicWidget.qml b/qml/components/BleCharacteristicWidget.qml index 64beabd..a44b30f 100644 --- a/qml/components/BleCharacteristicWidget.qml +++ b/qml/components/BleCharacteristicWidget.qml @@ -211,6 +211,20 @@ Rectangle { } } } + + Item { width: 4; height: 4; } // spacer + + SquareButtonSunken { + width: 26; height: 26; + + tooltipText: qsTr("copy") + tooltipPosition: "right" + source: "qrc:/assets/icons/material-symbols/content_copy.svg" + + onClicked: { + utilsClipboard.setText(modelData.valueHex) + } + } } } @@ -269,6 +283,20 @@ Rectangle { } } } + + Item { width: 4; height: 4; } // spacer + + SquareButtonSunken { + width: 26; height: 26; + + tooltipText: qsTr("copy") + tooltipPosition: "right" + source: "qrc:/assets/icons/material-symbols/content_copy.svg" + + onClicked: { + utilsClipboard.setText(modelData.valueAscii) + } + } } } /* diff --git a/src/main.cpp b/src/main.cpp index 65e33bd..88c75a1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,7 @@ #include "utils_screen.h" #include "utils_sysinfo.h" #include "utils_language.h" +#include "utils_clipboard.h" #if defined(Q_OS_MACOS) #include "utils_os_macos_dock.h" #endif @@ -104,7 +105,8 @@ int main(int argc, char *argv[]) UtilsScreen *utilsScreen = UtilsScreen::getInstance(); UtilsSysInfo *utilsSysInfo = UtilsSysInfo::getInstance(); UtilsLanguage *utilsLanguage = UtilsLanguage::getInstance(); - if (!utilsScreen || !utilsApp || !utilsLanguage) + UtilsClipboard *utilsClipboard = new UtilsClipboard(); + if (!utilsScreen || !utilsApp|| !utilsLanguage || !utilsClipboard) { qWarning() << "Cannot init toolBLEx utils!"; return EXIT_FAILURE; @@ -132,6 +134,7 @@ int main(int argc, char *argv[]) engine_context->setContextProperty("utilsScreen", utilsScreen); engine_context->setContextProperty("utilsSysInfo", utilsSysInfo); engine_context->setContextProperty("utilsLanguage", utilsLanguage); + engine_context->setContextProperty("utilsClipboard", utilsClipboard); // Load the main view engine.load(QUrl(QStringLiteral("qrc:/qml/DesktopApplication.qml")));