formal adjustments

This commit is contained in:
Uwe Rathmann 2023-02-17 14:05:05 +01:00
parent eb5f3d3bcf
commit 8df1551701
4 changed files with 86 additions and 61 deletions

View File

@ -1,21 +1,24 @@
/******************************************************************************
* Copyright (C) 2023 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#include "QskSpinBox.h"
#include <QskLinearBox.h>
#include <QskGridBox.h>
#include <QskTextInput.h>
#include <QskBoxShapeMetrics.h>
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
#include <QskSkinlet.h>
#include <QskEvent.h>
#include "QskLinearBox.h"
#include "QskGridBox.h"
#include "QskTextInput.h"
#include "QskBoxShapeMetrics.h"
#include "QskBoxBorderColors.h"
#include "QskBoxBorderMetrics.h"
#include "QskSkinlet.h"
#include "QskIntervalF.h"
#include "QskEvent.h"
#include <QtMath>
#include <QGuiApplication>
#include <QStyleHints>
#include <QskIntervalF.h>
#include <array>
QSK_SUBCONTROL(QskSpinBox, Inc)
QSK_SUBCONTROL(QskSpinBox, Dec)

View File

@ -1,20 +1,20 @@
/******************************************************************************
* Copyright (C) 2023 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#pragma once
#ifndef QSK_SPIN_BOX_H
#define QSK_SPIN_BOX_H
#include <QskControl.h>
#include <QskPushButton.h>
#include <QskBoundedInput.h>
class QSK_EXPORT QskSpinBox : public QskBoundedInput
{
Q_OBJECT
Q_PROPERTY(qreal value READ value NOTIFY valueChanged)
using Inherited = QskBoundedInput;
public:
Q_PROPERTY(qreal value READ value NOTIFY valueChanged)
QSK_SUBCONTROLS(Inc, Dec, IncText, DecText, TextPanel, Text, Layout)
QSK_STATES( Pressed )
@ -25,24 +25,25 @@ public:
qreal value() const;
Q_SIGNALS:
void valueChanged(qreal value);
void valueChanged( qreal );
void focusIndexChanged( int );
private:
Q_SIGNAL void focusIndexChanged(int index);
void hoverEnterEvent( QHoverEvent* ) override;
void hoverLeaveEvent( QHoverEvent* ) override;
void hoverMoveEvent( QHoverEvent* ) override;
void hoverEnterEvent( QHoverEvent* event) override;
void hoverLeaveEvent( QHoverEvent* event) override;
void hoverMoveEvent( QHoverEvent* event) override;
void mouseReleaseEvent( QMouseEvent* ) override;
void mousePressEvent( QMouseEvent* ) override;
void mouseReleaseEvent(QMouseEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void keyPressEvent( QKeyEvent* ) override;
void keyReleaseEvent( QKeyEvent* ) override;
void keyPressEvent( QKeyEvent* event ) override;
void keyReleaseEvent( QKeyEvent* event ) override;
void focusInEvent(QFocusEvent* event) override;
void focusInEvent( QFocusEvent* ) override;
QRectF focusIndicatorRect() const override;
class PrivateData;
std::unique_ptr<PrivateData> m_data;
};
#endif

View File

@ -1,11 +1,12 @@
/******************************************************************************
* Copyright (C) 2023 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#include "QskSpinBoxSkinlet.h"
#include "QskSpinBox.h"
#include <QFontMetrics>
#include <qfontmetrics.h>
const auto INC_TEXT = QStringLiteral("+");
const auto DEC_TEXT = QStringLiteral("-");

View File

@ -1,9 +1,10 @@
/******************************************************************************
* Copyright (C) 2023 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#pragma once
#ifndef QSK_SPIN_BOX_SKINLET_H
#define QSK_SPIN_BOX_SKINLET_H
#include <QskSkinlet.h>
@ -11,18 +12,37 @@ class QSK_EXPORT QskSpinBoxSkinlet : public QskSkinlet
{
Q_GADGET
using Inherited = QskSkinlet;
public:
public:
enum NodeRole
{
IncPanel, IncText, DecPanel, DecText, TextPanel, TextText, RoleCount
IncPanel,
IncText,
DecPanel,
DecText,
TextPanel,
TextText,
RoleCount
};
Q_INVOKABLE QskSpinBoxSkinlet( QskSkin* = nullptr );
protected:
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;
QRectF sampleRect( const QskSkinnable*, const QRectF&,
QskAspect::Subcontrol, int index ) const override;
QskAspect::States sampleStates( const QskSkinnable*,
QskAspect::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;
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;
QSGNode* updateSampleNode( const QskSkinnable*,
QskAspect::Subcontrol, int index, QSGNode* node ) const override;
};
#endif