Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/uwerat/qskinny
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Jan 8, 2024
2 parents d1fbfd4 + 81cecb6 commit 79f91a5
Show file tree
Hide file tree
Showing 48 changed files with 1,520 additions and 270 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [uwerat]
3 changes: 2 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ jobs:
cc: "gcc",
cxx: "g++",
archiver: "7z a",
generators: "Ninja Multi-Config",
# generators: "Ninja Multi-Config",
generators: "Ninja",
env: { DISPLAY: ":1" },
cmake:
{
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ But so far only Linux is actively tested.
It might support all versions Qt >= 5.15, but you can rely on:

- Qt 5.15
- current long term supported ( LTS ) version of Qt
- current long term supported ( LTS ) version of Qt ( at the moment Qt 6.5.x )
- current version of Qt

On debian bullseye these packages need to be installed: `build-essential
qt-qmake qtbase5-dev qtbase5-private-dev qtdeclarative5-dev
qtdeclarative5-private-dev libqt5svg5-dev`.
On Debian these packages need to be installed for Qt6: `build-essential cmake
qtbase6-dev qtbase6-private-dev qtdeclarative6-dev qtdeclarative6-private-dev libqt6svg-dev qt6-shadertools`
For Qt5 you need: `build-essential cmake
qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtdeclarative5-private-dev libqt5svg-dev`.


> Optional: When enabling the `hunspell` feature the following package needs to be installed: `libhunspell-dev`
Expand Down
18 changes: 13 additions & 5 deletions cmake/QskFindMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@

macro(qsk_setup_Qt)

# Often users have several Qt installations on their system and
# need to be able to explicitly the one to be used. Let's see if
# standard cmake features are good enough or if we need to introduce
# something sort of additional option. TODO ...
# Use QSK_QT_VERSION specified with baseline 5.15
# otherwise fallback to latest known supported Qt version gte 5.15
# set vars for correct alpha descending sort order and direction (ex. Qt6, Qt5)
if ( NOT QSK_QT_VERSION ) # QSK_QT_VERSION=Qt5
set(QSK_QT_VERSION Qt6 Qt5)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
endif()
find_package(QT "5.15" NAMES ${QSK_QT_VERSION} REQUIRED COMPONENTS Quick)

find_package(QT "5.15" NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick)
if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6)
# we need the qsb tool for Qt6
find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
endif()

if ( QT_FOUND )

Expand Down
109 changes: 109 additions & 0 deletions playground/shadows/ArcPage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/

#include "ArcPage.h"
#include "ShadowedArc.h"
#include "Slider.h"

#include <QskGridBox.h>

namespace
{
class ControlPanel : public QskGridBox
{
Q_OBJECT

public:
ControlPanel( ShadowedArc* arc, QQuickItem* parent = nullptr )
: QskGridBox( parent )
{
setMargins( 5 );
setSpacing( 10 );

{
auto slider = new Slider( "Start", 0, 360, 10, arc->startAngle() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setStartAngle );

addItem( slider, 0, 0 );
}
{
auto slider = new Slider( "Span", -360, 360, 10, arc->spanAngle() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setSpanAngle );

addItem( slider, 0, 1 );
}
{
auto slider = new Slider( "Extent", 0, 100, 1, arc->thickness() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setThickness );

addItem( slider, 1, 0 );
}
{
auto slider = new Slider( "Border", 0, 10, 1, arc->borderWidth() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setBorderWidth );

addItem( slider, 1, 1);
}
{
auto slider = new Slider( "Spread Radius", -10, 50, 1, arc->spreadRadius() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setSpreadRadius );

addItem( slider, 2, 0 );
}
{
auto slider = new Slider( "Blur Radius", 0, 50, 1, arc->blurRadius() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setBlurRadius );

addItem( slider, 2, 1 );
}
{
auto slider = new Slider( "Offset X", -50, 50, 1, arc->offsetX() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setOffsetX );

addItem( slider, 3, 0 );

}
{
auto slider = new Slider( "Offset Y", -50, 50, 1, arc->offsetY() );
connect( slider, &Slider::valueChanged, arc, &ShadowedArc::setOffsetY );

addItem( slider, 3, 1 );
}
}
};
}

