diff --git a/src/Insight/CMakeLists.txt b/src/Insight/CMakeLists.txt index 4c361903..bd53e547 100755 --- a/src/Insight/CMakeLists.txt +++ b/src/Insight/CMakeLists.txt @@ -14,6 +14,7 @@ target_sources( ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/LabeledSeparator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/TextInput.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/SvgWidget.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/SvgToolButton.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp diff --git a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp index b0e40e18..1031a288 100644 --- a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp @@ -7,6 +7,7 @@ #include "Widgets/RotatableLabel.hpp" #include "Widgets/LabeledSeparator.hpp" #include "Widgets/TextInput.hpp" +#include "Widgets/PlainTextEdit.hpp" #include "Widgets/PushButton.hpp" #include "Widgets/SvgWidget.hpp" #include "Widgets/SvgToolButton.hpp" @@ -55,6 +56,15 @@ namespace Bloom return widget; } }, + { + "PlainTextEdit", + [this] (QWidget* parent, const QString& name) { + auto* widget = new PlainTextEdit(parent); + widget->setObjectName(name); + widget->setStyleSheet(parent->styleSheet()); + return widget; + } + }, { "PushButton", [this] (QWidget* parent, const QString& name) { diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.cpp new file mode 100644 index 00000000..9d834a72 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.cpp @@ -0,0 +1,24 @@ +#include "PlainTextEdit.hpp" + +#include +#include + +namespace Bloom::Widgets +{ + PlainTextEdit::PlainTextEdit(QWidget* parent) + : QPlainTextEdit(parent) + {} + + void PlainTextEdit::contextMenuEvent(QContextMenuEvent* event) { + if (QMenu* menu = this->createStandardContextMenu()) { + menu->setAttribute(Qt::WA_DeleteOnClose); + + // Remove default icons + for (auto& action : menu->actions()) { + action->setIcon(QIcon()); + } + + menu->popup(event->globalPos()); + } + } +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.hpp new file mode 100644 index 00000000..14327832 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +namespace Bloom::Widgets +{ + class PlainTextEdit: public QPlainTextEdit + { + Q_OBJECT + + public: + explicit PlainTextEdit(QWidget* parent = nullptr); + + protected: + void contextMenuEvent(QContextMenuEvent* event) override; + }; +} diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/UiFiles/SnapshotViewer.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/UiFiles/SnapshotViewer.ui index 1d25aa08..fdb60889 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/UiFiles/SnapshotViewer.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotViewer/UiFiles/SnapshotViewer.ui @@ -73,7 +73,7 @@ - + 100 diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp index 2ff66e81..020f54ae 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp @@ -3,13 +3,14 @@ #include #include #include -#include #include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp" #include "src/Insight/InsightSignals.hpp" #include "src/Insight/InsightWorker/InsightWorker.hpp" +#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PlainTextEdit.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp" + #include "src/Services/PathService.hpp" #include "src/Exceptions/Exception.hpp" @@ -105,7 +106,7 @@ namespace Bloom::Widgets auto* registerDetailsSizeInput = registerDetailsContainer->findChild( "register-details-size-input" ); - auto* registerDetailsDescriptionInput = registerDetailsContainer->findChild( + auto* registerDetailsDescriptionInput = registerDetailsContainer->findChild( "register-details-description-input" ); registerDetailsNameInput->setText(registerName); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui index 0496961b..7469bd4c 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui @@ -242,7 +242,7 @@ - + true