Commit 83f4ce73 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Use the KisHighlightedToolButton for KoGroupButton

This makes it a tiny bit easier to see which selection option
is selected.
parent 8039b084
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
#include "tool/kis_tool.h" #include "tool/kis_tool.h"
#include "kis_signals_blocker.h" #include "kis_signals_blocker.h"
#include "kis_action_manager.h" #include "kis_action_manager.h"
#include "kis_highlighted_button.h" #include "KisHighlightedToolButton.h"
typedef KoResourceServerSimpleConstruction<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServer; typedef KoResourceServerSimpleConstruction<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServer;
typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServerAdapter; typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServerAdapter;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "KisViewManager.h" #include "KisViewManager.h"
#include "kactioncollection.h" #include "kactioncollection.h"
#include "kis_tool_button.h" #include "kis_tool_button.h"
#include "kis_highlighted_button.h" #include "KisHighlightedToolButton.h"
#include <KisColorSelectorInterface.h> #include <KisColorSelectorInterface.h>
class KisFavoriteResourceManager; class KisFavoriteResourceManager;
......
...@@ -16,22 +16,29 @@ ...@@ -16,22 +16,29 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#ifndef __KIS_HIGHLIGHTED_BUTTON_H #ifndef __KIS_HIGHLIGHTED_TOOL_BUTTON_H
#define __KIS_HIGHLIGHTED_BUTTON_H #define __KIS_HIGHLIGHTED_TOOL_BUTTON_H
template <class BaseButton> #include <QToolButton>
class HighlightedButtonBase : public BaseButton
#include "kritawidgetutils_export.h"
class KRITAWIDGETUTILS_EXPORT KisHighlightedToolButton : public QToolButton
{ {
public: public:
HighlightedButtonBase(QWidget *parent = 0) : BaseButton(parent) {} KisHighlightedToolButton(QWidget *parent = 0)
: QToolButton(parent)
{
}
protected: protected:
void checkStateSet() override { void checkStateSet() override {
BaseButton::checkStateSet(); QToolButton::checkStateSet();
updatePalette(); updatePalette();
} }
void nextCheckState() override { void nextCheckState() override {
BaseButton::nextCheckState(); QToolButton::nextCheckState();
updatePalette(); updatePalette();
} }
...@@ -48,9 +55,4 @@ private: ...@@ -48,9 +55,4 @@ private:
}; };
class QPushButton;
class QToolButton;
typedef HighlightedButtonBase<QPushButton> KisHighlightedButton;
typedef HighlightedButtonBase<QToolButton> KisHighlightedToolButton;
#endif /* __KIS_HIGHLIGHTED_BUTTON_H */ #endif /* __KIS_HIGHLIGHTED_BUTTON_H */
...@@ -17,16 +17,12 @@ ...@@ -17,16 +17,12 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#include "KoGroupButton.h" #include "KoGroupButton.h"
// Qt
#include <QAction> #include <QAction>
#include <QStyleOptionToolButton> #include <QStyleOptionToolButton>
#include <QStylePainter> #include <QStylePainter>
#include <QToolButton>
// KF5
#include <KLocalizedString> #include <KLocalizedString>
class Q_DECL_HIDDEN KoGroupButton::Private class Q_DECL_HIDDEN KoGroupButton::Private
...@@ -42,12 +38,12 @@ public: ...@@ -42,12 +38,12 @@ public:
}; };
KoGroupButton::KoGroupButton(GroupPosition position, QWidget* parent) KoGroupButton::KoGroupButton(GroupPosition position, QWidget* parent)
: QToolButton(parent), d(new Private(this, position)) : KisHighlightedToolButton(parent), d(new Private(this, position))
{ {
} }
KoGroupButton::KoGroupButton(QWidget* parent) KoGroupButton::KoGroupButton(QWidget* parent)
: QToolButton(parent), d(new Private(this, NoGroup)) : KisHighlightedToolButton(parent), d(new Private(this, NoGroup))
{ {
} }
...@@ -114,7 +110,7 @@ void KoGroupButton::paintEvent(QPaintEvent* event) ...@@ -114,7 +110,7 @@ void KoGroupButton::paintEvent(QPaintEvent* event)
if (!isChecked() && !isDown() && !(panelOpt.state & QStyle::State_MouseOver)) { if (!isChecked() && !isDown() && !(panelOpt.state & QStyle::State_MouseOver)) {
} else { } else {
// only highlight the selected item // only highlight the selected item
panelOpt.state |= (QStyle::State_On | QStyle::State_Sunken); panelOpt.state |= (QStyle::State_On | QStyle::State_Sunken);
QPalette panelPal(panelOpt.palette); QPalette panelPal(panelOpt.palette);
QColor c; QColor c;
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include "kritawidgetutils_export.h" #include "kritawidgetutils_export.h"
// Qt #include <KisHighlightedToolButton.h>
#include <QToolButton>
/** /**
* A thin tool button which can be visually grouped with other buttons. * A thin tool button which can be visually grouped with other buttons.
...@@ -32,7 +31,7 @@ ...@@ -32,7 +31,7 @@
* *
* For groupping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons. * For groupping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons.
*/ */
class KRITAWIDGETUTILS_EXPORT KoGroupButton : public QToolButton class KRITAWIDGETUTILS_EXPORT KoGroupButton : public KisHighlightedToolButton
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS( GroupPosition ) Q_ENUMS( GroupPosition )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment