Removed context menu icons from QPlainTextEdit widget
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "PlainTextEdit.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class PlainTextEdit: public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlainTextEdit(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
}
|
||||
@@ -73,7 +73,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="description-input">
|
||||
<widget class="PlainTextEdit" name="description-input">
|
||||
<property name="minimumHeight">
|
||||
<number>100</number>
|
||||
</property>
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QMargins>
|
||||
#include <QDesktopServices>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#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<QLineEdit*>(
|
||||
"register-details-size-input"
|
||||
);
|
||||
auto* registerDetailsDescriptionInput = registerDetailsContainer->findChild<QPlainTextEdit*>(
|
||||
auto* registerDetailsDescriptionInput = registerDetailsContainer->findChild<PlainTextEdit*>(
|
||||
"register-details-description-input"
|
||||
);
|
||||
registerDetailsNameInput->setText(registerName);
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="register-details-description-input">
|
||||
<widget class="PlainTextEdit" name="register-details-description-input">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user