New custom TextInput widget (derived from QLineEdit) to use for text input fields. It currently just removes the default (theme-based) icons from context menu actions
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="register-details-name-input">
|
||||
<widget class="TextInput" name="register-details-name-input">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -94,7 +94,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="register-details-size-input">
|
||||
<widget class="TextInput" name="register-details-size-input">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -118,7 +118,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="register-details-start-address-input">
|
||||
<widget class="TextInput" name="register-details-start-address-input">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -157,7 +157,7 @@ Insight.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="register-value-text-input"/>
|
||||
<widget class="TextInput" name="register-value-text-input"/>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QWidget" name="register-value-bitset-widget-container">
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="search-input">
|
||||
<widget class="TextInput" name="search-input">
|
||||
<property name="minimumHeight">
|
||||
<number>25</number>
|
||||
</property>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "TextInput.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class TextInput: public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TextInput(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user