Created custom PushButton widget and added custom styleName property for styling primary buttons
This commit is contained in:
@@ -18,6 +18,7 @@ target_sources(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/SvgToolButton.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/SvgToolButton.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/Widgets/PushButton.cpp
|
||||||
|
|
||||||
# Insight worker tasks
|
# Insight worker tasks
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/InsightWorker/Tasks/InsightWorkerTask.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/InsightWorker/Tasks/InsightWorkerTask.cpp
|
||||||
|
|||||||
@@ -199,3 +199,8 @@ Bloom--Widgets--SvgToolButton QMenu::item {
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bloom--Widgets--PushButton[styleName="primary"] {
|
||||||
|
background-color: #353C41;
|
||||||
|
border: 1px solid #454C52;
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Widgets/RotatableLabel.hpp"
|
#include "Widgets/RotatableLabel.hpp"
|
||||||
#include "Widgets/LabeledSeparator.hpp"
|
#include "Widgets/LabeledSeparator.hpp"
|
||||||
#include "Widgets/TextInput.hpp"
|
#include "Widgets/TextInput.hpp"
|
||||||
|
#include "Widgets/PushButton.hpp"
|
||||||
#include "Widgets/SvgWidget.hpp"
|
#include "Widgets/SvgWidget.hpp"
|
||||||
#include "Widgets/SvgToolButton.hpp"
|
#include "Widgets/SvgToolButton.hpp"
|
||||||
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
||||||
@@ -54,6 +55,15 @@ namespace Bloom
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"PushButton",
|
||||||
|
[this] (QWidget* parent, const QString& name) {
|
||||||
|
auto* widget = new PushButton(parent);
|
||||||
|
widget->setObjectName(name);
|
||||||
|
widget->setStyleSheet(parent->styleSheet());
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ExpandingHeightScrollAreaWidget",
|
"ExpandingHeightScrollAreaWidget",
|
||||||
[this] (QWidget* parent, const QString& name) {
|
[this] (QWidget* parent, const QString& name) {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#include "PushButton.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::Widgets
|
||||||
|
{
|
||||||
|
PushButton::PushButton(QWidget* parent)
|
||||||
|
: QPushButton(parent)
|
||||||
|
{}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Bloom::Widgets
|
||||||
|
{
|
||||||
|
class PushButton: public QPushButton
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString styleName READ getStyleName WRITE setStyleName DESIGNABLE true)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PushButton(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void setStyleName(const QString& styleName) {
|
||||||
|
this->styleName = styleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QString getStyleName() const {
|
||||||
|
return this->styleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QString styleName;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -77,9 +77,9 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
this->stackedFormLayout = this->container->findChild<QStackedLayout*>("stacked-form-layout");
|
this->stackedFormLayout = this->container->findChild<QStackedLayout*>("stacked-form-layout");
|
||||||
|
|
||||||
this->applyButton = this->container->findChild<QPushButton*>("apply-btn");
|
this->applyButton = this->container->findChild<PushButton*>("apply-btn");
|
||||||
this->helpButton = this->container->findChild<QPushButton*>("help-btn");
|
this->helpButton = this->container->findChild<PushButton*>("help-btn");
|
||||||
this->closeButton = this->container->findChild<QPushButton*>("close-btn");
|
this->closeButton = this->container->findChild<PushButton*>("close-btn");
|
||||||
|
|
||||||
regionSelectorToolBar->setContentsMargins(0, 0, 0, 0);
|
regionSelectorToolBar->setContentsMargins(0, 0, 0, 0);
|
||||||
this->regionItemScrollArea->setContentsMargins(0, 0, 0, 0);
|
this->regionItemScrollArea->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPushButton>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
@@ -17,6 +16,7 @@
|
|||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/ExcludedMemoryRegion.hpp"
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
|
||||||
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp"
|
||||||
#include "RegionItem.hpp"
|
#include "RegionItem.hpp"
|
||||||
#include "FocusedRegionItem.hpp"
|
#include "FocusedRegionItem.hpp"
|
||||||
#include "ExcludedRegionItem.hpp"
|
#include "ExcludedRegionItem.hpp"
|
||||||
@@ -51,9 +51,9 @@ namespace Bloom::Widgets
|
|||||||
QWidget* container = nullptr;
|
QWidget* container = nullptr;
|
||||||
QWidget* regionSelector = nullptr;
|
QWidget* regionSelector = nullptr;
|
||||||
|
|
||||||
QPushButton* applyButton = nullptr;
|
PushButton* applyButton = nullptr;
|
||||||
QPushButton* helpButton = nullptr;
|
PushButton* helpButton = nullptr;
|
||||||
QPushButton* closeButton = nullptr;
|
PushButton* closeButton = nullptr;
|
||||||
|
|
||||||
SvgToolButton* addRegionButton = nullptr;
|
SvgToolButton* addRegionButton = nullptr;
|
||||||
QAction* addFocusedRegionMenuAction = nullptr;
|
QAction* addFocusedRegionMenuAction = nullptr;
|
||||||
|
|||||||
@@ -130,8 +130,3 @@
|
|||||||
border-top: 1px solid #2F2F2D;
|
border-top: 1px solid #2F2F2D;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#apply-btn {
|
|
||||||
background-color: #353C41;
|
|
||||||
border: 1px solid #454C52;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="help-btn">
|
<widget class="PushButton" name="help-btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Help</string>
|
<string>Help</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -214,14 +214,17 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="close-btn">
|
<widget class="PushButton" name="close-btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="apply-btn">
|
<widget class="PushButton" name="apply-btn">
|
||||||
|
<property name="styleName">
|
||||||
|
<string>primary</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>OK</string>
|
<string>OK</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -28,11 +28,6 @@
|
|||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#apply-btn {
|
|
||||||
background-color: #353C41;
|
|
||||||
border: 1px solid #454C52;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BitsetWidget */
|
/* BitsetWidget */
|
||||||
#bitset-widget {
|
#bitset-widget {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ namespace Bloom::Widgets
|
|||||||
this->registerValueBitsetWidgetContainer = this->registerValueContainer->findChild<QWidget*>(
|
this->registerValueBitsetWidgetContainer = this->registerValueContainer->findChild<QWidget*>(
|
||||||
"register-value-bitset-widget-container"
|
"register-value-bitset-widget-container"
|
||||||
);
|
);
|
||||||
this->refreshValueButton = this->container->findChild<QPushButton*>("refresh-value-btn");
|
this->refreshValueButton = this->container->findChild<PushButton*>("refresh-value-btn");
|
||||||
this->applyButton = this->container->findChild<QPushButton*>("apply-btn");
|
this->applyButton = this->container->findChild<PushButton*>("apply-btn");
|
||||||
this->helpButton = this->container->findChild<QPushButton*>("help-btn");
|
this->helpButton = this->container->findChild<PushButton*>("help-btn");
|
||||||
this->closeButton = this->container->findChild<QPushButton*>("close-btn");
|
this->closeButton = this->container->findChild<PushButton*>("close-btn");
|
||||||
|
|
||||||
this->registerHistoryWidget = new RegisterHistoryWidget(
|
this->registerHistoryWidget = new RegisterHistoryWidget(
|
||||||
this->registerDescriptor,
|
this->registerDescriptor,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -14,6 +13,7 @@
|
|||||||
#include "src/Targets/TargetState.hpp"
|
#include "src/Targets/TargetState.hpp"
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||||
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PushButton.hpp"
|
||||||
#include "BitsetWidget/BitsetWidget.hpp"
|
#include "BitsetWidget/BitsetWidget.hpp"
|
||||||
#include "RegisterHistoryWidget/RegisterHistoryWidget.hpp"
|
#include "RegisterHistoryWidget/RegisterHistoryWidget.hpp"
|
||||||
|
|
||||||
@@ -54,10 +54,10 @@ namespace Bloom::Widgets
|
|||||||
QWidget* registerValueBitsetWidgetContainer = nullptr;
|
QWidget* registerValueBitsetWidgetContainer = nullptr;
|
||||||
std::vector<BitsetWidget*> bitsetWidgets;
|
std::vector<BitsetWidget*> bitsetWidgets;
|
||||||
|
|
||||||
QPushButton* refreshValueButton = nullptr;
|
PushButton* refreshValueButton = nullptr;
|
||||||
QPushButton* applyButton = nullptr;
|
PushButton* applyButton = nullptr;
|
||||||
QPushButton* helpButton = nullptr;
|
PushButton* helpButton = nullptr;
|
||||||
QPushButton* closeButton = nullptr;
|
PushButton* closeButton = nullptr;
|
||||||
|
|
||||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||||
|
|
||||||
|
|||||||
@@ -330,7 +330,7 @@
|
|||||||
<number>15</number>
|
<number>15</number>
|
||||||
</property>
|
</property>
|
||||||
<item alignment="Qt::AlignCenter">
|
<item alignment="Qt::AlignCenter">
|
||||||
<widget class="QPushButton" name="refresh-value-btn">
|
<widget class="PushButton" name="refresh-value-btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Refresh Value</string>
|
<string>Refresh Value</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -344,7 +344,10 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignCenter">
|
<item alignment="Qt::AlignCenter">
|
||||||
<widget class="QPushButton" name="apply-btn">
|
<widget class="PushButton" name="apply-btn">
|
||||||
|
<property name="styleName">
|
||||||
|
<string>primary</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Write Value</string>
|
<string>Write Value</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -414,7 +417,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignRight">
|
<item alignment="Qt::AlignRight">
|
||||||
<widget class="QPushButton" name="help-btn">
|
<widget class="PushButton" name="help-btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Help</string>
|
<string>Help</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -428,7 +431,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignRight">
|
<item alignment="Qt::AlignRight">
|
||||||
<widget class="QPushButton" name="close-btn">
|
<widget class="PushButton" name="close-btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user