Created custom BloomProxyStyle to override Qt system styles
This commit is contained in:
@@ -134,6 +134,7 @@ add_executable(Bloom
|
|||||||
src/Insight/Insight.cpp
|
src/Insight/Insight.cpp
|
||||||
src/Insight/InsightWorker/InsightWorker.cpp
|
src/Insight/InsightWorker/InsightWorker.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp
|
src/Insight/UserInterfaces/InsightWindow/UiLoader.cpp
|
||||||
|
src/Insight/UserInterfaces/InsightWindow/BloomProxyStyle.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp
|
src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/AboutWindow.cpp
|
src/Insight/UserInterfaces/InsightWindow/AboutWindow.cpp
|
||||||
src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp
|
src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.cpp
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
#include "Insight.hpp"
|
#include "Insight.hpp"
|
||||||
|
|
||||||
#include <typeindex>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
#include "src/Exceptions/InvalidConfig.hpp"
|
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
|
||||||
#include "src/Targets/TargetState.hpp"
|
|
||||||
|
|
||||||
#include "src/Application.hpp"
|
#include "src/Application.hpp"
|
||||||
#include "InsightWorker/Tasks/QueryLatestVersionNumber.hpp"
|
#include "InsightWorker/Tasks/QueryLatestVersionNumber.hpp"
|
||||||
#include "src/VersionNumber.hpp"
|
|
||||||
|
|
||||||
using namespace Bloom;
|
using namespace Bloom;
|
||||||
using namespace Bloom::Exceptions;
|
using namespace Bloom::Exceptions;
|
||||||
@@ -56,7 +53,8 @@ void Insight::startup() {
|
|||||||
|
|
||||||
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
|
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
|
||||||
|
|
||||||
this->application.setQuitOnLastWindowClosed(true);
|
QApplication::setQuitOnLastWindowClosed(true);
|
||||||
|
QApplication::setStyle(new BloomProxyStyle());
|
||||||
qRegisterMetaType<Bloom::Targets::TargetDescriptor>();
|
qRegisterMetaType<Bloom::Targets::TargetDescriptor>();
|
||||||
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
|
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
|
||||||
qRegisterMetaType<Bloom::Targets::TargetPinState>();
|
qRegisterMetaType<Bloom::Targets::TargetPinState>();
|
||||||
|
|||||||
16
src/Insight/UserInterfaces/InsightWindow/BloomProxyStyle.cpp
Normal file
16
src/Insight/UserInterfaces/InsightWindow/BloomProxyStyle.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include "BloomProxyStyle.hpp"
|
||||||
|
|
||||||
|
using namespace Bloom;
|
||||||
|
|
||||||
|
int BloomProxyStyle::styleHint(
|
||||||
|
StyleHint hint,
|
||||||
|
const QStyleOption* option,
|
||||||
|
const QWidget* widget,
|
||||||
|
QStyleHintReturn* returnData
|
||||||
|
) const {
|
||||||
|
if (hint == QStyle::SH_ComboBox_Popup) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||||
|
}
|
||||||
19
src/Insight/UserInterfaces/InsightWindow/BloomProxyStyle.hpp
Normal file
19
src/Insight/UserInterfaces/InsightWindow/BloomProxyStyle.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QProxyStyle>
|
||||||
|
|
||||||
|
namespace Bloom
|
||||||
|
{
|
||||||
|
class BloomProxyStyle: public QProxyStyle
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
int styleHint(
|
||||||
|
StyleHint hint,
|
||||||
|
const QStyleOption* option = nullptr,
|
||||||
|
const QWidget* widget = nullptr,
|
||||||
|
QStyleHintReturn* returnData = nullptr
|
||||||
|
) const override;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user