upgraded to uncrustify 0.76.0 - still not happy with the C++ beautifier

situation, that requires way too much manual post processing
This commit is contained in:
Uwe Rathmann 2023-02-28 15:49:42 +01:00
parent 9b2c2a8f12
commit a6bf60c9b4
51 changed files with 657 additions and 404 deletions

File diff suppressed because it is too large Load Diff

View File

@ -218,7 +218,7 @@ void Box::setGradient( FillType fillType,
QskGradientStops stops;
stops += QskGradientStop( 0.0, color1 );
stops += QskGradientStop( 1.0, color2 );
setGradient( fillType, stops );
}

View File

@ -25,7 +25,7 @@
namespace
{
// Some leftover definitions from M(aterial)2. TODO ...
constexpr const QRgb Grey400 = 0xffbdbdbd;
constexpr const QRgb Grey500 = 0xff9e9e9e;
@ -418,7 +418,8 @@ static void addColoredBorderRectangles1( QskLinearBox* parent,
box->setShape( 30, Qt::AbsoluteSize );
}
static void addColoredBorderRectangles2( QskLinearBox* parent, bool rounded, Box::FillType fillType )
static void addColoredBorderRectangles2( QskLinearBox* parent,
bool rounded, Box::FillType fillType )
{
Box* box = new Box( parent );
box->setBorderWidth( 20 );
@ -431,7 +432,8 @@ static void addColoredBorderRectangles2( QskLinearBox* parent, bool rounded, Box
box->setShape( 30, Qt::AbsoluteSize );
}
static void addColoredBorderRectangles3( QskLinearBox* parent, bool rounded, Box::FillType fillType )
static void addColoredBorderRectangles3( QskLinearBox* parent,
bool rounded, Box::FillType fillType )
{
Box* box = new Box( parent );
box->setBorderWidth( 20 );
@ -471,7 +473,8 @@ static void addColoredBorderRectangles3( QskLinearBox* parent, bool rounded, Box
box->setShape( 30, Qt::AbsoluteSize );
}
static void addColoredBorderRectangles4( QskLinearBox* parent, bool rounded, Box::FillType fillType )
static void addColoredBorderRectangles4( QskLinearBox* parent,
bool rounded, Box::FillType fillType )
{
Box* box = new Box( parent );
box->setBorderWidth( 20 );
@ -485,7 +488,8 @@ static void addColoredBorderRectangles4( QskLinearBox* parent, bool rounded, Box
box->setShape( 30, Qt::AbsoluteSize );
}
static void addColoredBorderRectangles5( QskLinearBox* parent, bool rounded, Box::FillType fillType )
static void addColoredBorderRectangles5( QskLinearBox* parent,
bool rounded, Box::FillType fillType )
{
Box* box = new Box( parent );
box->setBorderWidth( 20 );

View File

@ -41,9 +41,10 @@ namespace
};
}
BoxWithButtons::BoxWithButtons( const QString& title, const QString &prefix,
const int initialValue, const QString &suffix,
bool isBright, QQuickItem* parent )
BoxWithButtons::BoxWithButtons(
const QString& title, const QString& prefix,
const int initialValue, const QString& suffix,
bool isBright, QQuickItem* parent )
: Box( QString(), parent )
, m_prefix( prefix )
, m_suffix( suffix )

View File

@ -14,9 +14,10 @@ class BoxWithButtons : public Box
public:
QSK_SUBCONTROLS( Panel, ValuePanel, ValueText )
BoxWithButtons( const QString& title, const QString& prefix,
const int initialValue, const QString& suffix,
bool isBright, QQuickItem* parent = nullptr );
BoxWithButtons(
const QString& title, const QString& prefix,
const int initialValue, const QString& suffix,
bool isBright, QQuickItem* parent = nullptr );
private:
void setValue( const int value );

View File

@ -15,9 +15,9 @@ class Diagram : public QskControl
public:
QSK_SUBCONTROLS( Chart, Segments,
ChartLine1, ChartArea1, ChartLine2,
ChartArea2, ChartLine3, ChartArea3,
ChartBar1, ChartBar2, ChartBar3 )
ChartLine1, ChartArea1, ChartLine2,
ChartArea2, ChartLine3, ChartArea3,
ChartBar1, ChartBar2, ChartBar3 )
enum Type
{

View File

@ -26,17 +26,17 @@ namespace
switch( type )
{
case Diagram::Line:
row = 0;
break;
case Diagram::Line:
row = 0;
break;
case Diagram::Area:
row = 1;
break;
case Diagram::Area:
row = 1;
break;
case Diagram::Bar:
row = 2;
break;
case Diagram::Bar:
row = 2;
break;
}
return subcontrols[ row * 3 + i ];
@ -146,7 +146,8 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
if( barsNode->childCount() > k )
{
barNode = static_cast< QskBoxRectangleNode* >( barsNode->childAtIndex( k ) );
barNode = static_cast< QskBoxRectangleNode* >(
barsNode->childAtIndex( k ) );
}
else
{
@ -181,7 +182,8 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
if( chartNode->childCount() > nodeIndex )
{
dataPointNode = static_cast< DiagramDataNode* >( chartNode->childAtIndex( nodeIndex ) );
dataPointNode = static_cast< DiagramDataNode* >(
chartNode->childAtIndex( nodeIndex ) );
}
else
{
@ -202,7 +204,8 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
color = diagram->color( areaSubcontrol );
}
dataPointNode->update( rect, nodeType, color, dataPoints, yMax, false, lineWidth );
dataPointNode->update( rect, nodeType, color,
dataPoints, yMax, false, lineWidth );
}
nodeIndex++;
}

View File

@ -22,7 +22,8 @@ QSK_SUBCONTROL( LightDisplay, Knob )
QSK_STATE( LightDisplay, Pressed, ( QskAspect::FirstUserState << 1 ) )
namespace {
namespace
{
bool angleInRange( const QskArcMetrics& metrics, qreal angle )
{
return angle >= metrics.startAngle() && angle <= metrics.endAngle();
@ -123,7 +124,7 @@ void LightDisplay::mouseReleaseEvent( QMouseEvent* /*event*/ )
qreal LightDisplay::angleFromPoint( const QRectF& rect, const QPointF& point ) const
{
QPointF circlePos( point.x() - rect.center().x(),
rect.center().y() - point.y() );
rect.center().y() - point.y() );
const qreal atan = qAtan2( circlePos.y(), circlePos.x() );
const qreal angle = qRadiansToDegrees( atan );

View File

@ -15,7 +15,7 @@ class LightDisplay : public QskBoundedValueInput
public:
QSK_SUBCONTROLS( Panel, Groove, ColdAndWarmArc, Tickmarks, ValueText,
LeftLabel, RightLabel, Knob ) // ### rename knob to handle?
LeftLabel, RightLabel, Knob ) // ### rename knob to handle?
QSK_STATES( Pressed )
LightDisplay( QQuickItem* parent = nullptr );

View File

@ -39,7 +39,8 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
{
const auto textSize = textLabelsSize( display );
const auto arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing;
const qreal ticksWidth = display->arcMetricsHint(
LightDisplay::Tickmarks ).width() + ticksSpacing;
const qreal x = textSize.width() + arcMetrics.width() + ticksWidth;
const qreal w = contentsRect.width() -
@ -104,7 +105,8 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
}
else if( subControl == LightDisplay::Knob )
{
const auto arcRect = subControlRect( skinnable, contentsRect, LightDisplay::ColdAndWarmArc );
const auto arcRect = subControlRect( skinnable,
contentsRect, LightDisplay::ColdAndWarmArc );
const auto arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc );
const auto knobSize = display->strutSizeHint( LightDisplay::Knob );
@ -165,19 +167,18 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
case ValueTextRole:
{
const QString valueText = QString::number( display->value(), 'f', 0 )
+ QStringLiteral( " %" );
return updateTextNode( skinnable, node, valueText,
LightDisplay::ValueText );
+ QStringLiteral( " %" );
return updateTextNode( skinnable, node, valueText, LightDisplay::ValueText );
}
case LeftLabelRole:
{
return updateTextNode( skinnable, node, QStringLiteral( "0 " ),
LightDisplay::LeftLabel );
return updateTextNode( skinnable, node,
QStringLiteral( "0 " ), LightDisplay::LeftLabel );
}
case RightLabelRole:
{
return updateTextNode( skinnable, node, QStringLiteral( " 100" ),
LightDisplay::RightLabel );
return updateTextNode( skinnable, node,
QStringLiteral( " 100" ), LightDisplay::RightLabel );
}
case KnobRole:
{

View File

@ -199,20 +199,24 @@ void Cube::keyPressEvent( QKeyEvent* event )
switch( event->key() )
{
case Qt::Key_Up:
direction = Qsk::TopToBottom;
break;
case Qt::Key_Down:
direction = Qsk::BottomToTop;
break;
case Qt::Key_Left:
direction = Qsk::LeftToRight;
break;
case Qt::Key_Right:
direction = Qsk::RightToLeft;
break;
default:
return;
case Qt::Key_Up:
direction = Qsk::TopToBottom;
break;
case Qt::Key_Down:
direction = Qsk::BottomToTop;
break;
case Qt::Key_Left:
direction = Qsk::LeftToRight;
break;
case Qt::Key_Right:
direction = Qsk::RightToLeft;
break;
default:
return;
}
switchPosition( direction );
@ -307,7 +311,7 @@ MainItem::MainItem( QQuickItem* parent )
void MainItem::gestureEvent( QskGestureEvent* event )
{
if( event->gesture()->state() == QskGesture::Finished
&& event->gesture()->type() == QskGesture::Pan )
&& event->gesture()->type() == QskGesture::Pan )
{
const auto* panGesture = static_cast< const QskPanGesture* >( event->gesture().get() );

View File

@ -14,70 +14,72 @@ class Cube : public QskStackBox
{
Q_OBJECT
public:
enum Edge {
LeftEdge = Qsk::LeftToRight,
RightEdge = Qsk::RightToLeft,
TopEdge = Qsk::TopToBottom,
BottomEdge = Qsk::BottomToTop,
NumEdges
};
Q_ENUM( Edge )
public:
enum Edge
{
LeftEdge = Qsk::LeftToRight,
RightEdge = Qsk::RightToLeft,
TopEdge = Qsk::TopToBottom,
BottomEdge = Qsk::BottomToTop,
NumEdges
};
Q_ENUM( Edge )
enum Position {
LeftPos = LeftEdge,
RightPos = RightEdge,
TopPos = TopEdge,
BottomPos = BottomEdge,
FrontPos,
BackPos,
NumPositions
};
Q_ENUM( Position )
enum Position
{
LeftPos = LeftEdge,
RightPos = RightEdge,
TopPos = TopEdge,
BottomPos = BottomEdge,
FrontPos,
BackPos,
NumPositions
};
Q_ENUM( Position )
explicit Cube( QQuickItem* parent = nullptr );
explicit Cube( QQuickItem* parent = nullptr );
public Q_SLOTS:
void switchPosition( const Qsk::Direction direction );
void switchToPosition( const Cube::Position position );
public Q_SLOTS:
void switchPosition( const Qsk::Direction direction );
void switchToPosition( const Cube::Position position );
Q_SIGNALS:
// might be different from indexChanged:
void cubeIndexChanged( const int index );
Q_SIGNALS:
// might be different from indexChanged:
void cubeIndexChanged( const int index );
protected:
void keyPressEvent( QKeyEvent* event ) override;
protected:
void keyPressEvent( QKeyEvent* event ) override;
private:
Position currentPosition() const;
Position neighbor( const Position position, const Qsk::Direction direction ) const;
Qsk::Direction direction( const Position from, const Position to ) const;
void updateEdge( Qsk::Direction direction, Position position );
void doSwitch( Qsk::Direction direction, Position position );
private:
Position currentPosition() const;
Position neighbor( const Position position, const Qsk::Direction direction ) const;
Qsk::Direction direction( const Position from, const Position to ) const;
void updateEdge( Qsk::Direction direction, Position position );
void doSwitch( Qsk::Direction direction, Position position );
Position m_destination;
Edge m_currentEdge;
bool m_isIntermediateHop;
Position m_destination;
Edge m_currentEdge;
bool m_isIntermediateHop;
static QPair< Position, Edge > s_neighbors[ NumPositions ][ NumEdges ];
static Edge s_edgeTransformations[ NumEdges ][ NumEdges ];
static QPair< Position, Edge > s_neighbors[ NumPositions ][ NumEdges ];
static Edge s_edgeTransformations[ NumEdges ][ NumEdges ];
};
class MainItem : public QskControl
{
Q_OBJECT
public:
MainItem( QQuickItem* parent = nullptr );
public:
MainItem( QQuickItem* parent = nullptr );
protected:
bool eventFilter(QObject *obj, QEvent *event) override final;
bool gestureFilter( QQuickItem*, QEvent* ) override final;
void gestureEvent( QskGestureEvent* ) override final;
protected:
bool eventFilter(QObject* obj, QEvent* event) override final;
bool gestureFilter( QQuickItem*, QEvent* ) override final;
void gestureEvent( QskGestureEvent* ) override final;
private:
QskLinearBox* m_mainLayout;
MenuBar* m_menuBar;
Cube* m_cube;
QskPanGestureRecognizer m_panRecognizer;
private:
QskLinearBox* m_mainLayout;
MenuBar* m_menuBar;
Cube* m_cube;
QskPanGestureRecognizer m_panRecognizer;
};

View File

@ -73,7 +73,8 @@ RoomsPage::RoomsPage( QQuickItem* parent )
const QVector< qreal > livingRoomWater = { 5, 8, 13, 2, 3, 9, 11 };
const QVector< qreal > livingRoomElectricity = { 1, 8, 7, 4, 12, 6, 5 };
const QVector< qreal > livingRoomGas = { 10, 11, 5, 8, 3, 1, 7 };
auto livingRoomDiagram = new RoomsDiagram( livingRoomWater, livingRoomElectricity, livingRoomGas );
auto livingRoomDiagram = new RoomsDiagram(
livingRoomWater, livingRoomElectricity, livingRoomGas );
gridBox->addItem( new UsageDiagramBox( "Living Room", livingRoomDiagram ), 0, 0 );
const QVector< qreal > bedroomWater = { 8, 6, 11, 2, 5, 4, 9 };

View File

@ -15,7 +15,8 @@ class RoundedIcon : public QskPushButton
QSK_SUBCONTROLS( Panel, PalePanel, Graphic )
QSK_STATES( Bright ) // to differentiate between orange and purple
enum {
enum
{
NormalRole,
CheckedRole,
} GraphicRole;

View File

@ -288,9 +288,9 @@ void Skin::initHints( const Palette& palette )
// storage bar
{
const auto make_gradient = []( const QColor color ) -> QskGradient {
return { color.lighter(), color };
};
const auto make_gradient = []( const QColor color ) -> QskGradient
{ return { color.lighter(), color }; };
ed.setGradient( StorageBar::Pictures, make_gradient( "#FFBE0B" ) );
ed.setGradient( StorageBar::Music, make_gradient( "#FB5607" ) );
ed.setGradient( StorageBar::Videos, make_gradient( "#FF006E" ) );

View File

@ -43,9 +43,9 @@ class StorageBar final : public QskControl
void othersChanged( qreal value );
private:
qreal m_pictures{ 0.0 };
qreal m_music{ 0.0 };
qreal m_videos{ 0.0 };
qreal m_documents{ 0.0 };
qreal m_others{ 0.0 };
qreal m_pictures = 0.0;
qreal m_music = 0.0;
qreal m_videos = 0.0;
qreal m_documents = 0.0;
qreal m_others = 0.0;
};

View File

@ -140,7 +140,8 @@ void UsageDiagram::addCurve( const qreal values[], const size_t count )
addDataPoints( points, Diagram::Area );
}
UsageDiagramBox::UsageDiagramBox(const QString &title, Diagram *diagram, QQuickItem* parent )
UsageDiagramBox::UsageDiagramBox(
const QString& title, Diagram* diagram, QQuickItem* parent )
: Box( title, parent )
{
diagram->setParent( this );

View File

@ -48,11 +48,11 @@ class SliderBox : public QskLinearBox
{
auto slider = new OtherSlider( this );
slider->setMinimum( 0 );
slider->setMaximum( 10 );
slider->setStepSize( 1 );
}
}
{
auto slider = new CustomSlider( this );

View File

@ -24,7 +24,7 @@ namespace
{
public:
Window()
{
{
setAutoLayoutChildren( true );
const QImage image( QStringLiteral( ":/images/background.jpg" ) );

View File

@ -75,7 +75,8 @@ void GridQuick::insert( const QByteArray& colorName,
We need to create a temporary layout in QML, so that the
object for the attachedProperties is created early
*/
auto layout = createQml( "import QtQuick 2.0\nimport QtQuick.Layouts 1.15\nGridLayout { Rectangle {} }" );
auto layout = createQml(
"import QtQuick 2.0\nimport QtQuick.Layouts 1.15\nGridLayout { Rectangle {} }" );
auto rectangle = layout->childItems().constFirst();
rectangle->setParent( nullptr );

View File

@ -122,7 +122,7 @@ class GridBox : public QskGridBox
addItem( label, row, 2 );
connect( slider, &QskSlider::valueChanged,
label, [label]( qreal value ) { label->setText( QString::number( value ) ); } );
label, [label]( qreal value ) { label->setText( QString::number( value ) ); } );
}
};

View File

@ -18,9 +18,9 @@ class QskSetupFlagsQml : public QskQuickItem::UpdateFlags
Q_GADGET
public:
template< typename... Args >
template< typename ... Args >
QskSetupFlagsQml( Args&&... args )
: QskQuickItem::UpdateFlags( std::forward< Args >( args )... )
: QskQuickItem::UpdateFlags( std::forward< Args >( args ) ... )
{
}

View File

@ -130,8 +130,7 @@ Qt::ShortcutContext QskShortcutQml::context() const
void QskShortcutQml::setContext( Qt::ShortcutContext context )
{
if ( context == Qt::ApplicationShortcut ||
context == Qt::WindowShortcut )
if ( context == Qt::ApplicationShortcut || context == Qt::WindowShortcut )
{
const bool isWindowContext = ( context == Qt::WindowShortcut );

View File

@ -474,18 +474,18 @@ void Editor::setupRadioBox()
using A = QskAspect;
setAnimation( Q::Ripple | A::Metric | A::Position, qskDuration );
setSpacing( Q::Panel, 10_dp );
setStrutSize( Q::Button, { 20_dp, 20_dp } );
setStrutSize( Q::Symbol, { 10_dp, 10_dp } );
setStrutSize( Q::Ripple, { 40_dp, 40_dp } );
setAlignment( Q::Symbol, Qt::AlignCenter );
setAlignment( Q::Text, Qt::AlignBottom );
setMargin( Q::Text, QskMargins( 10_dp, 0, 10_dp, 0 ) );
setBoxShape( Q::Button, 20_dp );
setBoxShape( Q::Ripple, 40_dp );
setBoxBorderMetrics( Q::Button, 2_dp );
@ -496,7 +496,7 @@ void Editor::setupRadioBox()
// Selected
setColor( Q::Ripple | Q::Selected,
stateLayerColor( m_pal.primary, m_pal.focusOpacity ) );
stateLayerColor( m_pal.primary, m_pal.focusOpacity ) );
setBoxBorderColors( Q::Button | Q::Selected, m_pal.primary );
// Disabled
@ -680,13 +680,16 @@ void Editor::setupPushButton()
setGradient( Q::Panel | M3::Elevated | Q::Disabled, m_pal.onSurface12 );
setShadowMetrics( Q::Panel | M3::Elevated | Q::Disabled, m_pal.elevation0 );
setColor( Q::Text | M3::Elevated | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Elevated | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Graphic | M3::Elevated | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
const auto elevatedHoverColor = flattenedColor( m_pal.primary, m_pal.surface, m_pal.hoverOpacity );
const auto elevatedHoverColor =
flattenedColor( m_pal.primary, m_pal.surface, m_pal.hoverOpacity );
setGradient( Q::Panel | M3::Elevated | Q::Hovered, elevatedHoverColor );
setShadowMetrics( Q::Panel | M3::Elevated | Q::Hovered, m_pal.elevation2 );
const auto elevatedPressedColor = flattenedColor( m_pal.primary, m_pal.surface, m_pal.pressedOpacity );
const auto elevatedPressedColor =
flattenedColor( m_pal.primary, m_pal.surface, m_pal.pressedOpacity );
setGradient( Q::Panel | M3::Elevated | Q::Focused, elevatedPressedColor );
setShadowMetrics( Q::Panel | M3::Elevated | Q::Focused, m_pal.elevation1 );
@ -724,17 +727,21 @@ void Editor::setupPushButton()
setShadowMetrics( Q::Panel | M3::Tonal, m_pal.elevation0 );
setColor( Q::Text | M3::Tonal, m_pal.onSecondaryContainer );
setGraphicRole( Q::Graphic | M3::Tonal, QskMaterial3Skin::GraphicRoleOnSecondaryContainer );
setGradient( Q::Ripple | M3::Tonal, stateLayerColor( m_pal.onSecondaryContainer, m_pal.pressedOpacity ) );
setGradient( Q::Ripple | M3::Tonal,
stateLayerColor( m_pal.onSecondaryContainer, m_pal.pressedOpacity ) );
setGradient( Q::Panel | M3::Tonal | Q::Disabled, m_pal.onSurface12 );
setColor( Q::Text | M3::Tonal | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Tonal | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Graphic | M3::Tonal | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
const auto tonalHoverColor = flattenedColor( m_pal.onSecondaryContainer, m_pal.secondaryContainer, m_pal.hoverOpacity );
const auto tonalHoverColor = flattenedColor( m_pal.onSecondaryContainer,
m_pal.secondaryContainer, m_pal.hoverOpacity );
setGradient( Q::Panel | M3::Tonal | Q::Hovered, tonalHoverColor );
setShadowMetrics( Q::Panel | M3::Tonal | Q::Hovered, m_pal.elevation1 );
const auto tonalPressedColor = flattenedColor( m_pal.onSecondaryContainer, m_pal.secondaryContainer, m_pal.pressedOpacity );
const auto tonalPressedColor = flattenedColor( m_pal.onSecondaryContainer,
m_pal.secondaryContainer, m_pal.pressedOpacity );
setGradient( Q::Panel | M3::Tonal | Q::Focused, tonalPressedColor );
setShadowMetrics( Q::Panel | M3::Tonal | Q::Focused, m_pal.elevation0 );
@ -754,7 +761,8 @@ void Editor::setupPushButton()
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Disabled, m_pal.onSurface12 );
setColor( Q::Text | M3::Outlined | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Outlined | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Graphic | M3::Outlined | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Hovered, m_pal.outline );
setGradient( Q::Panel | M3::Outlined | Q::Hovered, m_pal.primary8 );

View File

@ -621,10 +621,10 @@ void Editor::setupRadioBox()
using Q = QskRadioBox;
setSpacing(Q::Panel, qskDpiScaled( 10 ) );
setStrutSize( Q::Button, { qskDpiScaled( 20 ), qskDpiScaled( 20 ) } );
setStrutSize( Q::Symbol, { qskDpiScaled( 9 ), qskDpiScaled( 9 ) }) ;
setStrutSize( Q::Symbol, { qskDpiScaled( 9 ), qskDpiScaled( 9 ) });
setBoxShape( Q::Button, qskDpiScaled( 20 ) );
setBoxShape( Q::Ripple, qskDpiScaled( 40 ) );
setBoxBorderMetrics( Q::Button, qskDpiScaled( 1 ) );
@ -638,12 +638,12 @@ void Editor::setupRadioBox()
setColor( Q::Panel | Q::Disabled, m_pal.lighter125 );
setColor( Q::Button | Q::Disabled, m_pal.lighter110 );
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
setColor( Q::Symbol | Q::Disabled, m_pal.darker200 );
setMargin( Q::Text, QskMargins( qskDpiScaled( 10 ), 0, qskDpiScaled( 10 ), 0 ));
setMargin( Q::Text, QskMargins( qskDpiScaled( 10 ), 0, qskDpiScaled( 10 ), 0 ) );
setAlignment( Q::Symbol, Qt::AlignCenter );
setAlignment( Q::Text, Qt::AlignBottom );
@ -1046,7 +1046,7 @@ void Editor::setupSpinBox()
setBoxShape( subControl, 0 );
const auto downState = ( subControl == Q::UpPanel )
? Q::Increasing : Q::Decreasing;
? Q::Increasing : Q::Decreasing;
setButton( subControl | downState, Sunken, 1.0 );

View File

@ -77,7 +77,7 @@ class QSK_EXPORT QskBoxBorderMetrics
constexpr bool isEquidistant() const noexcept;
QRectF adjustedRect( const QRectF& )const ;
QRectF adjustedRect( const QRectF& ) const;
private:
QskMargins m_widths;

View File

@ -38,7 +38,7 @@ class QSK_EXPORT QskBoxShapeMetrics
Symmetric or Proportional shrink the larger radius, while SymmetricByMaximum
expands the smaller radius to achieve the desired aspect ratio.
The effect of the scaling on the implemented box rendering is:
The effect of the scaling on the implemented box rendering is:
- SymmetricByMaximum in combination with a relative radius of 100
results in an ellipse.

View File

@ -65,7 +65,7 @@ static inline QTransform qskTransformForRect( int, const QRectF& rect )
return QTransform( w, 0, 0, h, x, y );
}
QskGradient::QskGradient( const QColor& color )
: QskGradient()
{
@ -751,7 +751,7 @@ QGradient QskGradient::toQGradient() const
}
}
g.setCoordinateMode( m_stretchMode == NoStretch
g.setCoordinateMode( m_stretchMode == NoStretch
? QGradient::LogicalMode : QGradient::ObjectMode );
g.setSpread( static_cast< QGradient::Spread >( m_spreadMode ) );

View File

@ -131,7 +131,7 @@ void QskLinearDirection::setInterval( Qt::Orientation orientation, qreal from, q
void QskLinearDirection::precalculate() const noexcept
{
m_dx = m_x2 - m_x1;
m_dy = m_y2 - m_y1;
m_dy = m_y2 - m_y1;
m_dot = m_dx * m_dx + m_dy * m_dy;
}

View File

@ -74,7 +74,7 @@ class QSK_EXPORT QskLinearDirection
/*
In direction of the gradient vector, where 0.0 corresponds to
points on the perpendicular at the start and 1.0 to points on
the perpendicular of the end point.
the perpendicular of the end point.
Also corresponds to the positions of the color stops and can be
used to calculate the color at a specific position.

View File

@ -403,7 +403,7 @@ QGradientStops qskToQGradientStops( const QskGradientStops& stops )
for ( const auto& stop : stops )
{
QPair<qreal, QColor> qStop = { stop.position(), stop.color() };
QPair< qreal, QColor > qStop = { stop.position(), stop.color() };
if ( !qStops.isEmpty() && qStops.last().first == qStop.first )
{

View File

@ -38,11 +38,8 @@ QVariant QskTextColors::interpolate(
static inline void qskDebugColor( QDebug debug, const QColor& c )
{
debug << '('
<< c.red() << ','
<< c.green() << ','
<< c.blue() << ','
<< c.alpha() << ')';
debug << '(' << c.red() << ',' << c.green() << ','
<< c.blue() << ',' << c.alpha() << ')';
}
QDebug operator<<( QDebug debug, const QskTextColors& colors )

View File

@ -13,7 +13,7 @@
QSK_SYSTEM_STATE( QskAbstractButton, Checked, QskAspect::LastSystemState >> 3 )
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )
static QskAbstractButton* qskCheckedSibling( const QskAbstractButton* button )
static QskAbstractButton* qskCheckedSibling( const QskAbstractButton * button )
{
const auto parentItem = button->parentItem();
if ( parentItem == nullptr )

View File

@ -55,11 +55,8 @@ QskComboBox::QskComboBox( QQuickItem* parent )
connect( this, &QskComboBox::currentIndexChanged,
this, &QskControl::focusIndicatorRectChanged );
connect( m_data->menu, &QskMenu::closed, this, [ this ]()
{
setPopupOpen( false );
setFocus( true );
} );
connect( m_data->menu, &QskMenu::closed, this,
[ this ]() { setPopupOpen( false ); setFocus( true ); } );
connect( this, &QskComboBox::pressed, this, &QskComboBox::togglePopup );
}

View File

@ -52,7 +52,8 @@ QskControl::~QskControl()
if( this == w->mouseGrabberItem() )
{
// to catch suicide situations as a result of mouse clicks
qWarning() << "QskControl::~QskControl: probably suicide situation detected, control is the mouse grabber item" << this;
qWarning() << "QskControl::~QskControl: probably suicide situation detected, "
"control is the mouse grabber item" << this;
}
}

View File

@ -23,11 +23,11 @@ class QWheelEvent;
class QHoverEvent;
class QKeyEvent;
#define QSK_EVENT_DISABLE_COPY(Class) \
Class(const Class &) = default; \
Class(Class &&) = delete; \
Class &operator=(const Class &other) = default; \
Class &operator=(Class &&) = delete;
#define QSK_EVENT_DISABLE_COPY( Class ) \
Class( const Class& ) = default; \
Class( Class && ) = delete; \
Class& operator=( const Class & ) = default; \
Class& operator=( Class && ) = delete;
class QSK_EXPORT QskEvent : public QEvent
{

View File

@ -134,7 +134,7 @@ QSGNode* QskProgressBarSkinlet::updateBarNode(
definition for the 100% situation and have to adjust
the stops for smaller bars.
For this situation it would be more convenient to
For this situation it would be more convenient to
adjust the start/stop positions, but the box renderer is
not supporting this yet. TODO ...
*/

View File

@ -48,7 +48,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
QSK_SUBCONTROLS( Panel, Ripple, Text, Graphic )
enum Emphasis
{
{
VeryLowEmphasis = -2,
LowEmphasis = -1,
NoEmphasis = 0,

View File

@ -42,7 +42,7 @@ namespace
const auto textOptions = button->textOptions();
if ( ( textOptions.elideMode() == Qt::ElideNone )
&& ( textOptions.wrapMode() == QskTextOptions::NoWrap ) )
&& ( textOptions.wrapMode() == QskTextOptions::NoWrap ) )
{
const auto alignment = button->alignmentHint(
QskPushButton::Panel, Qt::AlignCenter );

View File

@ -37,9 +37,7 @@ QskRadioBox::QskRadioBox( QQuickItem* parent )
connect(this, &QskRadioBox::itemsChanged, this,
[this]( const QStringList& items )
{
setFocusPolicy( items.count() > 0 ? Qt::StrongFocus : Qt::NoFocus );
}
{ setFocusPolicy( items.count() > 0 ? Qt::StrongFocus : Qt::NoFocus ); }
);
setFocusedIndex( -1 );

View File

@ -59,16 +59,18 @@ namespace
LayoutEngine( const QskSegmentedBar* bar, int index )
: QskSubcontrolLayoutEngine( bar->orientation() )
{
setSpacing( bar->spacingHint( QskSegmentedBar::Panel ) );
using Q = QskSegmentedBar;
setSpacing( bar->spacingHint( Q::Panel ) );
setGraphicTextElements( bar,
QskSegmentedBar::Text, qskValueAt< QString >( bar, index ),
QskSegmentedBar::Graphic, graphicAt( bar, index ).defaultSize() );
Q::Text, qskValueAt< QString >( bar, index ),
Q::Graphic, graphicAt( bar, index ).defaultSize() );
if( bar->orientation() == Qt::Horizontal )
{
const auto alignment = bar->alignmentHint( QskSegmentedBar::Panel, Qt::AlignCenter );
setFixedContent( QskSegmentedBar::Text, Qt::Horizontal, alignment );
const auto alignment = bar->alignmentHint( Q::Panel, Qt::AlignCenter );
setFixedContent( Q::Text, Qt::Horizontal, alignment );
}
}
};
@ -151,7 +153,7 @@ QRectF QskSegmentedBarSkinlet::segmentRect(
{
const qreal h = rect.height() / count;
rect.setTop( index * h );
rect.setTop( index * h );
rect.setHeight( h );
}
@ -218,7 +220,8 @@ QSGNode* QskSegmentedBarSkinlet::updateSubNode(
return nullptr;
}
QSizeF QskSegmentedBarSkinlet::segmentSizeHint( const QskSegmentedBar* bar, Qt::SizeHint which ) const
QSizeF QskSegmentedBarSkinlet::segmentSizeHint(
const QskSegmentedBar* bar, Qt::SizeHint which ) const
{
using Q = QskSegmentedBar;
@ -228,13 +231,14 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint( const QskSegmentedBar* bar, Qt::
{
LayoutEngine layoutEngine( bar, i );
const auto graphic = bar->effectiveSkin()->symbol( QskStandardSymbol::SegmentedBarCheckMark );
const auto graphic = bar->effectiveSkin()->symbol(
QskStandardSymbol::SegmentedBarCheckMark );
// We want to know how big the element can grow when it is selected,
// i.e. when it has the checkmark symbol:
layoutEngine.setGraphicTextElements( bar,
QskSegmentedBar::Text, qskValueAt< QString >( bar, i ),
QskSegmentedBar::Graphic, graphic.defaultSize() );
Q::Text, qskValueAt< QString >( bar, i ),
Q::Graphic, graphic.defaultSize() );
const auto size = layoutEngine.sizeHint( which, QSizeF() );

View File

@ -245,7 +245,7 @@ void QskSkinHintTableEditor::setGradient(
QskStateCombination combination )
{
const QskGradient gradient( color1, color2 );
setColorHint( aspect, gradient , combination );
setColorHint( aspect, gradient, combination );
}
void QskSkinHintTableEditor::setGradient(

View File

@ -193,7 +193,7 @@ void QskSpinBox::setWrapping( bool on )
{
if ( on != m_data->wrapping )
{
m_data->wrapping = on;
m_data->wrapping = on;
Q_EMIT wrappingChanged( on );
}
}

View File

@ -49,8 +49,8 @@ class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
Q_ENUM( Decoration )
QskSpinBox( QQuickItem* parent = nullptr );
QskSpinBox( qreal min, qreal max, qreal stepSize,
QQuickItem* parent = nullptr );
QskSpinBox( qreal min, qreal max,
qreal stepSize, QQuickItem* parent = nullptr );
~QskSpinBox() override;

View File

@ -186,7 +186,7 @@ QSizeF QskSpinBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
hint.setWidth( std::max( w1, w2 ) );
hint.setHeight( fm.height() );
hint = hint.grownBy( spinBox->paddingHint( Q::TextPanel ) );
hint = hint.expandedTo( spinBox->strutSizeHint( Q::TextPanel ) );
}
@ -215,10 +215,10 @@ QSizeF QskSpinBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
}
else
{
if ( hintDown.width() > 0.0 )
if ( hintDown.width() > 0.0 )
hint.rwidth() += hintDown.width() + spacing;
if ( hintUp.width() > 0.0 )
if ( hintUp.width() > 0.0 )
hint.rwidth() += hintUp.width() + spacing;
const auto h = std::max( hintUp.height(), hintDown.height() );

View File

@ -21,7 +21,7 @@ class QSK_EXPORT QskSpinBoxSkinlet : public QskSkinlet
TextPanel,
Text,
UpPanel,
UpPanel,
UpIndicator,
DownPanel,

View File

@ -269,8 +269,8 @@ QskGraphic QskStandardSymbol::graphic( Type symbolType )
case QskStandardSymbol::SegmentedBarCheckMark:
{
qskCheckMarkGraphic( &painter );
break;
}
break;
}
case QskStandardSymbol::Bullet:
{
qskBulletGraphic( &painter );

View File

@ -619,7 +619,7 @@ QTransform QskStackBoxAnimator4::transformation(
transform.translate( dx, dy );
transform.rotateRadians( radians - M_PI_2, Qt::YAxis );
transform.translate( 0.0, -dy );
}
}
}
else
{

View File

@ -408,7 +408,8 @@ void QskSubcontrolLayoutEngine::setGraphicTextElements( const QskSkinnable* skin
}
}
void QskSubcontrolLayoutEngine::setFixedContent( QskAspect::Subcontrol subcontrol, Qt::Orientation orientation, Qt::Alignment alignment )
void QskSubcontrolLayoutEngine::setFixedContent(
QskAspect::Subcontrol subcontrol, Qt::Orientation orientation, Qt::Alignment alignment )
{
if( auto* e = element( subcontrol ) )
{
@ -419,38 +420,38 @@ void QskSubcontrolLayoutEngine::setFixedContent( QskAspect::Subcontrol subcontro
switch( orientation )
{
case Qt::Horizontal:
extraSpacing |= ( extraSpacingAt() & ( Qt::TopEdge | Qt::BottomEdge ) );
case Qt::Horizontal:
extraSpacing |= ( extraSpacingAt() & ( Qt::TopEdge | Qt::BottomEdge ) );
if( alignment & Qt::AlignLeft )
{
extraSpacing |= Qt::RightEdge;
}
else if( alignment & Qt::AlignRight )
{
extraSpacing |= Qt::LeftEdge;
}
else if( alignment & Qt::AlignHCenter )
{
extraSpacing |= Qt::LeftEdge | Qt::RightEdge;
}
break;
case Qt::Vertical:
extraSpacing |= ( extraSpacingAt() & ( Qt::LeftEdge | Qt::RightEdge ) );
if( alignment & Qt::AlignLeft )
{
extraSpacing |= Qt::RightEdge;
}
else if( alignment & Qt::AlignRight )
{
extraSpacing |= Qt::LeftEdge;
}
else if( alignment & Qt::AlignHCenter )
{
extraSpacing |= Qt::LeftEdge | Qt::RightEdge;
}
break;
case Qt::Vertical:
extraSpacing |= ( extraSpacingAt() & ( Qt::LeftEdge | Qt::RightEdge ) );
if( alignment & Qt::AlignTop )
{
extraSpacing |= Qt::BottomEdge;
}
else if( alignment & Qt::AlignBottom )
{
extraSpacing |= Qt::TopEdge;
}
else if( alignment & Qt::AlignVCenter )
{
extraSpacing |= Qt::TopEdge | Qt::BottomEdge;
}
break;
if( alignment & Qt::AlignTop )
{
extraSpacing |= Qt::BottomEdge;
}
else if( alignment & Qt::AlignBottom )
{
extraSpacing |= Qt::TopEdge;
}
else if( alignment & Qt::AlignVCenter )
{
extraSpacing |= Qt::TopEdge | Qt::BottomEdge;
}
break;
}
setExtraSpacingAt( extraSpacing );

View File

@ -153,32 +153,32 @@ void Skinny::changeSkin( QskAnimationHint hint )
}
void Skinny::changeFonts( int increment )
{
{
auto skin = qskSetup->skin();
const auto fonts = skin->fonts();
for ( auto it = fonts.begin(); it != fonts.end(); ++it )
{
{
auto role = it->first;
auto font = it->second;
if ( font.pixelSize() > 0 )
{
{
const auto newSize = font.pixelSize() + increment;
if ( newSize > 0 )
font.setPixelSize( newSize );
}
else
{
{
const auto newSize = font.pointSizeF() + increment;
if ( newSize > 0 )
font.setPointSizeF( font.pointSizeF() + increment );
}
skin->setFont( role, font );
}
Q_EMIT qskSetup->skinChanged( skin );
}

View File

@ -154,7 +154,7 @@ QPainterPath SkinnyShapeFactory::shapePath( Shape shape, const QSizeF& size )
{
path.arcMoveTo( rect, -60 );
path.arcTo( rect, -60, 300 );
const double w = 0.25 * rect.width();
const auto r = rect.adjusted( w, w, -w, -w );
@ -164,7 +164,7 @@ QPainterPath SkinnyShapeFactory::shapePath( Shape shape, const QSizeF& size )
innerPath.arcTo( r, 240, -300 );
path.connectPath( innerPath );
break;
}