diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88d02be2..627f4f28 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,6 +140,7 @@ add_executable(Bloom
src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/LabeledSeparator.cpp
+ src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgWidget.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.cpp
src/Insight/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp
diff --git a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp
index 49933746..5e0b6b09 100644
--- a/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp
+++ b/src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp
@@ -6,6 +6,7 @@
#include "Widgets/PanelWidget.hpp"
#include "Widgets/RotatableLabel.hpp"
#include "Widgets/LabeledSeparator.hpp"
+#include "Widgets/TextInput.hpp"
#include "Widgets/SvgWidget.hpp"
#include "Widgets/SvgToolButton.hpp"
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
@@ -43,6 +44,15 @@ UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
return widget;
}
},
+ {
+ "TextInput",
+ [this] (QWidget* parent, const QString& name) {
+ auto* widget = new TextInput(parent);
+ widget->setObjectName(name);
+ widget->setStyleSheet(parent->styleSheet());
+ return widget;
+ }
+ },
{
"ExpandingHeightScrollAreaWidget",
[this] (QWidget* parent, const QString& name) {
diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp
index f497595f..50bc8d59 100644
--- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp
+++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/TargetRegisterInspectorWindow.cpp
@@ -123,7 +123,6 @@ TargetRegisterInspectorWindow::TargetRegisterInspectorWindow(
);
this->registerValueTextInput->setFixedWidth(BitsetWidget::WIDTH * 2);
- this->registerValueTextInput->setContextMenuPolicy(Qt::NoContextMenu);
if (!this->registerDescriptor.writable) {
this->registerValueTextInput->setDisabled(true);
diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui
index 960ad759..7bc23484 100644
--- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui
+++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegisterInspector/UiFiles/TargetRegisterInspectorWindow.ui
@@ -70,7 +70,7 @@
-
-
+
false
@@ -94,7 +94,7 @@
-
-
+
false
@@ -118,7 +118,7 @@
-
-
+
false
@@ -157,7 +157,7 @@ Insight.
-
-
+
-
diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/TargetRegistersSidePane.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/TargetRegistersSidePane.ui
index 278feb75..b37f2f26 100644
--- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/TargetRegistersSidePane.ui
+++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetRegistersPane/UiFiles/TargetRegistersSidePane.ui
@@ -94,7 +94,7 @@
-
-
+
25
diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.cpp
new file mode 100644
index 00000000..01550e03
--- /dev/null
+++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.cpp
@@ -0,0 +1,21 @@
+#include "TextInput.hpp"
+
+#include
+#include
+
+using namespace Bloom::Widgets;
+
+TextInput::TextInput(QWidget* parent): QLineEdit(parent) {}
+
+void TextInput::contextMenuEvent(QContextMenuEvent* event) {
+ if (QMenu *menu = 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/TextInput.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.hpp
new file mode 100644
index 00000000..53b7635b
--- /dev/null
+++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.hpp
@@ -0,0 +1,19 @@
+#pragma once
+
+#include
+#include
+
+namespace Bloom::Widgets
+{
+ class TextInput: public QLineEdit
+ {
+ Q_OBJECT
+
+ public:
+ explicit TextInput(QWidget* parent = nullptr);
+
+ protected:
+ void contextMenuEvent(QContextMenuEvent* event) override;
+
+ };
+}