ArcPage::ArcPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
auto arc = new ShadowedArc();
arc->setMargins( 40 ); // some extra space for testing the offsets

{
// initial settings
arc->setStartAngle( 45.0 );
arc->setSpanAngle( 270.0 );
arc->setThickness( 10.0 );

arc->setFillColor( Qt::darkRed );

arc->setBorderWidth( 0 );
arc->setBorderColor( Qt::darkYellow );

arc->setShadowColor( Qt::black );
arc->setSpreadRadius( 0.0 );
arc->setBlurRadius( 4.0 );
arc->setOffsetX( 2.0 );
arc->setOffsetY( 2.0 );
}

auto panel = new ControlPanel( arc );
panel->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );

addItem( panel );
addItem( arc );
}

#include "ArcPage.moc"
14 changes: 14 additions & 0 deletions playground/shadows/ArcPage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/

#pragma once

#include <QskLinearBox.h>

class ArcPage : public QskLinearBox
{
public:
ArcPage( QQuickItem* parent = nullptr );
};
73 changes: 73 additions & 0 deletions playground/shadows/BoxPage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/

#include "BoxPage.h"
#include "ShadowedBox.h"
#include "Slider.h"

#include <QskRgbValue.h>
#include <QFontMetrics>

namespace
{
class ControlPanel : public QskLinearBox
{
public:
ControlPanel( ShadowedBox* box, QQuickItem* parent = nullptr )
: QskLinearBox( Qt::Vertical, parent )
{
{
auto slider = new Slider( "Offset X", -50, 50, 1, box->offsetX() );
connect( slider, &Slider::valueChanged, box, &ShadowedBox::setOffsetX );

addItem( slider );
}
{
auto slider = new Slider( "Offset Y", -50, 50, 1, box->offsetY() );
connect( slider, &Slider::valueChanged, box, &ShadowedBox::setOffsetY );

addItem( slider );
}
{
auto slider = new Slider( "Spread Radius", -10, 50, 1, box->spreadRadius() );
connect( slider, &Slider::valueChanged, box, &ShadowedBox::setSpreadRadius );

addItem( slider );
}
{
auto slider = new Slider( "Blur Radius", 0, 50, 1, box->blurRadius() );
connect( slider, &Slider::valueChanged, box, &ShadowedBox::setBlurRadius );

addItem( slider );
}
{
auto slider = new Slider( "Opacity", 0, 1, 0.01, box->opacity() );
connect( slider, &Slider::valueChanged, box, &ShadowedBox::setOpacity );

addItem( slider );
}
}
};
}

BoxPage::BoxPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
auto box = new ShadowedBox();
box->setMargins( 40 ); // some extra space for testing the offsets

{
box->setOffsetX( 10 );
box->setOffsetY( 10 );
box->setSpreadRadius( 0 );
box->setBlurRadius( 5 );
}

auto panel = new ControlPanel( box );
panel->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );

addItem( panel );
addItem( box );
}
19 changes: 19 additions & 0 deletions playground/shadows/BoxPage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/

#pragma once

#include <QskLinearBox.h>

class QskSlider;

class BoxPage : public QskLinearBox
{
public:
BoxPage( QQuickItem* parent = nullptr );

private:
void addSlider( int row, const QString&, QskSlider* );
};
5 changes: 4 additions & 1 deletion playground/shadows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause
############################################################################

qsk_add_example(shadows ShadowedBox.h ShadowedBox.cpp main.cpp)
qsk_add_example(shadows
BoxPage.h BoxPage.cpp ShadowedBox.h ShadowedBox.cpp
ArcPage.h ArcPage.cpp ShadowedArc.h ShadowedArc.cpp
Slider.h Slider.cpp main.cpp)
Loading

0 comments on commit 79f91a5

Please sign in to comment.