clang-format + clang-tidy improvements
This commit is contained in:
parent
890ae64652
commit
1faf2e091c
@ -4,351 +4,463 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "QskSpinBox.h"
|
#include "QskSpinBox.h"
|
||||||
#include <QskLinearBox.h>
|
#include <QGuiApplication>
|
||||||
#include <QskGridBox.h>
|
|
||||||
#include <QskTextInput.h>
|
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
#include <QskBoxShapeMetrics.h>
|
#include <QStyleHints>
|
||||||
#include <QskBoxBorderColors.h>
|
#include <QskBoxBorderColors.h>
|
||||||
#include <QskBoxBorderMetrics.h>
|
#include <QskBoxBorderMetrics.h>
|
||||||
#include <QskSkinlet.h>
|
#include <QskBoxShapeMetrics.h>
|
||||||
#include <QskEvent.h>
|
#include <QskEvent.h>
|
||||||
#include <QtMath>
|
#include <QskGridBox.h>
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QStyleHints>
|
|
||||||
#include <QskIntervalF.h>
|
#include <QskIntervalF.h>
|
||||||
|
#include <QskLinearBox.h>
|
||||||
|
#include <QskSkinlet.h>
|
||||||
|
#include <QskTextInput.h>
|
||||||
|
#include <QtMath>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
QSK_SUBCONTROL(QskSpinBox, IncrementPanel)
|
QSK_SUBCONTROL( QskSpinBox, IncrementPanel )
|
||||||
QSK_SUBCONTROL(QskSpinBox, DecrementPanel)
|
QSK_SUBCONTROL( QskSpinBox, DecrementPanel )
|
||||||
QSK_SUBCONTROL(QskSpinBox, IncrementText)
|
QSK_SUBCONTROL( QskSpinBox, IncrementText )
|
||||||
QSK_SUBCONTROL(QskSpinBox, DecrementText)
|
QSK_SUBCONTROL( QskSpinBox, DecrementText )
|
||||||
QSK_SUBCONTROL(QskSpinBox, Text)
|
QSK_SUBCONTROL( QskSpinBox, Text )
|
||||||
QSK_SUBCONTROL(QskSpinBox, TextPanel)
|
QSK_SUBCONTROL( QskSpinBox, TextPanel )
|
||||||
QSK_SUBCONTROL(QskSpinBox, Layout)
|
QSK_SUBCONTROL( QskSpinBox, Layout )
|
||||||
|
|
||||||
QSK_SYSTEM_STATE(QskSpinBox, Pressed, ( QskAspect::QskAspect::FirstSystemState << 0))
|
QSK_SYSTEM_STATE( QskSpinBox, Pressed, ( QskAspect::QskAspect::FirstSystemState << 0 ) )
|
||||||
|
|
||||||
namespace aliased_enum
|
namespace aliased_enum
|
||||||
{
|
{
|
||||||
constexpr auto D = QskSpinBox::Decrement;
|
constexpr auto D = QskSpinBox::Decrement;
|
||||||
constexpr auto T = QskSpinBox::Textbox;
|
constexpr auto T = QskSpinBox::Textbox;
|
||||||
constexpr auto I = QskSpinBox::Increment;
|
constexpr auto I = QskSpinBox::Increment;
|
||||||
constexpr auto N = QskSpinBox::None;
|
constexpr auto N = QskSpinBox::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QskSpinBox::PrivateData
|
class QskSpinBox::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit PrivateData( QskSpinBox* const parent )
|
||||||
explicit PrivateData(QskSpinBox* const parent) : q(parent)
|
: q( parent )
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusIndeces defaultFocusIndex() const
|
|
||||||
{
|
|
||||||
const auto layout = q->alignmentHint(QskSpinBox::Layout);
|
|
||||||
|
|
||||||
if(layout == Qt::AlignLeft) return QskSpinBox::Textbox;
|
|
||||||
if(layout == Qt::AlignRight) return QskSpinBox::Decrement;
|
|
||||||
if(layout == Qt::AlignHCenter) return QskSpinBox::Decrement;
|
|
||||||
if(layout == Qt::AlignTop) return QskSpinBox::Textbox;
|
|
||||||
if(layout == Qt::AlignBottom) return QskSpinBox::Increment;
|
|
||||||
if(layout == Qt::AlignVCenter) return QskSpinBox::Increment;
|
|
||||||
if(layout == (Qt::AlignLeft | Qt::AlignVCenter)) return QskSpinBox::Textbox;
|
|
||||||
if(layout == (Qt::AlignRight | Qt::AlignVCenter)) return QskSpinBox::Increment;
|
|
||||||
if(layout == (Qt::AlignTop | Qt::AlignHCenter)) return QskSpinBox::Textbox;
|
|
||||||
if(layout == (Qt::AlignBottom | Qt::AlignHCenter)) return QskSpinBox::Decrement;
|
|
||||||
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusIndeces nextFocusIndex() const
|
|
||||||
{
|
|
||||||
const auto layout = q->alignmentHint(QskSpinBox::Layout);
|
|
||||||
using namespace aliased_enum;
|
|
||||||
|
|
||||||
// [0][1][2][3] := index
|
|
||||||
// [D][T][I][N] := control
|
|
||||||
using LUT = std::array<QskSpinBox::FocusIndeces,4>;
|
|
||||||
if(layout == Qt::AlignLeft) return LUT{I,D,N,T}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignRight) return LUT{I,N,T,D}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignHCenter) return LUT{T,I,N,D}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignTop) return LUT{N,I,D,T}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignBottom) return LUT{T,N,D,I}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignVCenter) return LUT{N,D,T,I}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignLeft | Qt::AlignVCenter)) return LUT{N,I,D,T}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignRight | Qt::AlignVCenter)) return LUT{T,N,D,I}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignTop | Qt::AlignHCenter)) return LUT{I,D,N,T}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignBottom | Qt::AlignHCenter)) return LUT{I,N,T,D}[m_focusIndex];
|
|
||||||
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusIndeces previousFocusIndex() const
|
|
||||||
{
|
|
||||||
const auto layout = q->alignmentHint(QskSpinBox::Layout);
|
|
||||||
using namespace aliased_enum;
|
|
||||||
|
|
||||||
// [0][1][2][3] := index
|
|
||||||
// [D][T][I][N] := control
|
|
||||||
using LUT = std::array<FocusIndeces,4>;
|
|
||||||
if(layout == Qt::AlignLeft) return LUT{T,N,D,I}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignRight) return LUT{N,I,D,T}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignHCenter) return LUT{N,D,T,I}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignTop) return LUT{I,N,T,D}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignBottom) return LUT{I,D,N,T}[m_focusIndex];
|
|
||||||
if(layout == Qt::AlignVCenter) return LUT{T,I,N,D}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignLeft | Qt::AlignVCenter)) return LUT{I,N,T,D}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignRight | Qt::AlignVCenter)) return LUT{I,D,N,T}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignTop | Qt::AlignHCenter)) return LUT{T,N,D,I}[m_focusIndex];
|
|
||||||
if(layout == (Qt::AlignBottom | Qt::AlignHCenter)) return LUT{N,I,D,T}[m_focusIndex];
|
|
||||||
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusIndeces focusIndex() const
|
|
||||||
{
|
|
||||||
return m_focusIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void focusNext()
|
|
||||||
{
|
|
||||||
const auto index = nextFocusIndex();
|
|
||||||
setFocus(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void focusPrevious()
|
|
||||||
{
|
|
||||||
const auto index = previousFocusIndex();
|
|
||||||
setFocus(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void focusDefault()
|
|
||||||
{
|
|
||||||
const auto index = defaultFocusIndex();
|
|
||||||
setFocus(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFocus(const FocusIndeces index)
|
|
||||||
{
|
|
||||||
using namespace aliased_enum;
|
|
||||||
Q_ASSERT(index == D || index == T || index == I || index == N);
|
|
||||||
if(index == D || index == T || index == I || index == N)
|
|
||||||
{
|
{
|
||||||
m_focusIndex = index;
|
|
||||||
Q_EMIT q->focusIndexChanged(m_focusIndex);
|
|
||||||
q->update();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QRectF focusIndicatorRect() const
|
FocusIndeces defaultFocusIndex() const
|
||||||
{
|
{
|
||||||
using namespace aliased_enum;
|
const auto layout = q->alignmentHint( QskSpinBox::Layout );
|
||||||
if(m_focusIndex == D) return q->subControlRect(QskSpinBox::DecrementPanel);
|
|
||||||
if(m_focusIndex == I) return q->subControlRect(QskSpinBox::IncrementPanel);
|
|
||||||
if(m_focusIndex == T) return q->subControlRect(QskSpinBox::TextPanel);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveMousePosition(const QPointF& pos)
|
if ( layout == Qt::AlignLeft )
|
||||||
{
|
{
|
||||||
q->setSkinHint(QskSpinBox::Layout | QskAspect::Metric | QskAspect::Position, pos );
|
return QskSpinBox::Textbox;
|
||||||
}
|
}
|
||||||
|
if ( layout == Qt::AlignRight )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Decrement;
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignHCenter )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Decrement;
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignTop )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Textbox;
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignBottom )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Increment;
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignVCenter )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Increment;
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignLeft | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Textbox;
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignRight | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Increment;
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignTop | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Textbox;
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignBottom | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return QskSpinBox::Decrement;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
return None;
|
||||||
QskSpinBox* const q;
|
}
|
||||||
FocusIndeces m_focusIndex = FocusIndeces::None;
|
|
||||||
|
FocusIndeces nextFocusIndex() const
|
||||||
|
{
|
||||||
|
const auto layout = q->alignmentHint( QskSpinBox::Layout );
|
||||||
|
using namespace aliased_enum;
|
||||||
|
|
||||||
|
// [0][1][2][3] := index
|
||||||
|
// [D][T][I][N] := control
|
||||||
|
using LUT = std::array< QskSpinBox::FocusIndeces, 4 >;
|
||||||
|
if ( layout == Qt::AlignLeft )
|
||||||
|
{
|
||||||
|
return LUT{ I, D, N, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignRight )
|
||||||
|
{
|
||||||
|
return LUT{ I, N, T, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignHCenter )
|
||||||
|
{
|
||||||
|
return LUT{ T, I, N, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignTop )
|
||||||
|
{
|
||||||
|
return LUT{ N, I, D, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignBottom )
|
||||||
|
{
|
||||||
|
return LUT{ T, N, D, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignVCenter )
|
||||||
|
{
|
||||||
|
return LUT{ N, D, T, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignLeft | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ N, I, D, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignRight | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ T, N, D, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignTop | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ I, D, N, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignBottom | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ I, N, T, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusIndeces previousFocusIndex() const
|
||||||
|
{
|
||||||
|
const auto layout = q->alignmentHint( QskSpinBox::Layout );
|
||||||
|
using namespace aliased_enum;
|
||||||
|
|
||||||
|
// [0][1][2][3] := index
|
||||||
|
// [D][T][I][N] := control
|
||||||
|
using LUT = std::array< FocusIndeces, 4 >;
|
||||||
|
if ( layout == Qt::AlignLeft )
|
||||||
|
{
|
||||||
|
return LUT{ T, N, D, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignRight )
|
||||||
|
{
|
||||||
|
return LUT{ N, I, D, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignHCenter )
|
||||||
|
{
|
||||||
|
return LUT{ N, D, T, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignTop )
|
||||||
|
{
|
||||||
|
return LUT{ I, N, T, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignBottom )
|
||||||
|
{
|
||||||
|
return LUT{ I, D, N, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == Qt::AlignVCenter )
|
||||||
|
{
|
||||||
|
return LUT{ T, I, N, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignLeft | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ I, N, T, D }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignRight | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ I, D, N, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignTop | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ T, N, D, I }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
if ( layout == ( Qt::AlignBottom | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
return LUT{ N, I, D, T }[ m_focusIndex ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusIndeces focusIndex() const
|
||||||
|
{
|
||||||
|
return m_focusIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void focusNext()
|
||||||
|
{
|
||||||
|
const auto index = nextFocusIndex();
|
||||||
|
setFocus( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
void focusPrevious()
|
||||||
|
{
|
||||||
|
const auto index = previousFocusIndex();
|
||||||
|
setFocus( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
void focusDefault()
|
||||||
|
{
|
||||||
|
const auto index = defaultFocusIndex();
|
||||||
|
setFocus( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFocus( const FocusIndeces index )
|
||||||
|
{
|
||||||
|
using namespace aliased_enum;
|
||||||
|
Q_ASSERT( index == D || index == T || index == I || index == N );
|
||||||
|
if ( index == D || index == T || index == I || index == N )
|
||||||
|
{
|
||||||
|
m_focusIndex = index;
|
||||||
|
Q_EMIT q->focusIndexChanged( m_focusIndex );
|
||||||
|
q->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF focusIndicatorRect() const
|
||||||
|
{
|
||||||
|
if ( m_focusIndex == QskSpinBox::Decrement )
|
||||||
|
{
|
||||||
|
return q->subControlRect( QskSpinBox::DecrementPanel );
|
||||||
|
}
|
||||||
|
if ( m_focusIndex == QskSpinBox::Increment )
|
||||||
|
{
|
||||||
|
return q->subControlRect( QskSpinBox::IncrementPanel );
|
||||||
|
}
|
||||||
|
if ( m_focusIndex == QskSpinBox::Textbox )
|
||||||
|
{
|
||||||
|
return q->subControlRect( QskSpinBox::TextPanel );
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveMousePosition( const QPointF& pos )
|
||||||
|
{
|
||||||
|
q->setSkinHint( QskSpinBox::Layout | QskAspect::Metric | QskAspect::Position, pos );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool focusNow() const
|
||||||
|
{
|
||||||
|
const auto focusOnClick = ( q->focusPolicy() & Qt::ClickFocus ) == Qt::ClickFocus;
|
||||||
|
const auto focusOnTouchRelease = QGuiApplication::styleHints()->setFocusOnTouchRelease();
|
||||||
|
return focusOnClick && !focusOnTouchRelease;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QskSpinBox* const q;
|
||||||
|
FocusIndeces m_focusIndex = FocusIndeces::None;
|
||||||
};
|
};
|
||||||
|
|
||||||
using S = QskSpinBox;
|
using S = QskSpinBox;
|
||||||
|
|
||||||
QskSpinBox::QskSpinBox(QQuickItem* const parent)
|
QskSpinBox::QskSpinBox( QQuickItem* const parent )
|
||||||
: Inherited(parent)
|
: Inherited( parent )
|
||||||
, m_data(std::make_unique<PrivateData>(this))
|
, m_data( std::make_unique< PrivateData >( this ) )
|
||||||
{
|
{
|
||||||
setBoundaries(0.0,1.0);
|
setBoundaries( 0.0, 1.0 );
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents( true );
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons( Qt::LeftButton );
|
||||||
setFocusPolicy( Qt::StrongFocus );
|
setFocusPolicy( Qt::StrongFocus );
|
||||||
|
|
||||||
connect( this, &S::focusIndexChanged, this, &S::focusIndicatorRectChanged );
|
connect( this, &S::focusIndexChanged, this, &S::focusIndicatorRectChanged );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSpinBox::~QskSpinBox() = default;
|
QskSpinBox::~QskSpinBox() = default;
|
||||||
|
|
||||||
void QskSpinBox::hoverEnterEvent(QHoverEvent* event)
|
void QskSpinBox::hoverEnterEvent( QHoverEvent* const event )
|
||||||
{
|
{
|
||||||
m_data->saveMousePosition( qskHoverPosition( event ) );
|
m_data->saveMousePosition( qskHoverPosition( event ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSpinBox::hoverLeaveEvent(QHoverEvent* event)
|
void QskSpinBox::hoverLeaveEvent( QHoverEvent* /*const event */ )
|
||||||
{
|
{
|
||||||
m_data->saveMousePosition( {} );
|
m_data->saveMousePosition( {} );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSpinBox::hoverMoveEvent(QHoverEvent *event)
|
void QskSpinBox::hoverMoveEvent( QHoverEvent* const event )
|
||||||
{
|
{
|
||||||
m_data->saveMousePosition( qskHoverPosition( event ) );
|
m_data->saveMousePosition( qskHoverPosition( event ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSpinBox::mouseReleaseEvent(QMouseEvent *event)
|
void QskSpinBox::mouseReleaseEvent( QMouseEvent* const event )
|
||||||
{
|
{
|
||||||
m_data->saveMousePosition( qskMousePosition( event ) );
|
m_data->saveMousePosition( qskMousePosition( event ) );
|
||||||
|
|
||||||
const auto focus = ( focusPolicy() & Qt::ClickFocus ) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease();
|
const auto focus = m_data->focusNow();
|
||||||
|
|
||||||
if(subControlRect(QskSpinBox::IncrementPanel).contains( event->pos() ))
|
if ( subControlRect( QskSpinBox::IncrementPanel ).contains( event->pos() ) )
|
||||||
{
|
|
||||||
increment(+stepSize());
|
|
||||||
|
|
||||||
if( focus )
|
|
||||||
{
|
{
|
||||||
m_data->setFocus(Increment);
|
increment( +stepSize() );
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
if ( focus )
|
||||||
}
|
|
||||||
|
|
||||||
if(subControlRect(QskSpinBox::DecrementPanel).contains( event->pos() ))
|
|
||||||
{
|
|
||||||
increment(-stepSize());
|
|
||||||
|
|
||||||
if( focus )
|
|
||||||
{
|
|
||||||
m_data->setFocus(Decrement);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(subControlRect(QskSpinBox::TextPanel).contains( event->pos() ))
|
|
||||||
{
|
|
||||||
if( focus )
|
|
||||||
{
|
|
||||||
m_data->setFocus(Textbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QskSpinBox::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
m_data->saveMousePosition( -1 * qskMousePosition( event ) );
|
|
||||||
|
|
||||||
const auto focus = ( focusPolicy() & Qt::ClickFocus ) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease();
|
|
||||||
|
|
||||||
if(subControlRect(QskSpinBox::IncrementPanel).contains( event->pos() ))
|
|
||||||
{
|
|
||||||
if( focus )
|
|
||||||
{
|
|
||||||
m_data->setFocus(QskSpinBox::Increment);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(subControlRect(QskSpinBox::DecrementPanel).contains( event->pos() ))
|
|
||||||
{
|
|
||||||
if( focus )
|
|
||||||
{
|
|
||||||
m_data->setFocus(QskSpinBox::Decrement);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QskSpinBox::keyPressEvent(QKeyEvent *event)
|
|
||||||
{
|
|
||||||
switch( event->key() )
|
|
||||||
{
|
|
||||||
case Qt::Key_Plus:
|
|
||||||
case Qt::Key_Up:
|
|
||||||
case Qt::Key_Right:
|
|
||||||
increment(+stepSize());
|
|
||||||
return;
|
|
||||||
case Qt::Key_Minus:
|
|
||||||
case Qt::Key_Down:
|
|
||||||
case Qt::Key_Left:
|
|
||||||
increment(-stepSize());
|
|
||||||
return;
|
|
||||||
case Qt::Key_Select:
|
|
||||||
case Qt::Key_Space:
|
|
||||||
if(focusIndex() == Increment) increment(+stepSize());
|
|
||||||
if(focusIndex() == Decrement) increment(-stepSize());
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
const int steps = qskFocusChainIncrement( event );
|
|
||||||
|
|
||||||
if(steps < 0)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < qAbs(steps); ++i)
|
|
||||||
{
|
{
|
||||||
m_data->focusPrevious();
|
m_data->setFocus( Increment );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(steps > 0)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < steps; ++i)
|
|
||||||
{
|
|
||||||
m_data->focusNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(steps != 0 && m_data->focusIndex() != None)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Inherited::keyPressEvent( event );
|
if ( subControlRect( QskSpinBox::DecrementPanel ).contains( event->pos() ) )
|
||||||
|
{
|
||||||
|
increment( -stepSize() );
|
||||||
|
|
||||||
|
if ( focus )
|
||||||
|
{
|
||||||
|
m_data->setFocus( Decrement );
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( subControlRect( QskSpinBox::TextPanel ).contains( event->pos() ) )
|
||||||
|
{
|
||||||
|
if ( focus )
|
||||||
|
{
|
||||||
|
m_data->setFocus( Textbox );
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSpinBox::keyReleaseEvent( QKeyEvent* event )
|
void QskSpinBox::mousePressEvent( QMouseEvent* const event )
|
||||||
{
|
{
|
||||||
if( event->key() == Qt::Key_Select || event->key() == Qt::Key_Space )
|
m_data->saveMousePosition( -1 * qskMousePosition( event ) );
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Inherited::keyReleaseEvent( event );
|
const auto focus = m_data->focusNow();
|
||||||
|
|
||||||
|
if ( subControlRect( QskSpinBox::IncrementPanel ).contains( event->pos() ) )
|
||||||
|
{
|
||||||
|
if ( focus )
|
||||||
|
{
|
||||||
|
m_data->setFocus( QskSpinBox::Increment );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( subControlRect( QskSpinBox::DecrementPanel ).contains( event->pos() ) )
|
||||||
|
{
|
||||||
|
if ( focus )
|
||||||
|
{
|
||||||
|
m_data->setFocus( QskSpinBox::Decrement );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSpinBox::focusInEvent(QFocusEvent *event)
|
void QskSpinBox::keyPressEvent( QKeyEvent* const event )
|
||||||
{
|
{
|
||||||
switch( event->reason() )
|
switch ( event->key() )
|
||||||
{
|
{
|
||||||
case Qt::TabFocusReason:
|
case Qt::Key_Plus:
|
||||||
m_data->focusNext();
|
case Qt::Key_Up:
|
||||||
break;
|
case Qt::Key_Right:
|
||||||
|
increment( +stepSize() );
|
||||||
|
return;
|
||||||
|
case Qt::Key_Minus:
|
||||||
|
case Qt::Key_Down:
|
||||||
|
case Qt::Key_Left:
|
||||||
|
increment( -stepSize() );
|
||||||
|
return;
|
||||||
|
case Qt::Key_Select:
|
||||||
|
case Qt::Key_Space:
|
||||||
|
if ( focusIndex() == Increment )
|
||||||
|
{
|
||||||
|
increment( +stepSize() );
|
||||||
|
}
|
||||||
|
if ( focusIndex() == Decrement )
|
||||||
|
{
|
||||||
|
increment( -stepSize() );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Qt::BacktabFocusReason:
|
const int steps = qskFocusChainIncrement( event );
|
||||||
m_data->focusPrevious();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
if ( steps < 0 )
|
||||||
if(m_data->focusIndex() == QskSpinBox::None)
|
{
|
||||||
{
|
for ( int i = 0; i < qAbs( steps ); ++i )
|
||||||
|
{
|
||||||
|
m_data->focusPrevious();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( steps > 0 )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < steps; ++i )
|
||||||
|
{
|
||||||
|
m_data->focusNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( steps != 0 && m_data->focusIndex() != None )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inherited::keyPressEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskSpinBox::keyReleaseEvent( QKeyEvent* const event )
|
||||||
|
{
|
||||||
|
if ( event->key() == Qt::Key_Select || event->key() == Qt::Key_Space )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inherited::keyReleaseEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskSpinBox::focusInEvent( QFocusEvent* const event )
|
||||||
|
{
|
||||||
|
if ( event->reason() == Qt::TabFocusReason )
|
||||||
|
{
|
||||||
|
m_data->focusNext();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event->reason() == Qt::BacktabFocusReason )
|
||||||
|
{
|
||||||
|
m_data->focusPrevious();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_data->focusIndex() == QskSpinBox::None )
|
||||||
|
{
|
||||||
m_data->focusDefault();
|
m_data->focusDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Inherited::focusInEvent( event );
|
Inherited::focusInEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskSpinBox::focusIndicatorRect() const
|
QRectF QskSpinBox::focusIndicatorRect() const
|
||||||
{
|
{
|
||||||
auto rect = m_data->focusIndicatorRect();
|
return m_data->focusIndicatorRect();
|
||||||
return rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSpinBox::FocusIndeces QskSpinBox::focusIndex() const
|
QskSpinBox::FocusIndeces QskSpinBox::focusIndex() const
|
||||||
{
|
{
|
||||||
return m_data->focusIndex();
|
return m_data->focusIndex();
|
||||||
}
|
}
|
||||||
|
@ -5,43 +5,51 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QskBoundedValueInput.h>
|
||||||
#include <QskControl.h>
|
#include <QskControl.h>
|
||||||
#include <QskPushButton.h>
|
#include <QskPushButton.h>
|
||||||
#include <QskBoundedValueInput.h>
|
|
||||||
|
|
||||||
class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
|
class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
using Inherited = QskBoundedValueInput;
|
using Inherited = QskBoundedValueInput;
|
||||||
public:
|
|
||||||
enum FocusIndeces : int { Decrement = 0, Textbox = 1, Increment = 2, None = 3 };
|
|
||||||
Q_ENUM(FocusIndeces)
|
|
||||||
|
|
||||||
Q_PROPERTY(FocusIndeces focusIndex READ focusIndex NOTIFY focusIndexChanged)
|
public:
|
||||||
QSK_SUBCONTROLS(IncrementPanel, DecrementPanel, IncrementText, DecrementText, TextPanel, Text, Layout)
|
enum FocusIndeces : int
|
||||||
QSK_STATES( Pressed )
|
{
|
||||||
|
Decrement = 0,
|
||||||
|
Textbox = 1,
|
||||||
|
Increment = 2,
|
||||||
|
None = 3
|
||||||
|
};
|
||||||
|
Q_ENUM( FocusIndeces )
|
||||||
|
|
||||||
explicit QskSpinBox( QQuickItem* parent = nullptr );
|
Q_PROPERTY( FocusIndeces focusIndex READ focusIndex NOTIFY focusIndexChanged )
|
||||||
~QskSpinBox() override;
|
QSK_SUBCONTROLS(
|
||||||
FocusIndeces focusIndex() const;
|
IncrementPanel, DecrementPanel, IncrementText, DecrementText, TextPanel, Text, Layout )
|
||||||
|
QSK_STATES( Pressed )
|
||||||
|
|
||||||
Q_SIGNALS:
|
explicit QskSpinBox( QQuickItem* parent = nullptr );
|
||||||
void focusIndexChanged(int index);
|
~QskSpinBox() override;
|
||||||
|
FocusIndeces focusIndex() const;
|
||||||
|
|
||||||
private:
|
Q_SIGNALS:
|
||||||
void hoverEnterEvent( QHoverEvent* event) override;
|
void focusIndexChanged( int index );
|
||||||
void hoverLeaveEvent( QHoverEvent* event) override;
|
|
||||||
void hoverMoveEvent( QHoverEvent* event) override;
|
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
private:
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void hoverEnterEvent( QHoverEvent* event ) override;
|
||||||
|
void hoverLeaveEvent( QHoverEvent* event ) override;
|
||||||
|
void hoverMoveEvent( QHoverEvent* event ) override;
|
||||||
|
|
||||||
void keyPressEvent( QKeyEvent* event ) override;
|
void mouseReleaseEvent( QMouseEvent* event ) override;
|
||||||
void keyReleaseEvent( QKeyEvent* event ) override;
|
void mousePressEvent( QMouseEvent* event ) override;
|
||||||
|
|
||||||
void focusInEvent(QFocusEvent* event) override;
|
void keyPressEvent( QKeyEvent* event ) override;
|
||||||
QRectF focusIndicatorRect() const override;
|
void keyReleaseEvent( QKeyEvent* event ) override;
|
||||||
|
|
||||||
class PrivateData;
|
void focusInEvent( QFocusEvent* event ) override;
|
||||||
std::unique_ptr<PrivateData> m_data;
|
QRectF focusIndicatorRect() const override;
|
||||||
|
|
||||||
|
class PrivateData;
|
||||||
|
std::unique_ptr< PrivateData > m_data;
|
||||||
};
|
};
|
||||||
|
@ -8,222 +8,291 @@
|
|||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
const auto INCREMENT_TEXT = QStringLiteral("+");
|
namespace
|
||||||
const auto DECREMENT_TEXT = QStringLiteral("-");
|
|
||||||
|
|
||||||
enum SampleIndeces { Dec = 0, Txt = 1, Inc = 2, Count };
|
|
||||||
|
|
||||||
QskSpinBoxSkinlet::QskSpinBoxSkinlet(QskSkin *)
|
|
||||||
{
|
{
|
||||||
setNodeRoles({IncPanel, IncText, DecPanel, DecText, TextPanel, TextText});
|
inline QPointF cursorPosSkinHint( const QskSpinBox& spinbox )
|
||||||
}
|
|
||||||
|
|
||||||
int QskSpinBoxSkinlet::sampleCount(const QskSkinnable *, QskAspect::Subcontrol) const
|
|
||||||
{
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QskSpinBoxSkinlet::sampleRect(const QskSkinnable* const skinnable, const QRectF& rect, QskAspect::Subcontrol subControl, int index) const
|
|
||||||
{
|
|
||||||
if(index == Dec || index == Inc || index == Txt)
|
|
||||||
{
|
|
||||||
return subControlRect(skinnable, rect, subControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Inherited::sampleRect( skinnable, rect, subControl, index );
|
|
||||||
}
|
|
||||||
|
|
||||||
QskAspect::States QskSpinBoxSkinlet::sampleStates(const QskSkinnable* const skinnable, QskAspect::Subcontrol subControl, int index) const
|
|
||||||
{
|
|
||||||
using S = QskSpinBox;
|
|
||||||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
|
||||||
|
|
||||||
if ( subControl == S::DecrementPanel || subControl == S::IncrementPanel || subControl == S::TextPanel)
|
|
||||||
{
|
|
||||||
const auto* const spinbox = static_cast<const S*>(skinnable);
|
|
||||||
const auto cursorPos = spinbox->effectiveSkinHint(S::Layout | QskAspect::Metric | QskAspect::Position).toPointF();
|
|
||||||
const QPointF cursorPosAbs{qAbs(cursorPos.x()), qAbs(cursorPos.y())};
|
|
||||||
const auto focusIndex = spinbox->focusIndex();
|
|
||||||
|
|
||||||
const auto contain = !cursorPosAbs.isNull() && spinbox->subControlRect(subControl).contains(cursorPosAbs);
|
|
||||||
const auto pressed = contain && (cursorPos.x() < 0 || cursorPos.y() < 0);
|
|
||||||
const auto hovered = contain && !pressed;
|
|
||||||
const auto focused = ( subControl == S::IncrementPanel && focusIndex == S::Increment) ||
|
|
||||||
( subControl == S::DecrementPanel && focusIndex == S::Decrement) ||
|
|
||||||
( subControl == S::TextPanel && focusIndex == S::Textbox);
|
|
||||||
|
|
||||||
states.setFlag(QskControl::Hovered, hovered);
|
|
||||||
states.setFlag(QskSpinBox::Pressed, pressed);
|
|
||||||
states.setFlag(QskControl::Focused, focused);
|
|
||||||
}
|
|
||||||
|
|
||||||
return states;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSizeF QskSpinBoxSkinlet::sizeHint(const QskSkinnable* const skinnable, Qt::SizeHint sizeHint, const QSizeF& size) const
|
|
||||||
{
|
|
||||||
using S = QskSpinBox;
|
|
||||||
const auto* const spinbox = static_cast<const S*>(skinnable);
|
|
||||||
const auto layout = spinbox->alignmentHint(S::Layout);
|
|
||||||
const auto spacing = spinbox->spacingHint(S::Layout);
|
|
||||||
|
|
||||||
const auto strutInc = spinbox->strutSizeHint(S::IncrementPanel);
|
|
||||||
const auto strutDec = spinbox->strutSizeHint(S::DecrementPanel);
|
|
||||||
const auto strutTxt = spinbox->strutSizeHint(S::TextPanel);
|
|
||||||
|
|
||||||
if(sizeHint == Qt::MinimumSize || sizeHint == Qt::MaximumSize || Qt::PreferredSize)
|
|
||||||
{
|
|
||||||
if(layout == Qt::AlignTop || layout == Qt::AlignBottom || layout == Qt::AlignVCenter)
|
|
||||||
{
|
{
|
||||||
const auto w = qMax(strutDec.width(), qMax( strutTxt.width() , strutInc.width()));
|
const auto aspect = QskSpinBox::Layout | QskAspect::Metric | QskAspect::Position;
|
||||||
const auto h = strutDec.height() + strutTxt.height() + strutInc.height();
|
return spinbox.effectiveSkinHint( aspect ).toPointF();
|
||||||
return {w,h + 2.0 * spacing};
|
|
||||||
}
|
}
|
||||||
if(layout == Qt::AlignLeft || layout == Qt::AlignRight || layout == Qt::AlignHCenter)
|
|
||||||
|
enum SampleIndeces
|
||||||
{
|
{
|
||||||
const auto w = strutDec.width() + strutTxt.width() + strutInc.width();
|
Dec = 0,
|
||||||
const auto h = qMax(strutDec.height(), qMax( strutTxt.height() , strutInc.height()));
|
Txt = 1,
|
||||||
return {w + 2.0 * spacing,h};
|
Inc = 2,
|
||||||
}
|
Count
|
||||||
if(layout == (Qt::AlignLeft | Qt::AlignVCenter) || layout == (Qt::AlignRight | Qt::AlignVCenter))
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
QskSpinBoxSkinlet::QskSpinBoxSkinlet( QskSkin* )
|
||||||
|
{
|
||||||
|
setNodeRoles( { IncPanel, IncText, DecPanel, DecText, TextPanel, TextText } );
|
||||||
|
}
|
||||||
|
|
||||||
|
int QskSpinBoxSkinlet::sampleCount( const QskSkinnable*, QskAspect::Subcontrol ) const
|
||||||
|
{
|
||||||
|
return Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF QskSpinBoxSkinlet::sampleRect( const QskSkinnable* const skinnable, const QRectF& rect,
|
||||||
|
QskAspect::Subcontrol subControl, int index ) const
|
||||||
|
{
|
||||||
|
if ( index == Dec || index == Inc || index == Txt )
|
||||||
{
|
{
|
||||||
const auto w = strutTxt.width() + qMax(strutInc.width(), strutDec.width());
|
return subControlRect( skinnable, rect, subControl );
|
||||||
const auto h = qMax(2.0 * qMax(strutInc.height(), strutDec.height()), strutTxt.height());
|
|
||||||
return {w + spacing ,h + spacing};
|
|
||||||
}
|
}
|
||||||
if(layout == (Qt::AlignTop | Qt::AlignHCenter) || layout == (Qt::AlignTop | Qt::AlignHCenter))
|
|
||||||
|
return Inherited::sampleRect( skinnable, rect, subControl, index );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskAspect::States QskSpinBoxSkinlet::sampleStates(
|
||||||
|
const QskSkinnable* const skinnable, QskAspect::Subcontrol subControl, int index ) const
|
||||||
|
{
|
||||||
|
using S = QskSpinBox;
|
||||||
|
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
||||||
|
|
||||||
|
if ( subControl == S::DecrementPanel || subControl == S::IncrementPanel ||
|
||||||
|
subControl == S::TextPanel )
|
||||||
{
|
{
|
||||||
const auto w = qMax(strutTxt.width() , strutInc.width() + strutDec.width());
|
const auto* const spinbox = static_cast< const S* >( skinnable );
|
||||||
const auto h = strutTxt.height() + qMax(strutInc.height() , strutDec.height());
|
const auto cursorPos = cursorPosSkinHint( *spinbox );
|
||||||
return {w + spacing, h + spacing};
|
const QPointF cursorPosAbs{ qAbs( cursorPos.x() ), qAbs( cursorPos.y() ) };
|
||||||
|
const auto focusIndex = spinbox->focusIndex();
|
||||||
|
const auto subControlRect = spinbox->subControlRect( subControl );
|
||||||
|
|
||||||
|
const auto contain = !cursorPosAbs.isNull() && subControlRect.contains( cursorPosAbs );
|
||||||
|
const auto pressed = contain && ( cursorPos.x() < 0 || cursorPos.y() < 0 );
|
||||||
|
const auto hovered = contain && !pressed;
|
||||||
|
const auto focused = ( subControl == S::IncrementPanel && focusIndex == S::Increment ) ||
|
||||||
|
( subControl == S::DecrementPanel && focusIndex == S::Decrement ) ||
|
||||||
|
( subControl == S::TextPanel && focusIndex == S::Textbox );
|
||||||
|
|
||||||
|
states.setFlag( QskControl::Hovered, hovered );
|
||||||
|
states.setFlag( QskSpinBox::Pressed, pressed );
|
||||||
|
states.setFlag( QskControl::Focused, focused );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Inherited::sizeHint(skinnable, sizeHint, size);
|
return states;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskSpinBoxSkinlet::subControlRect(const QskSkinnable* const skinnable, const QRectF& rect, QskAspect::Subcontrol subControl) const
|
QSizeF QskSpinBoxSkinlet::sizeHint(
|
||||||
|
const QskSkinnable* const skinnable, Qt::SizeHint sizeHint, const QSizeF& size ) const
|
||||||
{
|
{
|
||||||
using S = QskSpinBox;
|
using S = QskSpinBox;
|
||||||
|
const auto* const spinbox = static_cast< const S* >( skinnable );
|
||||||
|
const auto layout = spinbox->alignmentHint( S::Layout );
|
||||||
|
const auto spacing = spinbox->spacingHint( S::Layout );
|
||||||
|
|
||||||
if(subControl == S::DecrementText) return subControlRect(skinnable, rect, S::DecrementPanel);
|
const auto strutInc = spinbox->strutSizeHint( S::IncrementPanel );
|
||||||
if(subControl == S::IncrementText) return subControlRect(skinnable, rect, S::IncrementPanel);
|
const auto strutDec = spinbox->strutSizeHint( S::DecrementPanel );
|
||||||
if(subControl == S::Text) return subControlRect(skinnable, rect, S::TextPanel);
|
const auto strutTxt = spinbox->strutSizeHint( S::TextPanel );
|
||||||
|
|
||||||
const auto* const spinbox = static_cast<const S*>(skinnable);
|
if ( sizeHint == Qt::MinimumSize || sizeHint == Qt::MaximumSize || Qt::PreferredSize )
|
||||||
const auto layout = spinbox->alignmentHint(S::Layout);
|
{
|
||||||
const auto spacing = spinbox->spacingHint(S::Layout);
|
if ( layout == Qt::AlignTop || layout == Qt::AlignBottom || layout == Qt::AlignVCenter )
|
||||||
|
{
|
||||||
std::array<QRectF, Count> rects =
|
const auto w = qMax( strutDec.width(), qMax( strutTxt.width(), strutInc.width() ) );
|
||||||
{
|
const auto h = strutDec.height() + strutTxt.height() + strutInc.height();
|
||||||
QRectF{ QPointF{}, spinbox->strutSizeHint(S::DecrementPanel)},
|
return { w, h + 2.0 * spacing };
|
||||||
QRectF{ QPointF{}, spinbox->strutSizeHint(S::TextPanel)},
|
}
|
||||||
QRectF{ QPointF{}, spinbox->strutSizeHint(S::IncrementPanel)},
|
if ( layout == Qt::AlignLeft || layout == Qt::AlignRight || layout == Qt::AlignHCenter )
|
||||||
};
|
{
|
||||||
|
const auto w = strutDec.width() + strutTxt.width() + strutInc.width();
|
||||||
const auto center = rect.center();
|
const auto h = qMax( strutDec.height(), qMax( strutTxt.height(), strutInc.height() ) );
|
||||||
|
return { w + 2.0 * spacing, h };
|
||||||
// TODO center everything
|
}
|
||||||
|
if ( layout == ( Qt::AlignLeft | Qt::AlignVCenter ) ||
|
||||||
if(layout == Qt::AlignLeft)
|
layout == ( Qt::AlignRight | Qt::AlignVCenter ) )
|
||||||
{
|
{
|
||||||
rects[Txt].moveTopLeft({0.0 /************/, center.y() - rects[Txt].height() * 0.5});
|
const auto w = strutTxt.width() + qMax( strutInc.width(), strutDec.width() );
|
||||||
rects[Dec].moveTopLeft({rects[Txt].right() + spacing, center.y() - rects[Dec].height() * 0.5});
|
const auto h =
|
||||||
rects[Inc].moveTopLeft({rects[Dec].right() + spacing, center.y() - rects[Inc].height() * 0.5});
|
qMax( 2.0 * qMax( strutInc.height(), strutDec.height() ), strutTxt.height() );
|
||||||
}
|
return { w + spacing, h + spacing };
|
||||||
else if(layout == Qt::AlignRight)
|
}
|
||||||
{
|
if ( layout == ( Qt::AlignTop | Qt::AlignHCenter ) ||
|
||||||
rects[Dec].moveTopLeft({0.0 /************/, center.y() - rects[Dec].height() * 0.5});
|
layout == ( Qt::AlignTop | Qt::AlignHCenter ) )
|
||||||
rects[Inc].moveTopLeft({rects[Dec].right() + spacing, center.y() - rects[Inc].height() * 0.5});
|
{
|
||||||
rects[Txt].moveTopLeft({rects[Inc].right() + spacing, center.y() - rects[Txt].height() * 0.5});
|
const auto w = qMax( strutTxt.width(), strutInc.width() + strutDec.width() );
|
||||||
}
|
const auto h = strutTxt.height() + qMax( strutInc.height(), strutDec.height() );
|
||||||
else if(layout == Qt::AlignTop)
|
return { w + spacing, h + spacing };
|
||||||
{
|
}
|
||||||
rects[Txt].moveTopLeft({center.x() - rects[Txt].width() * 0.5, 0.0 });
|
}
|
||||||
rects[Inc].moveTopLeft({center.x() - rects[Inc].width() * 0.5, rects[Txt].bottom() + spacing});
|
return Inherited::sizeHint( skinnable, sizeHint, size );
|
||||||
rects[Dec].moveTopLeft({center.x() - rects[Dec].width() * 0.5, rects[Inc].bottom() + spacing});
|
|
||||||
}
|
|
||||||
else if(layout == Qt::AlignBottom)
|
|
||||||
{
|
|
||||||
rects[Inc].moveTopLeft({center.x() - rects[Inc].width() * 0.5, 0.0});
|
|
||||||
rects[Dec].moveTopLeft({center.x() - rects[Dec].width() * 0.5, rects[Inc].bottom() + spacing});
|
|
||||||
rects[Txt].moveTopLeft({center.x() - rects[Txt].width() * 0.5, rects[Dec].bottom() + spacing});
|
|
||||||
}
|
|
||||||
else if(layout == Qt::AlignHCenter)
|
|
||||||
{
|
|
||||||
rects[Dec].moveTopLeft({0.0 /************/, center.y() - rects[Dec].height() * 0.5});
|
|
||||||
rects[Txt].moveTopLeft({rects[Dec].right() + spacing, center.y() - rects[Txt].height() * 0.5});
|
|
||||||
rects[Inc].moveTopLeft({rects[Txt].right() + spacing, center.y() - rects[Inc].height() * 0.5});
|
|
||||||
}
|
|
||||||
else if(layout == Qt::AlignVCenter)
|
|
||||||
{
|
|
||||||
rects[Inc].moveTopLeft({center.x() - rects[Inc].width() * 0.5, 0.0});
|
|
||||||
rects[Txt].moveTopLeft({center.x() - rects[Txt].width() * 0.5, rects[Inc].bottom() + spacing});
|
|
||||||
rects[Dec].moveTopLeft({center.x() - rects[Dec].width() * 0.5, rects[Txt].bottom() + spacing});
|
|
||||||
}
|
|
||||||
else if(layout == (Qt::AlignLeft | Qt::AlignVCenter))
|
|
||||||
{
|
|
||||||
rects[Txt].moveTopLeft({0.0 /************/, center.y() - rects[Txt].height() * 0.5 });
|
|
||||||
rects[Inc].moveTopLeft({rects[Txt].right() + spacing, center.y() - spacing * 0.5 - rects[Inc].height()});
|
|
||||||
rects[Dec].moveTopLeft({rects[Txt].right() + spacing, center.y() + spacing * 0.5});
|
|
||||||
}
|
|
||||||
else if(layout == (Qt::AlignRight | Qt::AlignVCenter))
|
|
||||||
{
|
|
||||||
const auto dx = qMax(rects[Inc].width(), rects[Dec].width());
|
|
||||||
rects[Inc].moveTopLeft({dx - rects[Inc].width(), center.y() - spacing * 0.5 - rects[Inc].height()});
|
|
||||||
rects[Dec].moveTopLeft({dx - rects[Dec].width(), center.y() + spacing * 0.5});
|
|
||||||
rects[Txt].moveTopLeft({dx + spacing, center.y() - rects[Txt].height() * 0.5 });
|
|
||||||
}
|
|
||||||
else if(layout == (Qt::AlignTop | Qt::AlignHCenter))
|
|
||||||
{
|
|
||||||
rects[Txt].moveTopLeft({center.x() - rects[Txt].width() * 0.5, 0.0 });
|
|
||||||
rects[Dec].moveTopLeft({rects[Txt].center().x() - spacing * 0.5 - rects[Dec].width(), rects[Txt].bottom() + spacing });
|
|
||||||
rects[Inc].moveTopLeft({rects[Txt].center().x() + spacing * 0.5, rects[Txt].bottom() + spacing });
|
|
||||||
}
|
|
||||||
else if(layout == (Qt::AlignBottom | Qt::AlignHCenter))
|
|
||||||
{
|
|
||||||
rects[Txt].moveTopLeft({center.x() - rects[Txt].width() * 0.5, center.y() - rects[Txt].height() * 0.5});
|
|
||||||
rects[Dec].moveTopLeft({center.x() - spacing * 0.5 - rects[Dec].width() , rects[Txt].top() - spacing - rects[Dec].height() });
|
|
||||||
rects[Inc].moveTopLeft({center.x() + spacing * 0.5, rects[Txt].top() - spacing - rects[Inc].height() });
|
|
||||||
}
|
|
||||||
|
|
||||||
if(subControl == S::DecrementPanel)
|
|
||||||
{
|
|
||||||
return rects[Dec];
|
|
||||||
}
|
|
||||||
if(subControl == S::TextPanel)
|
|
||||||
{
|
|
||||||
return rects[Txt];
|
|
||||||
}
|
|
||||||
if(subControl == S::IncrementPanel)
|
|
||||||
{
|
|
||||||
return rects[Inc];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Inherited::subControlRect(skinnable, rect, subControl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskSpinBoxSkinlet::updateSubNode(const QskSkinnable* const skinnable, const quint8 nodeRole, QSGNode* const node) const
|
QRectF QskSpinBoxSkinlet::subControlRect( const QskSkinnable* const skinnable, const QRectF& rect,
|
||||||
|
QskAspect::Subcontrol subControl ) const
|
||||||
{
|
{
|
||||||
using S = QskSpinBox;
|
using S = QskSpinBox;
|
||||||
if(nodeRole == IncPanel) { return updateSeriesNode( skinnable, S::IncrementPanel, node); }
|
|
||||||
if(nodeRole == DecPanel) { return updateSeriesNode( skinnable, S::DecrementPanel, node ); }
|
if ( subControl == S::DecrementText )
|
||||||
if(nodeRole == IncText) { return updateTextNode( skinnable, node, INCREMENT_TEXT, S::IncrementText); }
|
{
|
||||||
if(nodeRole == DecText) { return updateTextNode( skinnable, node, DECREMENT_TEXT, S::DecrementText ); }
|
return subControlRect( skinnable, rect, S::DecrementPanel );
|
||||||
if(nodeRole == TextPanel) { return updateSeriesNode( skinnable, S::TextPanel, node ); }
|
}
|
||||||
if(nodeRole == TextText) { return updateTextNode( skinnable, node, QString::number(static_cast<const S*>(skinnable)->value()), S::Text ); }
|
if ( subControl == S::IncrementText )
|
||||||
return Inherited::updateSubNode(skinnable, nodeRole, node);
|
{
|
||||||
|
return subControlRect( skinnable, rect, S::IncrementPanel );
|
||||||
|
}
|
||||||
|
if ( subControl == S::Text )
|
||||||
|
{
|
||||||
|
return subControlRect( skinnable, rect, S::TextPanel );
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* const spinbox = static_cast< const S* >( skinnable );
|
||||||
|
const auto layout = spinbox->alignmentHint( S::Layout );
|
||||||
|
const auto spacing = spinbox->spacingHint( S::Layout );
|
||||||
|
|
||||||
|
std::array< QRectF, Count > rects = {
|
||||||
|
QRectF{ QPointF{}, spinbox->strutSizeHint( S::DecrementPanel ) },
|
||||||
|
QRectF{ QPointF{}, spinbox->strutSizeHint( S::TextPanel ) },
|
||||||
|
QRectF{ QPointF{}, spinbox->strutSizeHint( S::IncrementPanel ) },
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto center = rect.center();
|
||||||
|
|
||||||
|
if ( layout == Qt::AlignLeft )
|
||||||
|
{
|
||||||
|
rects[ Txt ].moveTopLeft( { 0.0, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
rects[ Dec ].moveTopLeft(
|
||||||
|
{ rects[ Txt ].right() + spacing, center.y() - rects[ Dec ].height() * 0.5 } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ rects[ Dec ].right() + spacing, center.y() - rects[ Inc ].height() * 0.5 } );
|
||||||
|
}
|
||||||
|
else if ( layout == Qt::AlignRight )
|
||||||
|
{
|
||||||
|
rects[ Dec ].moveTopLeft( { 0.0, center.y() - rects[ Dec ].height() * 0.5 } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ rects[ Dec ].right() + spacing, center.y() - rects[ Inc ].height() * 0.5 } );
|
||||||
|
rects[ Txt ].moveTopLeft(
|
||||||
|
{ rects[ Inc ].right() + spacing, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
}
|
||||||
|
else if ( layout == Qt::AlignTop )
|
||||||
|
{
|
||||||
|
rects[ Txt ].moveTopLeft( { center.x() - rects[ Txt ].width() * 0.5, 0.0 } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Inc ].width() * 0.5, rects[ Txt ].bottom() + spacing } );
|
||||||
|
rects[ Dec ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Dec ].width() * 0.5, rects[ Inc ].bottom() + spacing } );
|
||||||
|
}
|
||||||
|
else if ( layout == Qt::AlignBottom )
|
||||||
|
{
|
||||||
|
rects[ Inc ].moveTopLeft( { center.x() - rects[ Inc ].width() * 0.5, 0.0 } );
|
||||||
|
rects[ Dec ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Dec ].width() * 0.5, rects[ Inc ].bottom() + spacing } );
|
||||||
|
rects[ Txt ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Txt ].width() * 0.5, rects[ Dec ].bottom() + spacing } );
|
||||||
|
}
|
||||||
|
else if ( layout == Qt::AlignHCenter )
|
||||||
|
{
|
||||||
|
rects[ Dec ].moveTopLeft( { 0.0, center.y() - rects[ Dec ].height() * 0.5 } );
|
||||||
|
rects[ Txt ].moveTopLeft(
|
||||||
|
{ rects[ Dec ].right() + spacing, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ rects[ Txt ].right() + spacing, center.y() - rects[ Inc ].height() * 0.5 } );
|
||||||
|
}
|
||||||
|
else if ( layout == Qt::AlignVCenter )
|
||||||
|
{
|
||||||
|
rects[ Inc ].moveTopLeft( { center.x() - rects[ Inc ].width() * 0.5, 0.0 } );
|
||||||
|
rects[ Txt ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Txt ].width() * 0.5, rects[ Inc ].bottom() + spacing } );
|
||||||
|
rects[ Dec ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Dec ].width() * 0.5, rects[ Txt ].bottom() + spacing } );
|
||||||
|
}
|
||||||
|
else if ( layout == ( Qt::AlignLeft | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
rects[ Txt ].moveTopLeft( { 0.0, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
rects[ Inc ].moveTopLeft( { rects[ Txt ].right() + spacing,
|
||||||
|
center.y() - spacing * 0.5 - rects[ Inc ].height() } );
|
||||||
|
rects[ Dec ].moveTopLeft( { rects[ Txt ].right() + spacing, center.y() + spacing * 0.5 } );
|
||||||
|
}
|
||||||
|
else if ( layout == ( Qt::AlignRight | Qt::AlignVCenter ) )
|
||||||
|
{
|
||||||
|
const auto dx = qMax( rects[ Inc ].width(), rects[ Dec ].width() );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ dx - rects[ Inc ].width(), center.y() - spacing * 0.5 - rects[ Inc ].height() } );
|
||||||
|
rects[ Dec ].moveTopLeft( { dx - rects[ Dec ].width(), center.y() + spacing * 0.5 } );
|
||||||
|
rects[ Txt ].moveTopLeft( { dx + spacing, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
}
|
||||||
|
else if ( layout == ( Qt::AlignTop | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
rects[ Txt ].moveTopLeft( { center.x() - rects[ Txt ].width() * 0.5, 0.0 } );
|
||||||
|
rects[ Dec ].moveTopLeft(
|
||||||
|
{ rects[ Txt ].center().x() - spacing * 0.5 - rects[ Dec ].width(),
|
||||||
|
rects[ Txt ].bottom() + spacing } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ rects[ Txt ].center().x() + spacing * 0.5, rects[ Txt ].bottom() + spacing } );
|
||||||
|
}
|
||||||
|
else if ( layout == ( Qt::AlignBottom | Qt::AlignHCenter ) )
|
||||||
|
{
|
||||||
|
rects[ Txt ].moveTopLeft(
|
||||||
|
{ center.x() - rects[ Txt ].width() * 0.5, center.y() - rects[ Txt ].height() * 0.5 } );
|
||||||
|
rects[ Dec ].moveTopLeft( { center.x() - spacing * 0.5 - rects[ Dec ].width(),
|
||||||
|
rects[ Txt ].top() - spacing - rects[ Dec ].height() } );
|
||||||
|
rects[ Inc ].moveTopLeft(
|
||||||
|
{ center.x() + spacing * 0.5, rects[ Txt ].top() - spacing - rects[ Inc ].height() } );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( subControl == S::DecrementPanel )
|
||||||
|
{
|
||||||
|
return rects[ Dec ];
|
||||||
|
}
|
||||||
|
if ( subControl == S::TextPanel )
|
||||||
|
{
|
||||||
|
return rects[ Txt ];
|
||||||
|
}
|
||||||
|
if ( subControl == S::IncrementPanel )
|
||||||
|
{
|
||||||
|
return rects[ Inc ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Inherited::subControlRect( skinnable, rect, subControl );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskSpinBoxSkinlet::updateSampleNode(const QskSkinnable* const skinnable, QskAspect::Subcontrol subControl, const int index, QSGNode* const node) const
|
QSGNode* QskSpinBoxSkinlet::updateSubNode(
|
||||||
|
const QskSkinnable* const skinnable, const quint8 nodeRole, QSGNode* const node ) const
|
||||||
{
|
{
|
||||||
using S = QskSpinBox;
|
using S = QskSpinBox;
|
||||||
const auto* const spinbox = static_cast<const S*>(skinnable);
|
if ( nodeRole == IncPanel )
|
||||||
|
{
|
||||||
if ( subControl == S::DecrementPanel || subControl == S::IncrementPanel || subControl == S::TextPanel )
|
return updateSeriesNode( skinnable, S::IncrementPanel, node );
|
||||||
{
|
}
|
||||||
const auto rect = sampleRect(spinbox, spinbox->contentsRect(), subControl, index);
|
if ( nodeRole == DecPanel )
|
||||||
return updateBoxNode( skinnable, node, rect, subControl );
|
{
|
||||||
}
|
return updateSeriesNode( skinnable, S::DecrementPanel, node );
|
||||||
|
}
|
||||||
return Inherited::updateSampleNode( skinnable, subControl, index, node );
|
if ( nodeRole == IncText )
|
||||||
|
{
|
||||||
|
return updateTextNode( skinnable, node, QStringLiteral( "+" ), S::IncrementText );
|
||||||
|
}
|
||||||
|
if ( nodeRole == DecText )
|
||||||
|
{
|
||||||
|
return updateTextNode( skinnable, node, QStringLiteral( "-" ), S::DecrementText );
|
||||||
|
}
|
||||||
|
if ( nodeRole == TextPanel )
|
||||||
|
{
|
||||||
|
return updateSeriesNode( skinnable, S::TextPanel, node );
|
||||||
|
}
|
||||||
|
if ( nodeRole == TextText )
|
||||||
|
{
|
||||||
|
const auto* const spinbox = static_cast< const S* >( skinnable );
|
||||||
|
return updateTextNode( skinnable, node, QString::number( spinbox->value() ), S::Text );
|
||||||
|
}
|
||||||
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSGNode* QskSpinBoxSkinlet::updateSampleNode( const QskSkinnable* const skinnable,
|
||||||
|
QskAspect::Subcontrol subControl, const int index, QSGNode* const node ) const
|
||||||
|
{
|
||||||
|
using S = QskSpinBox;
|
||||||
|
const auto* const spinbox = static_cast< const S* >( skinnable );
|
||||||
|
|
||||||
|
if ( subControl == S::DecrementPanel || subControl == S::IncrementPanel ||
|
||||||
|
subControl == S::TextPanel )
|
||||||
|
{
|
||||||
|
const auto rect = sampleRect( spinbox, spinbox->contentsRect(), subControl, index );
|
||||||
|
return updateBoxNode( skinnable, node, rect, subControl );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Inherited::updateSampleNode( skinnable, subControl, index, node );
|
||||||
}
|
}
|
||||||
|
@ -9,20 +9,32 @@
|
|||||||
|
|
||||||
class QSK_EXPORT QskSpinBoxSkinlet : public QskSkinlet
|
class QSK_EXPORT QskSpinBoxSkinlet : public QskSkinlet
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
public:
|
|
||||||
enum NodeRole
|
public:
|
||||||
{
|
enum NodeRole
|
||||||
IncPanel, IncText, DecPanel, DecText, TextPanel, TextText, RoleCount
|
{
|
||||||
};
|
IncPanel,
|
||||||
Q_INVOKABLE QskSpinBoxSkinlet( QskSkin* = nullptr );
|
IncText,
|
||||||
protected:
|
DecPanel,
|
||||||
int sampleCount( const QskSkinnable*, QskAspect::Subcontrol ) const override;
|
DecText,
|
||||||
QRectF sampleRect( const QskSkinnable*, const QRectF&, QskAspect::Subcontrol, int index ) const override;
|
TextPanel,
|
||||||
QskAspect::States sampleStates(const QskSkinnable* skinnable, QskAspect::Subcontrol subControl, int index ) const override;
|
TextText,
|
||||||
QSizeF sizeHint( const QskSkinnable*, Qt::SizeHint, const QSizeF& ) const override;
|
RoleCount
|
||||||
QRectF subControlRect( const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const override;
|
};
|
||||||
QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* ) const override;
|
Q_INVOKABLE QskSpinBoxSkinlet( QskSkin* = nullptr );
|
||||||
QSGNode* updateSampleNode( const QskSkinnable* skinnable, QskAspect::Subcontrol subControl, int index, QSGNode* node ) const override;
|
|
||||||
|
protected:
|
||||||
|
int sampleCount( const QskSkinnable*, QskAspect::Subcontrol ) const override;
|
||||||
|
QRectF sampleRect(
|
||||||
|
const QskSkinnable*, const QRectF&, QskAspect::Subcontrol, int index ) const override;
|
||||||
|
QskAspect::States sampleStates(
|
||||||
|
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl, int index ) const override;
|
||||||
|
QSizeF sizeHint( const QskSkinnable*, Qt::SizeHint, const QSizeF& ) const override;
|
||||||
|
QRectF subControlRect(
|
||||||
|
const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const override;
|
||||||
|
QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* ) const override;
|
||||||
|
QSGNode* updateSampleNode( const QskSkinnable* skinnable, QskAspect::Subcontrol subControl,
|
||||||
|
int index, QSGNode* node ) const override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user