Commit 76a9241f authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa

use std::function

parent a0fe0817
......@@ -820,7 +820,7 @@ namespace Breeze
void Style::drawPrimitive( PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{
StylePrimitive fcn( nullptr );
StylePrimitive fcn;
switch( element )
{
......@@ -861,7 +861,7 @@ namespace Breeze
painter->save();
// call function if implemented
if( !( fcn && ( this->*fcn )( option, painter, widget ) ) )
if( !( fcn && fcn( *this, option, painter, widget ) ) )
{ ParentStyleClass::drawPrimitive( element, option, painter, widget ); }
painter->restore();
......@@ -872,7 +872,7 @@ namespace Breeze
void Style::drawControl( ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{
StyleControl fcn( nullptr );
StyleControl fcn;
#if BREEZE_HAVE_KSTYLE||BREEZE_USE_KDE4
if( element == CE_CapacityBar )
......@@ -922,7 +922,7 @@ namespace Breeze
painter->save();
// call function if implemented
if( !( fcn && ( this->*fcn )( option, painter, widget ) ) )
if( !( fcn && fcn( *this, option, painter, widget ) ) )
{ ParentStyleClass::drawControl( element, option, painter, widget ); }
painter->restore();
......@@ -933,7 +933,7 @@ namespace Breeze
void Style::drawComplexControl( ComplexControl element, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const
{
StyleComplexControl fcn( nullptr );
StyleComplexControl fcn;
switch( element )
{
case CC_GroupBox: fcn = &Style::drawGroupBoxComplexControl; break;
......@@ -953,12 +953,11 @@ namespace Breeze
painter->save();
// call function if implemented
if( !( fcn && ( this->*fcn )( option, painter, widget ) ) )
if( !( fcn && fcn( *this, option, painter, widget ) ) )
{ ParentStyleClass::drawComplexControl( element, option, painter, widget ); }
painter->restore();
}
......
......@@ -47,6 +47,8 @@
#include <QCommandLinkButton>
#endif
#include <functional>
namespace BreezePrivate
{
class TabBarData;
......@@ -513,14 +515,14 @@ namespace Breeze
IconCache _iconCache;
//* pointer to primitive specialized function
using StylePrimitive = bool(Style::*)(const QStyleOption*, QPainter*, const QWidget* ) const;
StylePrimitive _frameFocusPrimitive = nullptr;
using StylePrimitive = std::function<bool(const Style&, const QStyleOption*, QPainter*, const QWidget*)>;
StylePrimitive _frameFocusPrimitive;
//* pointer to control specialized function
using StyleControl = bool (Style::*)( const QStyleOption*, QPainter*, const QWidget* ) const;
using StyleControl = std::function<bool(const Style&, const QStyleOption*, QPainter*, const QWidget*)>;
//* pointer to control specialized function
using StyleComplexControl = bool (Style::*)( const QStyleOptionComplex*, QPainter*, const QWidget* ) const;
using StyleComplexControl = std::function<bool(const Style&, const QStyleOptionComplex*, QPainter*, const QWidget*)>;
//*@name custom elements
//@{
......
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