playing with clang-format
This commit is contained in:
parent
68bc2f032c
commit
0a92cb82db
|
|
@ -0,0 +1,116 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
#AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Delimiter: pb
|
||||
Language: TextProto
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: true
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: true
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: true
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
|
|
@ -8,9 +8,9 @@ QSK_SUBCONTROL( ButtonBar, Indicator )
|
|||
|
||||
class IndicatorLabel final : public QskGraphicLabel
|
||||
{
|
||||
public:
|
||||
IndicatorLabel( QQuickItem* parentItem = nullptr ):
|
||||
QskGraphicLabel( parentItem )
|
||||
public:
|
||||
IndicatorLabel( QQuickItem* parentItem = nullptr )
|
||||
: QskGraphicLabel( parentItem )
|
||||
{
|
||||
// so the skins are able to colorize them
|
||||
setGraphicRole( SkinFactory::Indicator );
|
||||
|
|
@ -28,8 +28,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
ButtonBar::ButtonBar( QQuickItem* parentItem ):
|
||||
QskLinearBox( parentItem )
|
||||
ButtonBar::ButtonBar( QQuickItem* parentItem )
|
||||
: QskLinearBox( parentItem )
|
||||
{
|
||||
QColor c( Qt::black );
|
||||
c.setAlphaF( 0.5 );
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
class ButtonBar : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
QSK_SUBCONTROLS( Indicator )
|
||||
|
||||
ButtonBar( QQuickItem* = nullptr );
|
||||
void addIndicator( const char* name );
|
||||
|
||||
protected:
|
||||
protected:
|
||||
QSizeF contentsSizeHint() const override;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
#include "DefaultSkin.h"
|
||||
|
||||
#include "ButtonBar.h"
|
||||
#include "SkinFactory.h"
|
||||
#include "SoundControl.h"
|
||||
#include "ButtonBar.h"
|
||||
|
||||
#include "Speedometer.h"
|
||||
#include "SpeedometerSkinlet.h"
|
||||
|
||||
#include <QskBox.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSkinTransition.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class Transition final : public QskSkinTransition
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
void updateSkin( QskSkin*, QskSkin* newSkin ) override
|
||||
{
|
||||
DefaultSkin* skin = static_cast< DefaultSkin* >( newSkin );
|
||||
|
|
@ -33,8 +33,7 @@ protected:
|
|||
|
||||
class Palette
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
Palette( DefaultSkin::Scheme scheme = DefaultSkin::Daylight )
|
||||
{
|
||||
if ( scheme == DefaultSkin::Daylight )
|
||||
|
|
@ -62,11 +61,10 @@ public:
|
|||
QColor color3;
|
||||
QColor color4;
|
||||
QColor color5;
|
||||
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
namespace
|
||||
{
|
||||
static inline QFont qskFont( qreal pointSize )
|
||||
{
|
||||
QFont font( "Roboto" );
|
||||
|
|
@ -76,11 +74,11 @@ namespace {
|
|||
|
||||
} // namespace
|
||||
|
||||
DefaultSkin::DefaultSkin( const QString& name, QObject* parent ):
|
||||
QskSkin( parent ),
|
||||
m_name( name ),
|
||||
m_palette( new Palette ),
|
||||
m_scheme( Daylight )
|
||||
DefaultSkin::DefaultSkin( const QString& name, QObject* parent )
|
||||
: QskSkin( parent )
|
||||
, m_name( name )
|
||||
, m_palette( new Palette )
|
||||
, m_scheme( Daylight )
|
||||
{
|
||||
setObjectName( "DefaultSkin" );
|
||||
declareSkinlet< Speedometer, SpeedometerSkinlet >();
|
||||
|
|
@ -155,9 +153,9 @@ void DefaultSkin::initHints()
|
|||
|
||||
setBoxBorderMetrics( Speedometer::NeedleHead, 2 );
|
||||
setMetric( Speedometer::NeedleHead | QskAspect::Size, 15 );
|
||||
setGradient( Speedometer::NeedleHead, QskGradient( QskGradient::Diagonal,
|
||||
m_palette->color2, m_palette->color1 ) );
|
||||
// setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );
|
||||
setGradient( Speedometer::NeedleHead,
|
||||
QskGradient( QskGradient::Diagonal, m_palette->color2, m_palette->color1 ) );
|
||||
// setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );
|
||||
|
||||
setMetric( Speedometer::Needle | QskAspect::MinimumWidth, 2 );
|
||||
setMetric( Speedometer::Needle | QskAspect::Margin, 10 );
|
||||
|
|
@ -170,7 +168,6 @@ void DefaultSkin::initHints()
|
|||
setColor( Speedometer::Labels, m_palette->color4 );
|
||||
setFontRole( Speedometer::Labels, QskSkin::SmallFont );
|
||||
|
||||
|
||||
// handle expanding, when being pressed
|
||||
for ( auto state : { QskAspect::NoState, QskSlider::Pressed } )
|
||||
{
|
||||
|
|
@ -217,4 +214,3 @@ void DefaultSkin::resetHints()
|
|||
m_palette = new Palette( m_scheme );
|
||||
initHints();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Palette;
|
|||
|
||||
class DefaultSkin : public QskSkin
|
||||
{
|
||||
public:
|
||||
public:
|
||||
DefaultSkin( const QString& name, QObject* parent = nullptr );
|
||||
~DefaultSkin() override;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ public:
|
|||
Nighttime
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
void initHints();
|
||||
|
||||
QString m_name;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ QQuickItem* MainWindow::headerBar() const
|
|||
header->addIndicator( "location" );
|
||||
header->addIndicator( "phone" );
|
||||
|
||||
(void) new QskTextLabel( QDate::currentDate().toString(), header );
|
||||
( void ) new QskTextLabel( QDate::currentDate().toString(), header );
|
||||
|
||||
header->addIndicator( "user" );
|
||||
header->addIndicator( "bookmark" );
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ class QQuickItem;
|
|||
|
||||
class MainWindow : public QskWindow
|
||||
{
|
||||
public:
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private:
|
||||
private:
|
||||
QQuickItem* headerBar() const;
|
||||
QQuickItem* mainContent() const;
|
||||
QQuickItem* footerBar() const;
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
#include "OtherSkin.h"
|
||||
#include "SkinFactory.h"
|
||||
|
||||
#include "SoundControl.h"
|
||||
#include "ButtonBar.h"
|
||||
#include "SoundControl.h"
|
||||
|
||||
#include "Speedometer.h"
|
||||
#include "SpeedometerSkinlet.h"
|
||||
|
||||
#include <QskBox.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSkinTransition.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class Palette
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
Palette()
|
||||
{
|
||||
// grey-blue-yellow:
|
||||
|
|
@ -40,24 +39,22 @@ public:
|
|||
QColor color3;
|
||||
QColor color4;
|
||||
QColor color5;
|
||||
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
namespace
|
||||
{
|
||||
static inline QFont qskFont( qreal pointSize )
|
||||
{
|
||||
QFont font( "Roboto" );
|
||||
font.setPointSizeF( pointSize / qskDpiScaled( 1.0 ) );
|
||||
return font;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OtherSkin::OtherSkin( const QString& name, QObject* parent ):
|
||||
QskSkin( parent ),
|
||||
m_name( name ),
|
||||
m_palette( new Palette )
|
||||
OtherSkin::OtherSkin( const QString& name, QObject* parent )
|
||||
: QskSkin( parent )
|
||||
, m_name( name )
|
||||
, m_palette( new Palette )
|
||||
{
|
||||
setObjectName( "OtherSkin" );
|
||||
declareSkinlet< Speedometer, SpeedometerSkinlet >();
|
||||
|
|
@ -113,8 +110,8 @@ void OtherSkin::initHints()
|
|||
setGradient( SoundControl::Overlay, overlayColor );
|
||||
|
||||
// -- slider control buttons
|
||||
setBoxBorderMetrics( SoundControl::SliderControl, 0 );
|
||||
setBoxShape( SoundControl::SliderControl, 4 );
|
||||
setBoxBorderMetrics( SoundControl::SliderControl, 0 );
|
||||
setBoxShape( SoundControl::SliderControl, 4 );
|
||||
|
||||
setGradient( SoundControl::SliderControl, m_palette->color1 );
|
||||
setGradient( SoundControl::SliderControl | QskPushButton::Pressed, m_palette->color2 );
|
||||
|
|
@ -144,8 +141,8 @@ void OtherSkin::initHints()
|
|||
// -- speedometers
|
||||
|
||||
setBoxBorderMetrics( Speedometer::Panel, 5 );
|
||||
setGradient( Speedometer::Panel, QskGradient( QskGradient::Vertical,
|
||||
m_palette->color2, m_palette->color4 ) );
|
||||
setGradient( Speedometer::Panel,
|
||||
QskGradient( QskGradient::Vertical, m_palette->color2, m_palette->color4 ) );
|
||||
setBoxBorderColors( Speedometer::Panel, m_palette->color3 );
|
||||
|
||||
setBoxBorderMetrics( Speedometer::NeedleHead, 5 );
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ class Palette;
|
|||
|
||||
class OtherSkin : public QskSkin
|
||||
{
|
||||
public:
|
||||
public:
|
||||
OtherSkin( const QString& name, QObject* parent = nullptr );
|
||||
~OtherSkin() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void initHints();
|
||||
void initGraphicFilters();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class SkinFactory : public QskSkinFactory
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
enum GraphicRoles
|
||||
{
|
||||
// to be visisble on a button
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
QStringList skinNames() const override;
|
||||
QskSkin* createSkin( const QString& skinName ) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void rotateSkin();
|
||||
void toggleScheme();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
#include "SoundControl.h"
|
||||
#include "SkinFactory.h"
|
||||
|
||||
#include <QskBox.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskGraphicIO.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskGridBox.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskNamespace.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskBox.h>
|
||||
#include <QskNamespace.h>
|
||||
|
||||
QSK_SUBCONTROL( SoundControl, Overlay )
|
||||
QSK_SUBCONTROL( SoundControl, CrossHair )
|
||||
|
|
@ -22,9 +22,9 @@ QSK_SUBCONTROL( SoundControl, SliderControl )
|
|||
|
||||
class VehicleLabel final : public QskGraphicLabel
|
||||
{
|
||||
public:
|
||||
VehicleLabel( QQuickItem* parentItem = nullptr ):
|
||||
QskGraphicLabel( parentItem )
|
||||
public:
|
||||
VehicleLabel( QQuickItem* parentItem = nullptr )
|
||||
: QskGraphicLabel( parentItem )
|
||||
{
|
||||
setGraphic( QskGraphicIO::read( QString( ":/qvg/car.qvg" ) ) );
|
||||
}
|
||||
|
|
@ -43,9 +43,9 @@ public:
|
|||
|
||||
class CrossHairLine final : public QskBox
|
||||
{
|
||||
public:
|
||||
CrossHairLine( QQuickItem* parent ):
|
||||
QskBox( parent )
|
||||
public:
|
||||
CrossHairLine( QQuickItem* parent )
|
||||
: QskBox( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ public:
|
|||
|
||||
class BalanceFadeMarker final : public QskBox
|
||||
{
|
||||
public:
|
||||
BalanceFadeMarker( QQuickItem* parent ):
|
||||
QskBox( parent )
|
||||
public:
|
||||
BalanceFadeMarker( QQuickItem* parent )
|
||||
: QskBox( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -79,10 +79,10 @@ public:
|
|||
|
||||
class MarkerControlButton final : public QskPushButton
|
||||
{
|
||||
public:
|
||||
MarkerControlButton( Qsk::Direction direction, QQuickItem* parentItem = nullptr ):
|
||||
QskPushButton( parentItem ),
|
||||
m_direction( direction )
|
||||
public:
|
||||
MarkerControlButton( Qsk::Direction direction, QQuickItem* parentItem = nullptr )
|
||||
: QskPushButton( parentItem )
|
||||
, m_direction( direction )
|
||||
{
|
||||
const char* svgList[] = { "right", "left", "down", "up" };
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
{
|
||||
const qreal off = 5.0;
|
||||
|
||||
switch( m_direction )
|
||||
switch ( m_direction )
|
||||
{
|
||||
case Qsk::LeftToRight:
|
||||
return QPointF( off, 0.0 );
|
||||
|
|
@ -126,7 +126,7 @@ public:
|
|||
return subControl;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
QSizeF contentsSizeHint() const override
|
||||
{
|
||||
const qreal dim = 100;
|
||||
|
|
@ -137,15 +137,15 @@ protected:
|
|||
return QSizeF( dim, 0.5 * dim );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
const Qsk::Direction m_direction;
|
||||
};
|
||||
|
||||
class ControlButton final : public QskPushButton
|
||||
{
|
||||
public:
|
||||
ControlButton( const char symbol, QQuickItem* parentItem = nullptr ):
|
||||
QskPushButton( parentItem )
|
||||
public:
|
||||
ControlButton( const char symbol, QQuickItem* parentItem = nullptr )
|
||||
: QskPushButton( parentItem )
|
||||
{
|
||||
setText( QChar( symbol ) );
|
||||
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
|
|
@ -171,10 +171,10 @@ public:
|
|||
|
||||
class StackedControl final : public QskControl
|
||||
{
|
||||
public:
|
||||
StackedControl( QQuickItem* parent = nullptr ):
|
||||
QskControl( parent ),
|
||||
m_offset( 0.0, 0.0 )
|
||||
public:
|
||||
StackedControl( QQuickItem* parent = nullptr )
|
||||
: QskControl( parent )
|
||||
, m_offset( 0.0, 0.0 )
|
||||
{
|
||||
setPolishOnResize( true ); // we have t re-layout the crosshair
|
||||
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
||||
|
|
@ -185,7 +185,7 @@ public:
|
|||
auto verticalCarRectangle = new CrossHairLine( this );
|
||||
verticalCarRectangle->setObjectName( "verticalBar" );
|
||||
|
||||
(void) new VehicleLabel( this );
|
||||
( void ) new VehicleLabel( this );
|
||||
|
||||
auto marker = new BalanceFadeMarker( this );
|
||||
marker->setObjectName( "marker" );
|
||||
|
|
@ -202,7 +202,7 @@ public:
|
|||
polish();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void updateLayout() override
|
||||
{
|
||||
const QRectF cr = contentsRect();
|
||||
|
|
@ -238,15 +238,15 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
QPointF m_offset;
|
||||
};
|
||||
|
||||
class SectionTitleBar final : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
SectionTitleBar( const char* title, QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, parentItem )
|
||||
public:
|
||||
SectionTitleBar( const char* title, QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, parentItem )
|
||||
{
|
||||
setSpacing( 10 );
|
||||
|
||||
|
|
@ -264,9 +264,9 @@ public:
|
|||
|
||||
class SliderBox final : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
SliderBox( const char* title, qreal min, qreal max, QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Vertical, parentItem )
|
||||
public:
|
||||
SliderBox( const char* title, qreal min, qreal max, QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Vertical, parentItem )
|
||||
{
|
||||
auto label = new QskTextLabel( title );
|
||||
m_numberLabel = new QskTextLabel();
|
||||
|
|
@ -307,7 +307,7 @@ public:
|
|||
this, &SliderBox::setValue );
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void setValue( qreal value )
|
||||
{
|
||||
m_slider->setValue( value );
|
||||
|
|
@ -318,7 +318,7 @@ public Q_SLOTS:
|
|||
m_numberLabel->setText( txt );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void increment( qreal offset )
|
||||
{
|
||||
setValue( m_slider->value() + offset );
|
||||
|
|
@ -330,9 +330,9 @@ private:
|
|||
|
||||
class ToneControlBox final : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
ToneControlBox( QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, parentItem )
|
||||
public:
|
||||
ToneControlBox( QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, parentItem )
|
||||
{
|
||||
auto bassControl = new SliderBox( "Bass", 0.0, 40.0, this );
|
||||
auto treebleControl = new SliderBox( "Treeble", 0.0, 40.0, this );
|
||||
|
|
@ -346,13 +346,13 @@ public:
|
|||
|
||||
class BalanceFadeControlBox final : public QskGridBox
|
||||
{
|
||||
public:
|
||||
BalanceFadeControlBox( QQuickItem* parentItem = nullptr ):
|
||||
QskGridBox( parentItem )
|
||||
public:
|
||||
BalanceFadeControlBox( QQuickItem* parentItem = nullptr )
|
||||
: QskGridBox( parentItem )
|
||||
{
|
||||
MarkerControlButton* buttons[4];
|
||||
MarkerControlButton* buttons[ 4 ];
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
buttons[i] = new MarkerControlButton( static_cast< Qsk::Direction >( i ) );
|
||||
buttons[ i ] = new MarkerControlButton( static_cast< Qsk::Direction >( i ) );
|
||||
|
||||
m_carControl = new StackedControl();
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ public:
|
|||
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
const auto button = buttons[i];
|
||||
const auto button = buttons[ i ];
|
||||
|
||||
setAlignment( button, Qt::AlignCenter );
|
||||
|
||||
|
|
@ -382,8 +382,8 @@ public:
|
|||
StackedControl* m_carControl;
|
||||
};
|
||||
|
||||
SoundControl::SoundControl( QQuickItem* parent ):
|
||||
QskBox( parent )
|
||||
SoundControl::SoundControl( QQuickItem* parent )
|
||||
: QskBox( parent )
|
||||
{
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
|
|
@ -409,4 +409,3 @@ QskAspect::Subcontrol SoundControl::effectiveSubcontrol(
|
|||
|
||||
return subControl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
class SoundControl : public QskBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
QSK_SUBCONTROLS( Overlay, CrossHair, Marker, Vehicle, SliderControl, MarkerControl )
|
||||
|
||||
SoundControl( QQuickItem* parent = nullptr );
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ QSK_SUBCONTROL( Speedometer, Labels )
|
|||
QSK_SUBCONTROL( Speedometer, NeedleHead )
|
||||
QSK_SUBCONTROL( Speedometer, Needle )
|
||||
|
||||
Speedometer::Speedometer( QQuickItem* parent ) :
|
||||
QskRangeControl( parent )
|
||||
Speedometer::Speedometer( QQuickItem* parent )
|
||||
: QskRangeControl( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Speedometer : public QskRangeControl
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
QSK_SUBCONTROLS( Panel, Labels, NeedleHead, Needle )
|
||||
|
||||
Speedometer( QQuickItem* parent = nullptr );
|
||||
|
|
@ -15,7 +15,7 @@ public:
|
|||
QVector< QString > labels() const;
|
||||
void setLabels( const QVector< QString >& labels );
|
||||
|
||||
private:
|
||||
private:
|
||||
QVector< QString > m_labels;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
#include <QTimer>
|
||||
#include <QtGlobal>
|
||||
|
||||
SpeedometerDisplay::SpeedometerDisplay( QQuickItem *parent ) :
|
||||
QskControl( parent ),
|
||||
m_box( new QskLinearBox( Qt::Horizontal, this ) ),
|
||||
m_revCounter( new Speedometer( m_box ) ),
|
||||
m_revCounterText( new QskTextLabel( QStringLiteral( "x 1000 min^-1" ), m_revCounter ) ),
|
||||
m_speedometer( new Speedometer( m_box ) ),
|
||||
m_speedometerText( new QskTextLabel( QStringLiteral( "km/h" ), m_speedometer ) ),
|
||||
m_fuelGauge( new Speedometer( m_box ) ),
|
||||
m_fuelGaugeText( new QskTextLabel( QStringLiteral( "fuel" ), m_fuelGauge ) )
|
||||
SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent )
|
||||
: QskControl( parent )
|
||||
, m_box( new QskLinearBox( Qt::Horizontal, this ) )
|
||||
, m_revCounter( new Speedometer( m_box ) )
|
||||
, m_revCounterText( new QskTextLabel( QStringLiteral( "x 1000 min^-1" ), m_revCounter ) )
|
||||
, m_speedometer( new Speedometer( m_box ) )
|
||||
, m_speedometerText( new QskTextLabel( QStringLiteral( "km/h" ), m_speedometer ) )
|
||||
, m_fuelGauge( new Speedometer( m_box ) )
|
||||
, m_fuelGaugeText( new QskTextLabel( QStringLiteral( "fuel" ), m_fuelGauge ) )
|
||||
{
|
||||
qsrand( static_cast< uint >( QTime::currentTime().msec() ) );
|
||||
|
||||
|
|
@ -72,7 +72,6 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem *parent ) :
|
|||
timer->setInterval( 16 );
|
||||
timer->start();
|
||||
|
||||
|
||||
m_fuelGauge->setObjectName( QStringLiteral( "Fuel Gauge" ) );
|
||||
m_fuelGauge->setMinimum( 195 );
|
||||
m_fuelGauge->setMaximum( 345 );
|
||||
|
|
@ -83,7 +82,6 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem *parent ) :
|
|||
|
||||
m_fuelGauge->setLabels( fuelGaugeLabels );
|
||||
|
||||
|
||||
m_revCounterText->setMargins( 50 );
|
||||
m_speedometerText->setMargins( 50 );
|
||||
m_fuelGaugeText->setMargins( 50 );
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ class Speedometer;
|
|||
|
||||
class SpeedometerDisplay : public QskControl
|
||||
{
|
||||
public:
|
||||
public:
|
||||
SpeedometerDisplay( QQuickItem* parent = nullptr );
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void updateLayout() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
QskLinearBox* m_box;
|
||||
Speedometer* m_revCounter;
|
||||
QskTextLabel* m_revCounterText;
|
||||
|
|
|
|||
|
|
@ -17,38 +17,38 @@ namespace
|
|||
{
|
||||
class TicksNode : public QSGGeometryNode
|
||||
{
|
||||
public:
|
||||
TicksNode():
|
||||
m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
public:
|
||||
TicksNode()
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
|
||||
setGeometry( &m_geometry );
|
||||
setMaterial( &m_material );
|
||||
}
|
||||
setGeometry( &m_geometry );
|
||||
setMaterial( &m_material );
|
||||
}
|
||||
|
||||
void setColor( const QColor& color )
|
||||
{
|
||||
m_material.setColor( color );
|
||||
}
|
||||
void setColor( const QColor& color )
|
||||
{
|
||||
m_material.setColor( color );
|
||||
}
|
||||
|
||||
private:
|
||||
QSGFlatColorMaterial m_material;
|
||||
QSGGeometry m_geometry;
|
||||
private:
|
||||
QSGFlatColorMaterial m_material;
|
||||
QSGGeometry m_geometry;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
SpeedometerSkinlet::SpeedometerSkinlet( QskSkin* skin ) :
|
||||
QskSkinlet( skin )
|
||||
SpeedometerSkinlet::SpeedometerSkinlet( QskSkin* skin )
|
||||
: QskSkinlet( skin )
|
||||
{
|
||||
setNodeRoles( { PanelRole, LabelsRole, NeedleRole } );
|
||||
}
|
||||
|
||||
SpeedometerSkinlet::~SpeedometerSkinlet() = default;
|
||||
|
||||
QRectF SpeedometerSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
QskAspect::Subcontrol /*unused*/ ) const
|
||||
QRectF SpeedometerSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol ) const
|
||||
{
|
||||
const auto speedometer = static_cast< const Speedometer* >( skinnable );
|
||||
|
||||
|
|
@ -56,12 +56,12 @@ QRectF SpeedometerSkinlet::subControlRect( const QskSkinnable* skinnable,
|
|||
return speedometer->contentsRect();
|
||||
}
|
||||
|
||||
QSGNode* SpeedometerSkinlet::updateSubNode( const QskSkinnable* skinnable, quint8 nodeRole,
|
||||
QSGNode* node ) const
|
||||
QSGNode* SpeedometerSkinlet::updateSubNode(
|
||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
const auto speedometer = static_cast< const Speedometer* >( skinnable );
|
||||
|
||||
switch( nodeRole )
|
||||
switch ( nodeRole )
|
||||
{
|
||||
case PanelRole:
|
||||
return updatePanelNode( speedometer, node );
|
||||
|
|
@ -81,7 +81,7 @@ QSGNode* SpeedometerSkinlet::updatePanelNode( const Speedometer* speedometer, QS
|
|||
{
|
||||
auto boxNode = static_cast< QskBoxNode* >( node );
|
||||
|
||||
if( boxNode == nullptr )
|
||||
if ( boxNode == nullptr )
|
||||
{
|
||||
boxNode = new QskBoxNode;
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
QVector< QString > labels = speedometer->labels();
|
||||
|
||||
// Create a series of tickmarks from minimum to maximum
|
||||
for( int i = 0; i < labelsCount; ++i, angle += step )
|
||||
for ( int i = 0; i < labelsCount; ++i, angle += step )
|
||||
{
|
||||
qreal cosine = qCos( qDegreesToRadians( angle ) );
|
||||
qreal sine = qSin( qDegreesToRadians( angle ) );
|
||||
|
|
@ -155,8 +155,8 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
auto xEnd = center.x() + ( radius - length ) * cosine;
|
||||
auto yEnd = center.y() + ( radius - length ) * sine;
|
||||
|
||||
vertexData[0].set( xStart, yStart );
|
||||
vertexData[1].set( xEnd, yEnd );
|
||||
vertexData[ 0 ].set( xStart, yStart );
|
||||
vertexData[ 1 ].set( xEnd, yEnd );
|
||||
|
||||
vertexData += 2;
|
||||
|
||||
|
|
@ -187,9 +187,8 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
}
|
||||
|
||||
QFont font = speedometer->effectiveFont( Speedometer::Labels );
|
||||
numbersNode->setTextData( speedometer, text, numbersRect, font,
|
||||
QskTextOptions(), QskTextColors( color ),
|
||||
Qt::AlignCenter | Qt::AlignHCenter, Qsk::Normal );
|
||||
numbersNode->setTextData( speedometer, text, numbersRect, font, QskTextOptions(),
|
||||
QskTextColors( color ), Qt::AlignCenter | Qt::AlignHCenter, Qsk::Normal );
|
||||
|
||||
if ( ticksNode->childCount() <= i )
|
||||
{
|
||||
|
|
@ -237,8 +236,7 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
|||
QskBoxBorderMetrics borderMetrics = speedometer->boxBorderMetricsHint( Speedometer::NeedleHead );
|
||||
QskBoxBorderColors borderColors = speedometer->boxBorderColorsHint( Speedometer::NeedleHead );
|
||||
QskGradient gradient = speedometer->gradientHint( Speedometer::NeedleHead );
|
||||
QRectF centerNodeRect( center.x() - radius, center.y() - radius,
|
||||
2 * radius, 2 * radius );
|
||||
QRectF centerNodeRect( center.x() - radius, center.y() - radius, 2 * radius, 2 * radius );
|
||||
boxNode->setBoxData( centerNodeRect, shapeMetrics, borderMetrics, borderColors, gradient );
|
||||
|
||||
QColor color = speedometer->color( Speedometer::Needle );
|
||||
|
|
@ -249,8 +247,8 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
|||
auto needleWidth = speedometer->metric( Speedometer::Needle | QskAspect::MinimumWidth );
|
||||
auto needleMargin = speedometer->metric( Speedometer::Needle | QskAspect::Margin );
|
||||
|
||||
QRectF needleRect( center.x() - needleWidth , center.y() - needleWidth ,
|
||||
panelRadius - ( needleWidth + needleMargin ), 2 * needleWidth );
|
||||
QRectF needleRect( center.x() - needleWidth, center.y() - needleWidth,
|
||||
panelRadius - ( needleWidth + needleMargin ), 2 * needleWidth );
|
||||
float xStart = center.x();
|
||||
float yStart = center.y();
|
||||
|
||||
|
|
@ -268,10 +266,10 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
|||
auto vertexData = geometry->vertexDataAsPoint2D();
|
||||
memset( vertexData, 0, static_cast< size_t >( geometry->vertexCount() ) );
|
||||
|
||||
vertexData[0].set( xStart, yStart );
|
||||
vertexData[1].set( xEnd, yEnd );
|
||||
vertexData[ 0 ].set( xStart, yStart );
|
||||
vertexData[ 1 ].set( xEnd, yEnd );
|
||||
|
||||
geometry->setLineWidth( 2 * needleWidth );
|
||||
geometry->setLineWidth( 2 * needleWidth );
|
||||
geometry->markVertexDataDirty();
|
||||
|
||||
needleNode->markDirty( QSGNode::DirtyGeometry );
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ class SpeedometerSkinlet : public QskSkinlet
|
|||
{
|
||||
Q_GADGET
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
|
|
@ -24,10 +23,11 @@ public:
|
|||
QRectF subControlRect( const QskSkinnable* skinnable,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
virtual QSGNode* updateSubNode( const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const override;
|
||||
protected:
|
||||
virtual QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* node ) const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
QSGNode* updatePanelNode( const Speedometer*, QSGNode* ) const;
|
||||
QSGNode* updateLabelsNode( const Speedometer*, QSGNode* ) const;
|
||||
QSGNode* updateNeedleNode( const Speedometer*, QSGNode* ) const;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "MainWindow.h"
|
||||
#include "SkinFactory.h"
|
||||
|
||||
#include <QskSetup.h>
|
||||
#include <QskShortcutMap.h>
|
||||
#include <QskSkinManager.h>
|
||||
#include <QskSetup.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "Box.h"
|
||||
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
|
||||
Box::Box( QQuickItem* parentItem ):
|
||||
QskBox( parentItem )
|
||||
Box::Box( QQuickItem* parentItem )
|
||||
: QskBox( parentItem )
|
||||
{
|
||||
setSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Ignored );
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ void Box::setBackground( FillType type, Palette::Color color, bool inverted )
|
|||
const QColor light = pal.color( Palette::W300 );
|
||||
const QColor mid = pal.color( Palette::W600 );
|
||||
|
||||
switch( type )
|
||||
switch ( type )
|
||||
{
|
||||
case Unfilled:
|
||||
setGradient( QskGradient() );
|
||||
|
|
@ -67,7 +67,7 @@ void Box::setBorder( BorderType type, Palette::Color color )
|
|||
light.setAlpha( 100 );
|
||||
#endif
|
||||
|
||||
switch( type )
|
||||
switch ( type )
|
||||
{
|
||||
case NoBorder:
|
||||
setBorderWidth( 0 );
|
||||
|
|
@ -102,8 +102,7 @@ void Box::setShape( const QskBoxShapeMetrics& shape )
|
|||
|
||||
void Box::setShape( qreal radius, Qt::SizeMode sizeMode )
|
||||
{
|
||||
setBoxShapeHint( QskBox::Panel,
|
||||
QskBoxShapeMetrics( radius, sizeMode ) );
|
||||
setBoxShapeHint( QskBox::Panel, QskBoxShapeMetrics( radius, sizeMode ) );
|
||||
}
|
||||
|
||||
void Box::setShape( qreal radiusX, qreal radiusY, Qt::SizeMode sizeMode )
|
||||
|
|
@ -179,8 +178,7 @@ void Box::setGradient(
|
|||
|
||||
QVector< QskGradientStop > stops;
|
||||
|
||||
stops += QskGradientStop(
|
||||
0.0, pal.color( static_cast<Palette::Weight>( 0 ) ) );
|
||||
stops += QskGradientStop( 0.0, pal.color( static_cast< Palette::Weight >( 0 ) ) );
|
||||
|
||||
const int count = Palette::NumWeights - 1;
|
||||
for ( int i = 1; i < count; i++ )
|
||||
|
|
@ -197,4 +195,3 @@ void Box::setGradient(
|
|||
|
||||
setGradient( QskGradient( orientation, stops ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
class Box : public QskBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum FillType
|
||||
{
|
||||
Unfilled,
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ namespace
|
|||
{
|
||||
class StandardPalette : public Palette
|
||||
{
|
||||
public:
|
||||
public:
|
||||
StandardPalette( int index )
|
||||
{
|
||||
using namespace QskRgbValue;
|
||||
|
||||
static QRgb table[][Palette::NumWeights] =
|
||||
static QRgb table[][ Palette::NumWeights ] =
|
||||
{
|
||||
RGBTABLE( Red ),
|
||||
RGBTABLE( Pink ),
|
||||
|
|
@ -30,7 +30,7 @@ namespace
|
|||
RGBTABLE( Cyan ),
|
||||
RGBTABLE( Teal ),
|
||||
RGBTABLE( Green ),
|
||||
RGBTABLE( LightGreen),
|
||||
RGBTABLE( LightGreen ),
|
||||
RGBTABLE( Lime ),
|
||||
RGBTABLE( Yellow ),
|
||||
RGBTABLE( Amber ),
|
||||
|
|
@ -41,7 +41,7 @@ namespace
|
|||
RGBTABLE( BlueGrey ),
|
||||
};
|
||||
|
||||
const int count = sizeof( table ) / sizeof( table[0] );
|
||||
const int count = sizeof( table ) / sizeof( table[ 0 ] );
|
||||
m_rgb = table[ qBound( 0, index, count ) ];
|
||||
}
|
||||
};
|
||||
|
|
@ -51,4 +51,3 @@ Palette Palette::palette( Color color )
|
|||
{
|
||||
return StandardPalette( static_cast< int >( color ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
class Palette
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum Weight
|
||||
{
|
||||
W50,
|
||||
|
|
@ -60,9 +60,8 @@ public:
|
|||
|
||||
static Palette palette( Color );
|
||||
|
||||
protected:
|
||||
protected:
|
||||
QRgb* m_rgb;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
#include <QskTabView.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
|
|
@ -24,18 +24,18 @@
|
|||
|
||||
class Rectangle : public Box
|
||||
{
|
||||
public:
|
||||
Rectangle( QQuickItem* parentItem ):
|
||||
Box( parentItem )
|
||||
public:
|
||||
Rectangle( QQuickItem* parentItem )
|
||||
: Box( parentItem )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class RoundedRectangle : public Box
|
||||
{
|
||||
public:
|
||||
RoundedRectangle( QQuickItem* parentItem ):
|
||||
Box( parentItem )
|
||||
public:
|
||||
RoundedRectangle( QQuickItem* parentItem )
|
||||
: Box( parentItem )
|
||||
{
|
||||
setShape( 20, Qt::AbsoluteSize );
|
||||
}
|
||||
|
|
@ -43,9 +43,9 @@ public:
|
|||
|
||||
class Ellipse : public Box
|
||||
{
|
||||
public:
|
||||
Ellipse( QQuickItem* parentItem ):
|
||||
Box( parentItem )
|
||||
public:
|
||||
Ellipse( QQuickItem* parentItem )
|
||||
: Box( parentItem )
|
||||
{
|
||||
setShape( 100, Qt::RelativeSize );
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ static void addRectangles10( QskLinearBox* parent )
|
|||
static void addRectangles11( QskLinearBox* parent )
|
||||
{
|
||||
const qreal border = 5;
|
||||
const Box::FillType fillType[5] = { Box::Solid, Box::Horizontal,
|
||||
const Box::FillType fillType[ 5 ] = { Box::Solid, Box::Horizontal,
|
||||
Box::Vertical, Box::Horizontal, Box::Vertical };
|
||||
|
||||
for ( int i = 0; i < 5; i++ )
|
||||
|
|
@ -266,12 +266,12 @@ static void addRectangles11( QskLinearBox* parent )
|
|||
|
||||
box->setBorder( Box::Flat, Palette::Teal );
|
||||
|
||||
qreal bw[4] = { border, border, border, border };
|
||||
qreal bw[ 4 ] = { border, border, border, border };
|
||||
if ( i != 0 )
|
||||
bw[ i - 1 ] = 0;
|
||||
|
||||
box->setBorderWidth( bw[0], bw[1], bw[2], bw[3] );
|
||||
box->setBackground( fillType[i], Palette::Brown, i >= 3 );
|
||||
box->setBorderWidth( bw[ 0 ], bw[ 1 ], bw[ 2 ], bw[ 3 ] );
|
||||
box->setBackground( fillType[ i ], Palette::Brown, i >= 3 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,12 +302,12 @@ static void addRectangles12( QskLinearBox* parent )
|
|||
}
|
||||
|
||||
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
||||
{
|
||||
{
|
||||
auto* box = new Box( parent );
|
||||
box->setBorder( Box::Flat, Palette::DeepOrange );
|
||||
box->setShape( 30, 40, Qt::RelativeSize );
|
||||
box->setGradient( orientation, Palette::Blue );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto orientation : { QskGradient::Vertical,
|
||||
QskGradient::Horizontal, QskGradient::Diagonal } )
|
||||
|
|
@ -361,9 +361,9 @@ static void addRectanglesRest( QskLinearBox* parent )
|
|||
|
||||
class TabView : public QskTabView
|
||||
{
|
||||
public:
|
||||
TabView( QQuickItem* parentItem = nullptr ):
|
||||
QskTabView( Qt::Vertical, parentItem )
|
||||
public:
|
||||
TabView( QQuickItem* parentItem = nullptr )
|
||||
: QskTabView( Qt::Vertical, parentItem )
|
||||
{
|
||||
setMargins( 10 );
|
||||
|
||||
|
|
@ -400,7 +400,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void addTab( QskLinearBox* layout )
|
||||
{
|
||||
layout->setMargins( 10 );
|
||||
|
|
@ -421,8 +421,7 @@ int main( int argc, char* argv[] )
|
|||
QGuiApplication app( argc, argv );
|
||||
|
||||
SkinnyFont::init( &app );
|
||||
SkinnyShortcut::enable( SkinnyShortcut::Quit |
|
||||
SkinnyShortcut::DebugShortcuts );
|
||||
SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugShortcuts );
|
||||
|
||||
auto* tabView = new TabView();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include <SkinnyShapeProvider.h>
|
||||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShapeProvider.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
#include "Theme.h"
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskSetup.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskSkinTransition.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
|
||||
static void qskResetColors( QskSkin* skin, const QColor& accent )
|
||||
{
|
||||
|
|
@ -30,32 +30,32 @@ namespace
|
|||
{
|
||||
class SkinTransition final : public QskSkinTransition
|
||||
{
|
||||
public:
|
||||
SkinTransition( const QColor& accent ):
|
||||
m_accent( accent )
|
||||
public:
|
||||
SkinTransition( const QColor& accent )
|
||||
: m_accent( accent )
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void updateSkin( QskSkin*, QskSkin* newSkin ) override
|
||||
{
|
||||
qskResetColors( newSkin, m_accent );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
const QColor m_accent;
|
||||
};
|
||||
}
|
||||
|
||||
Theme::Theme( QObject* parent ):
|
||||
QObject( parent ),
|
||||
m_accent( qskSetup->skin()->color( QskAspect::Color ) )
|
||||
Theme::Theme( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_accent( qskSetup->skin()->color( QskAspect::Color ) )
|
||||
{
|
||||
connect( qskSetup, &QskSetup::skinChanged,
|
||||
this, [this]( QskSkin* ) { updateColors(); } );
|
||||
this, [ this ]( QskSkin* ) { updateColors(); } );
|
||||
|
||||
connect( qskSetup, &QskSetup::skinChanged,
|
||||
this, [this]( QskSkin* ) { Q_EMIT skinChanged(); } );
|
||||
this, [ this ]( QskSkin* ) { Q_EMIT skinChanged(); } );
|
||||
}
|
||||
|
||||
void Theme::setAccent( QColor color )
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef THEME_H
|
||||
#define THEME_H 1
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
|
||||
class Theme : public QObject
|
||||
{
|
||||
|
|
@ -16,7 +16,7 @@ class Theme : public QObject
|
|||
Q_PROPERTY( QColor accent READ accent WRITE setAccent NOTIFY accentChanged )
|
||||
Q_PROPERTY( QString skin READ skin WRITE setSkin NOTIFY skinChanged )
|
||||
|
||||
public:
|
||||
public:
|
||||
Theme( QObject* parent = nullptr );
|
||||
|
||||
void setAccent( QColor color );
|
||||
|
|
@ -25,11 +25,11 @@ public:
|
|||
void setSkin( const QString& );
|
||||
QString skin() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNALS:
|
||||
void accentChanged();
|
||||
void skinChanged();
|
||||
|
||||
private:
|
||||
private:
|
||||
void updateColors();
|
||||
|
||||
QColor m_accent;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QtQml>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QtQml>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,27 +3,27 @@
|
|||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include <SkinnyShortcut.h>
|
||||
#include <SkinnyShapeProvider.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskShortcutMap.h>
|
||||
#include <QskSubWindow.h>
|
||||
#include <QskSubWindowArea.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskShortcutMap.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <QKeySequence>
|
||||
#include <QDebug>
|
||||
|
||||
class SubWindow : public QskSubWindow
|
||||
{
|
||||
public:
|
||||
SubWindow( const QString& graphicSource, QQuickItem* parent = nullptr ):
|
||||
QskSubWindow( parent )
|
||||
public:
|
||||
SubWindow( const QString& graphicSource, QQuickItem* parent = nullptr )
|
||||
: QskSubWindow( parent )
|
||||
{
|
||||
setObjectName( graphicSource );
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ public:
|
|||
QskSizePolicy::MinimumExpanding );
|
||||
|
||||
QskShortcutMap::addShortcut( this, QKeySequence( Qt::Key_P ), true,
|
||||
[=] { qDebug() << graphicSource; } );
|
||||
[ graphicSource ] { qDebug() << graphicSource; } );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ int main( int argc, char* argv[] )
|
|||
{
|
||||
const qreal off = ( i + 1 ) * 100;
|
||||
|
||||
SubWindow* subWindow = new SubWindow( url + shapes[i], area );
|
||||
auto subWindow = new SubWindow( url + shapes[ i ], area );
|
||||
subWindow->setGeometry( windowRect.translated( off, off ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskPushButton.h>
|
||||
#include "Window.h"
|
||||
|
||||
Window::Window( Qt::Orientation orientation ):
|
||||
m_orientation( orientation )
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskPushButton.h>
|
||||
|
||||
Window::Window( Qt::Orientation orientation )
|
||||
: m_orientation( orientation )
|
||||
{
|
||||
m_layoutBox = new QskLinearBox( invertedOrientation() );
|
||||
m_layoutBox->setObjectName( "MainBox" );
|
||||
|
|
@ -17,10 +18,14 @@ Window::Window( Qt::Orientation orientation ):
|
|||
m_layoutBox->setExtraSpacingAt( Qt::BottomEdge | Qt::RightEdge );
|
||||
|
||||
addBox( QskDialog::Ok );
|
||||
|
||||
addBox( QskDialog::StandardButtons( QskDialog::Ok | QskDialog::Cancel ) );
|
||||
|
||||
addBox( QskDialog::StandardButtons( QskDialog::Yes | QskDialog::No ) );
|
||||
|
||||
addBox( QskDialog::StandardButtons( QskDialog::Save | QskDialog::Discard
|
||||
| QskDialog::RestoreDefaults | QskDialog::Help ) );
|
||||
|
||||
addBox( QskDialog::StandardButtons( QskDialog::Abort
|
||||
| QskDialog::Retry | QskDialog::Ignore ) );
|
||||
|
||||
|
|
@ -90,8 +95,7 @@ QVector< QskDialogButtonBox* > Window::dialogBoxes() const
|
|||
QVector< QskDialogButtonBox* > boxes;
|
||||
for ( int i = 0; i < m_layoutBox->itemCount(); i++ )
|
||||
{
|
||||
if ( QskDialogButtonBox* box =
|
||||
qobject_cast< QskDialogButtonBox* >( m_layoutBox->itemAtIndex( i ) ) )
|
||||
if ( auto box = qobject_cast< QskDialogButtonBox* >( m_layoutBox->itemAtIndex( i ) ) )
|
||||
{
|
||||
boxes += box;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef WINDOW_H
|
||||
#define WINDOW_H 1
|
||||
|
||||
#include <QskWindow.h>
|
||||
#include <QskDialog.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
class QskDialogButtonBox;
|
||||
class QskLinearBox;
|
||||
|
|
@ -16,21 +16,21 @@ class Window : public QskWindow
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
Window( Qt::Orientation );
|
||||
|
||||
private Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void flipOrientation();
|
||||
void centerButtons();
|
||||
|
||||
private:
|
||||
private:
|
||||
void addBox( QskDialog::StandardButtons );
|
||||
void addActionBox();
|
||||
|
||||
QVector< QskDialogButtonBox* > dialogBoxes() const;
|
||||
Qt::Orientation invertedOrientation() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
QskLinearBox* m_layoutBox;
|
||||
Qt::Orientation m_orientation;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
#include "Frame.h"
|
||||
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxNode.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskSkinlet.h>
|
||||
|
||||
static inline qreal effectiveRadius( const QRectF& rect, qreal percentage )
|
||||
|
|
@ -17,12 +17,12 @@ static inline qreal effectiveRadius( const QRectF& rect, qreal percentage )
|
|||
return percentage / 100.0 * 0.5 * qMin( rect.width(), rect.height() );
|
||||
}
|
||||
|
||||
Frame::Frame( QQuickItem* parent ):
|
||||
Inherited( parent ),
|
||||
m_style( Frame::Plain ),
|
||||
m_color( Qt::gray ),
|
||||
m_frameWidth( 1.0 ),
|
||||
m_radius( 0.0 )
|
||||
Frame::Frame( QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_style( Frame::Plain )
|
||||
, m_color( Qt::gray )
|
||||
, m_frameWidth( 1.0 )
|
||||
, m_radius( 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ void Frame::updateFrameNode( const QRectF& rect, QskBoxNode* node )
|
|||
|
||||
QColor c1, c2;
|
||||
|
||||
switch( m_style )
|
||||
switch ( m_style )
|
||||
{
|
||||
case Frame::Sunken:
|
||||
{
|
||||
|
|
@ -147,10 +147,10 @@ void Frame::updateFrameNode( const QRectF& rect, QskBoxNode* node )
|
|||
c1 = c2 = dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const QskBoxBorderColors borderColors( c1, c1, c2, c2 );
|
||||
const qreal radius = effectiveRadius( rect, m_radius );
|
||||
|
||||
|
||||
node->setBoxData( rect, radius, m_frameWidth, borderColors, m_color );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT Frame : public QskControl
|
|||
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
public:
|
||||
enum Style
|
||||
{
|
||||
Plain,
|
||||
|
|
@ -53,16 +53,16 @@ public:
|
|||
void setColor( const QColor& );
|
||||
QColor color() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNALS:
|
||||
void styleChanged();
|
||||
void frameWidthChanged();
|
||||
void radiusChanged();
|
||||
void colorChanged();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void updateNode( QSGNode* ) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void updateFrameNode( const QRectF&, QskBoxNode* );
|
||||
|
||||
Style m_style;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,14 +9,13 @@
|
|||
#include <QskGraphicIO.h>
|
||||
#include <QskGraphicTextureFactory.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QPainter>
|
||||
#include <QQuickWindow>
|
||||
#include <QStringList>
|
||||
#include <QSvgRenderer>
|
||||
#include <QSvgRenderer>
|
||||
#include <QDebug>
|
||||
#include <QElapsedTimer>
|
||||
#include <QQuickWindow>
|
||||
#include <QPainter>
|
||||
|
||||
bool Benchmark::run( const QString& dirName )
|
||||
{
|
||||
|
|
@ -33,18 +32,18 @@ bool Benchmark::run( const QString& dirName )
|
|||
QStringList qvgFiles = svgFiles;
|
||||
for ( int i = 0; i < qvgFiles.size(); i++ )
|
||||
{
|
||||
svgFiles[i].prepend( "/" );
|
||||
svgFiles[i].prepend( dirName );
|
||||
svgFiles[ i ].prepend( "/" );
|
||||
svgFiles[ i ].prepend( dirName );
|
||||
|
||||
qvgFiles[i].replace( ".svg", ".qvg" );
|
||||
qvgFiles[i].prepend( "/" );
|
||||
qvgFiles[i].prepend( qvgPath );
|
||||
qvgFiles[ i ].replace( ".svg", ".qvg" );
|
||||
qvgFiles[ i ].prepend( "/" );
|
||||
qvgFiles[ i ].prepend( qvgPath );
|
||||
}
|
||||
|
||||
QVector< QskGraphic > graphics( qvgFiles.size() );
|
||||
QVector< QSvgRenderer* > renderers( svgFiles.size() );
|
||||
|
||||
qint64 msElapsed[6];
|
||||
qint64 msElapsed[ 6 ];
|
||||
|
||||
QElapsedTimer timer;
|
||||
|
||||
|
|
@ -55,15 +54,15 @@ bool Benchmark::run( const QString& dirName )
|
|||
|
||||
for ( int i = 0; i < svgFiles.size(); i++ )
|
||||
{
|
||||
renderers[i] = new QSvgRenderer();
|
||||
if ( !renderers[i]->load( svgFiles[i] ) )
|
||||
renderers[ i ] = new QSvgRenderer();
|
||||
if ( !renderers[ i ]->load( svgFiles[ i ] ) )
|
||||
{
|
||||
qCritical() << "Can't load" << svgFiles[i];
|
||||
qCritical() << "Can't load" << svgFiles[ i ];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
msElapsed[0] = timer.elapsed();
|
||||
msElapsed[ 0 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -73,13 +72,12 @@ bool Benchmark::run( const QString& dirName )
|
|||
|
||||
for ( int i = 0; i < renderers.size(); i++ )
|
||||
{
|
||||
QPainter painter( &graphics[i] );
|
||||
renderers[i]->render( &painter );
|
||||
QPainter painter( &graphics[ i ] );
|
||||
renderers[ i ]->render( &painter );
|
||||
painter.end();
|
||||
}
|
||||
|
||||
|
||||
msElapsed[1] = timer.elapsed();
|
||||
msElapsed[ 1 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -89,10 +87,10 @@ bool Benchmark::run( const QString& dirName )
|
|||
|
||||
for ( int i = 0; i < graphics.size(); i++ )
|
||||
{
|
||||
QskGraphicIO::write( graphics[i], qvgFiles[i] );
|
||||
QskGraphicIO::write( graphics[ i ], qvgFiles[ i ] );
|
||||
}
|
||||
|
||||
msElapsed[2] = timer.elapsed();
|
||||
msElapsed[ 2 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -102,15 +100,15 @@ bool Benchmark::run( const QString& dirName )
|
|||
|
||||
for ( int i = 0; i < qvgFiles.size(); i++ )
|
||||
{
|
||||
graphics[i] = QskGraphicIO::read( qvgFiles[i] );
|
||||
if ( graphics[i].isNull() )
|
||||
graphics[ i ] = QskGraphicIO::read( qvgFiles[ i ] );
|
||||
if ( graphics[ i ].isNull() )
|
||||
{
|
||||
qCritical() << "Can't load" << qvgFiles[i];
|
||||
qCritical() << "Can't load" << qvgFiles[ i ];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
msElapsed[3] = timer.elapsed();
|
||||
msElapsed[ 3 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -125,16 +123,16 @@ bool Benchmark::run( const QString& dirName )
|
|||
{
|
||||
const auto textureId = QskGraphicTextureFactory::createTexture(
|
||||
QskGraphicTextureFactory::OpenGL, targetRect, Qt::KeepAspectRatio,
|
||||
graphics[i], colorFilter );
|
||||
graphics[ i ], colorFilter );
|
||||
|
||||
if ( textureId == 0 )
|
||||
{
|
||||
qCritical() << "Can't render texture for" << qvgFiles[i];
|
||||
qCritical() << "Can't render texture for" << qvgFiles[ i ];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
msElapsed[4] = timer.elapsed();
|
||||
msElapsed[ 4 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -149,25 +147,25 @@ bool Benchmark::run( const QString& dirName )
|
|||
{
|
||||
const auto textureId = QskGraphicTextureFactory::createTexture(
|
||||
QskGraphicTextureFactory::Raster, targetRect, Qt::KeepAspectRatio,
|
||||
graphics[i], colorFilter );
|
||||
graphics[ i ], colorFilter );
|
||||
|
||||
if ( textureId == 0 )
|
||||
{
|
||||
qCritical() << "Can't render texture for" << qvgFiles[i];
|
||||
qCritical() << "Can't render texture for" << qvgFiles[ i ];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
msElapsed[5] = timer.elapsed();
|
||||
msElapsed[ 5 ] = timer.elapsed();
|
||||
}
|
||||
|
||||
qDebug() << "#Icons:" << svgFiles.count() <<
|
||||
"Compiled:" << msElapsed[0] <<
|
||||
"Converted:" << msElapsed[1] <<
|
||||
"Stored:" << msElapsed[2] <<
|
||||
"Loaded:" << msElapsed[3] <<
|
||||
"Rendered OpenGL:" << msElapsed[4] <<
|
||||
"Rendered Raster:" << msElapsed[5];
|
||||
"Compiled:" << msElapsed[ 0 ] <<
|
||||
"Converted:" << msElapsed[ 1 ] <<
|
||||
"Stored:" << msElapsed[ 2 ] <<
|
||||
"Loaded:" << msElapsed[ 3 ] <<
|
||||
"Rendered OpenGL:" << msElapsed[ 4 ] <<
|
||||
"Rendered Raster:" << msElapsed[ 5 ];
|
||||
|
||||
svgDir.rmdir( qvgPath );
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,18 @@
|
|||
|
||||
#include "Benchmark.h"
|
||||
|
||||
#include <QskWindow.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QGuiApplication>
|
||||
|
||||
class Button : public QskPushButton
|
||||
{
|
||||
public:
|
||||
Button( const QString& testDir ):
|
||||
m_testDir( testDir )
|
||||
public:
|
||||
Button( const QString& testDir )
|
||||
: m_testDir( testDir )
|
||||
{
|
||||
setText( QString( "Run: " ) + testDir );
|
||||
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
|
|
@ -27,7 +27,7 @@ public:
|
|||
Benchmark::run( m_testDir );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
QString m_testDir;
|
||||
};
|
||||
|
||||
|
|
@ -36,19 +36,18 @@ int main( int argc, char* argv[] )
|
|||
QGuiApplication app( argc, argv );
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Benchmark for creating textures from SVGs");
|
||||
parser.setApplicationDescription( "Benchmark for creating textures from SVGs" );
|
||||
parser.addHelpOption();
|
||||
parser.addPositionalArgument("svgdir", "Directory with SVG files.", "[pathname]");
|
||||
parser.addPositionalArgument( "svgdir", "Directory with SVG files.", "[pathname]" );
|
||||
|
||||
parser.process(app);
|
||||
parser.process( app );
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
|
||||
if ( args.count() != 1 )
|
||||
parser.showHelp( 1 );
|
||||
|
||||
|
||||
Button* button = new Button( args[0] );
|
||||
auto button = new Button( args[ 0 ] );
|
||||
QObject::connect( button, &Button::clicked, button, &Button::run );
|
||||
|
||||
auto box = new QskLinearBox();
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@
|
|||
#include "ButtonBox.h"
|
||||
#include <QskPushButton.h>
|
||||
|
||||
ButtonBox::ButtonBox( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Horizontal, parent )
|
||||
ButtonBox::ButtonBox( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Horizontal, parent )
|
||||
{
|
||||
setObjectName( "ButtonBox" );
|
||||
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
}
|
||||
|
||||
void ButtonBox::addButton( const QString& text,
|
||||
std::function< void() > func, bool autoRepeat )
|
||||
void ButtonBox::addButton(
|
||||
const QString& text, std::function< void() > func, bool autoRepeat )
|
||||
{
|
||||
QskPushButton* button = new QskPushButton( text );
|
||||
button->setAutoRepeat( autoRepeat );
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
class ButtonBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ButtonBox( QQuickItem* parent = nullptr );
|
||||
|
||||
void addButton( const QString& text,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace
|
|||
{
|
||||
class Control final : public QskControl
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Control( const char* colorName, QQuickItem* parent = nullptr );
|
||||
Control( const char* colorName, qreal aspectRatio, QQuickItem* parent = nullptr );
|
||||
|
||||
|
|
@ -24,25 +24,25 @@ namespace
|
|||
|
||||
void transpose();
|
||||
|
||||
private:
|
||||
private:
|
||||
qreal m_aspectRatio;
|
||||
};
|
||||
|
||||
class Box : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr );
|
||||
|
||||
void flip();
|
||||
|
||||
private:
|
||||
private:
|
||||
void addControl( Control* );
|
||||
};
|
||||
}
|
||||
|
||||
Control::Control( const char* colorName, QQuickItem* parent ):
|
||||
QskControl( parent ),
|
||||
m_aspectRatio( 1.0 )
|
||||
Control::Control( const char* colorName, QQuickItem* parent )
|
||||
: QskControl( parent )
|
||||
, m_aspectRatio( 1.0 )
|
||||
{
|
||||
setObjectName( colorName );
|
||||
|
||||
|
|
@ -52,15 +52,15 @@ Control::Control( const char* colorName, QQuickItem* parent ):
|
|||
setPreferredSize( 80, 100 );
|
||||
}
|
||||
|
||||
Control::Control( const char* colorName, qreal aspectRatio, QQuickItem* parent ):
|
||||
QskControl( parent ),
|
||||
m_aspectRatio( aspectRatio )
|
||||
Control::Control( const char* colorName, qreal aspectRatio, QQuickItem* parent )
|
||||
: QskControl( parent )
|
||||
, m_aspectRatio( aspectRatio )
|
||||
{
|
||||
setObjectName( colorName );
|
||||
|
||||
setBackgroundColor( colorName );
|
||||
|
||||
//setSizePolicy( QskSizePolicy::Constrained, QskSizePolicy::Ignored );
|
||||
// setSizePolicy( QskSizePolicy::Constrained, QskSizePolicy::Ignored );
|
||||
setSizePolicy( QskSizePolicy::Constrained, QskSizePolicy::Fixed );
|
||||
setPreferredHeight( 100 );
|
||||
}
|
||||
|
|
@ -83,8 +83,8 @@ void Control::transpose()
|
|||
setSizePolicy( sizePolicy().verticalPolicy(), sizePolicy().horizontalPolicy() );
|
||||
}
|
||||
|
||||
Box::Box( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Horizontal, 2, parent )
|
||||
Box::Box( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Horizontal, 2, parent )
|
||||
{
|
||||
setObjectName( "Box" );
|
||||
|
||||
|
|
@ -122,8 +122,8 @@ void Box::addControl( Control* control )
|
|||
addItem( control, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
DynamicConstraintsPage::DynamicConstraintsPage( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Vertical, parent )
|
||||
DynamicConstraintsPage::DynamicConstraintsPage( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
{
|
||||
setMargins( 10 );
|
||||
setBackgroundColor( QskRgbValue::LightSteelBlue );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class DynamicConstraintsPage : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
DynamicConstraintsPage( QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,21 +4,21 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "FlowLayoutPage.h"
|
||||
#include "TestRectangle.h"
|
||||
#include "ButtonBox.h"
|
||||
#include "TestRectangle.h"
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Box : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, 5, parent )
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, 5, parent )
|
||||
{
|
||||
setObjectName( "Box" );
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ namespace
|
|||
setDimension( dimension() + count );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void addRectangle( const char* colorName )
|
||||
{
|
||||
TestRectangle* rect = new TestRectangle( colorName );
|
||||
|
|
@ -82,8 +82,8 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
FlowLayoutPage::FlowLayoutPage( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Vertical, parent )
|
||||
FlowLayoutPage::FlowLayoutPage( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
{
|
||||
setMargins( 10 );
|
||||
setBackgroundColor( QskRgbValue::LightSteelBlue );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class FlowLayoutPage : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
FlowLayoutPage( QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "LinearLayoutPage.h"
|
||||
#include "TestRectangle.h"
|
||||
#include "ButtonBox.h"
|
||||
#include "TestRectangle.h"
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskLinearBox.h>
|
||||
|
|
@ -15,9 +15,9 @@ namespace
|
|||
{
|
||||
class Box : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, parent )
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, parent )
|
||||
{
|
||||
setObjectName( "Box" );
|
||||
|
||||
|
|
@ -35,10 +35,10 @@ namespace
|
|||
addRectangle( "FireBrick" );
|
||||
addRectangle( "DarkRed" );
|
||||
|
||||
//setRowSpacing( 5, 30 );
|
||||
// setRowSpacing( 5, 30 );
|
||||
insertSpacer( 5, 30 );
|
||||
//insertStretch( 5, 2 );
|
||||
//setRetainSizeWhenHidden( 2, true );
|
||||
// insertStretch( 5, 2 );
|
||||
// setRetainSizeWhenHidden( 2, true );
|
||||
}
|
||||
|
||||
void mirror()
|
||||
|
|
@ -69,8 +69,7 @@ namespace
|
|||
setSpacing( this->spacing() + spacing );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
void addRectangle( const char* colorName )
|
||||
{
|
||||
TestRectangle* rect = new TestRectangle( colorName );
|
||||
|
|
@ -81,8 +80,8 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
LinearLayoutPage::LinearLayoutPage( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Vertical, parent )
|
||||
LinearLayoutPage::LinearLayoutPage( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
{
|
||||
setMargins( 10 );
|
||||
setBackgroundColor( QskRgbValue::LightSteelBlue );
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class LinearLayoutPage : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
LinearLayoutPage( QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,23 +4,23 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "StackLayoutPage.h"
|
||||
#include "TestRectangle.h"
|
||||
#include "ButtonBox.h"
|
||||
#include "TestRectangle.h"
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskPageIndicator.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskStackBox.h>
|
||||
#include <QskStackBoxAnimator.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Box : public QskStackBox
|
||||
{
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr ):
|
||||
QskStackBox( parent )
|
||||
public:
|
||||
Box( QQuickItem* parent = nullptr )
|
||||
: QskStackBox( parent )
|
||||
{
|
||||
setObjectName( "StackBox" );
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
void incrementFading( int offset )
|
||||
{
|
||||
auto animator = dynamic_cast< QskStackBoxAnimator3* >( this->animator() );
|
||||
|
|
@ -73,7 +73,7 @@ namespace
|
|||
setCurrentIndex( incrementedIndex( offset ) );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void addRectangle( const char* colorName )
|
||||
{
|
||||
auto rect = new TestRectangle( colorName );
|
||||
|
|
@ -96,8 +96,8 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
StackLayoutPage::StackLayoutPage( QQuickItem* parent ):
|
||||
QskLinearBox( Qt::Vertical, parent )
|
||||
StackLayoutPage::StackLayoutPage( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
{
|
||||
setObjectName( "StackLayoutPage" );
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class StackLayoutPage : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
StackLayoutPage( QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#include <QskAspect.h>
|
||||
|
||||
TestRectangle::TestRectangle( const char* colorName, QQuickItem* parent ):
|
||||
QskTextLabel( parent )
|
||||
TestRectangle::TestRectangle( const char* colorName, QQuickItem* parent )
|
||||
: QskTextLabel( parent )
|
||||
{
|
||||
setObjectName( colorName );
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
class TestRectangle : public QskTextLabel
|
||||
{
|
||||
public:
|
||||
public:
|
||||
TestRectangle( const char* colorName, QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,31 +3,31 @@
|
|||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "DynamicConstraintsPage.h"
|
||||
#include "FlowLayoutPage.h"
|
||||
#include "LinearLayoutPage.h"
|
||||
#include "DynamicConstraintsPage.h"
|
||||
#include "StackLayoutPage.h"
|
||||
|
||||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskTextOptions.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
class DummyLabel : public QskTextLabel
|
||||
{
|
||||
public:
|
||||
DummyLabel( const QString& text, QQuickItem* parent = nullptr ):
|
||||
QskTextLabel( text, parent )
|
||||
public:
|
||||
DummyLabel( const QString& text, QQuickItem* parent = nullptr )
|
||||
: QskTextLabel( text, parent )
|
||||
{
|
||||
setBackgroundColor( Qt::black );
|
||||
setTextColor( Qt::white );
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskSimpleListBox.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskAspect.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QFontMetricsF>
|
||||
#include <QGuiApplication>
|
||||
|
||||
class ListBox : public QskSimpleListBox
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ListBox()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
|
@ -31,7 +31,8 @@ public:
|
|||
|
||||
setSelectedRow( 5 );
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
void populate()
|
||||
{
|
||||
const QString format( "Row %1: The quick brown fox jumps over the lazy dog" );
|
||||
|
|
|
|||
|
|
@ -6,23 +6,23 @@
|
|||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QFontDatabase>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskDialog.h>
|
||||
#include <QskStandardSymbol.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskStandardSymbol.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
class Button : public QskPushButton
|
||||
{
|
||||
public:
|
||||
Button( const QString& text, QQuickItem* parent = nullptr ):
|
||||
QskPushButton( text, parent )
|
||||
public:
|
||||
Button( const QString& text, QQuickItem* parent = nullptr )
|
||||
: QskPushButton( text, parent )
|
||||
{
|
||||
setObjectName( text );
|
||||
setSizePolicy( QskSizePolicy::MinimumExpanding,
|
||||
|
|
@ -32,9 +32,9 @@ public:
|
|||
|
||||
class ButtonBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
ButtonBox( QQuickItem* parent = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, 2, parent )
|
||||
public:
|
||||
ButtonBox( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, 2, parent )
|
||||
{
|
||||
setObjectName( "ButtonBox" );
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
connect( selectButton, &Button::clicked, this, &ButtonBox::execSelection );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void execMessage()
|
||||
{
|
||||
qDebug() << qskDialog->message( "Message", "Request vector, over.",
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,34 +5,34 @@
|
|||
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include <QskGraphic.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskGraphicIO.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskGraphicIO.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskSetup.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskTabView.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QVariant>
|
||||
|
||||
class GraphicLabel : public QskGraphicLabel
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum Role
|
||||
{
|
||||
Normal,
|
||||
Inverted
|
||||
};
|
||||
|
||||
GraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ):
|
||||
QskGraphicLabel( graphic, parent )
|
||||
GraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr )
|
||||
: QskGraphicLabel( graphic, parent )
|
||||
{
|
||||
setAlignment( Qt::AlignCenter );
|
||||
setAutoFillBackground( true );
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ class MainWindow : public QskWindow
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void setDarknessMode( bool on );
|
||||
void setGraphicRoles( QskSkin* );
|
||||
|
||||
private:
|
||||
private:
|
||||
QskTabView* m_tabView;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
#include "Slider.h"
|
||||
#include "SliderSkinlet.h"
|
||||
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
QSK_SUBCONTROL( Slider, Scale )
|
||||
QSK_SUBCONTROL( Slider, Decoration )
|
||||
|
||||
Slider::Slider( QQuickItem* parentItem ):
|
||||
QskSlider( parentItem )
|
||||
Slider::Slider( QQuickItem* parentItem )
|
||||
: QskSlider( parentItem )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Slider : public QskSlider
|
|||
{
|
||||
using Inherited = QskSlider;
|
||||
|
||||
public:
|
||||
public:
|
||||
QSK_SUBCONTROLS( Scale, Decoration )
|
||||
|
||||
Slider( QQuickItem* parent = nullptr );
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
#include "Slider.h"
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTextColors.h>
|
||||
#include <QskTextNode.h>
|
||||
#include <QskTextOptions.h>
|
||||
#include <QskTextColors.h>
|
||||
|
||||
#include <QSGFlatColorMaterial>
|
||||
#include <QFontMetricsF>
|
||||
#include <QSGFlatColorMaterial>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -30,9 +30,9 @@ static QFont qskLabelFont;
|
|||
|
||||
class TicksNode : public QSGGeometryNode
|
||||
{
|
||||
public:
|
||||
TicksNode( const QColor& color ):
|
||||
m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
public:
|
||||
TicksNode( const QColor& color )
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
|
|
@ -43,16 +43,16 @@ public:
|
|||
setMaterial( &m_material );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
QSGFlatColorMaterial m_material;
|
||||
QSGGeometry m_geometry;
|
||||
};
|
||||
|
||||
class HandleNode : public QSGGeometryNode
|
||||
{
|
||||
public:
|
||||
HandleNode():
|
||||
m_geometry( QSGGeometry::defaultAttributes_Point2D(), 8 * 2 )
|
||||
public:
|
||||
HandleNode()
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 8 * 2 )
|
||||
{
|
||||
setGeometry( &m_geometry );
|
||||
setMaterial( &m_material );
|
||||
|
|
@ -93,14 +93,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
inline void setLine( QSGGeometry::Point2D* points, float x1, float x2, qreal y )
|
||||
{
|
||||
points[0].x = x1;
|
||||
points[0].y = y;
|
||||
points[ 0 ].x = x1;
|
||||
points[ 0 ].y = y;
|
||||
|
||||
points[1].x = x2;
|
||||
points[1].y = y;
|
||||
points[ 1 ].x = x2;
|
||||
points[ 1 ].y = y;
|
||||
}
|
||||
|
||||
QRectF m_rect;
|
||||
|
|
@ -121,8 +121,8 @@ SliderSkinlet::~SliderSkinlet()
|
|||
{
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
QskAspect::Subcontrol subControl ) const
|
||||
QRectF SliderSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto slider = static_cast< const QskSlider* >( skinnable );
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ QSGNode* SliderSkinlet::updateSubNode(
|
|||
{
|
||||
const auto slider = static_cast< const QskSlider* >( skinnable );
|
||||
|
||||
switch( nodeRole )
|
||||
switch ( nodeRole )
|
||||
{
|
||||
case ScaleRole:
|
||||
return updateScaleNode( slider, node );
|
||||
|
|
@ -251,8 +251,8 @@ QSGNode* SliderSkinlet::updateScaleNode(
|
|||
// Create a series of tickmarks from minimum to maximum
|
||||
for ( int i = 0; i < tickCount; ++i )
|
||||
{
|
||||
vertexData[0].set( x, y );
|
||||
vertexData[1].set( x, y - ( ( i % 10 ) ? qskMinorTick : qskMajorTick ) );
|
||||
vertexData[ 0 ].set( x, y );
|
||||
vertexData[ 1 ].set( x, y - ( ( i % 10 ) ? qskMinorTick : qskMajorTick ) );
|
||||
|
||||
vertexData += 2;
|
||||
x += stepStride;
|
||||
|
|
@ -333,7 +333,7 @@ QSGNode* SliderSkinlet::updateHandleNode(
|
|||
|
||||
// finally the value label
|
||||
auto labelNode = static_cast< QskTextNode* >( handleNode->firstChild() );
|
||||
if ( labelNode == nullptr )
|
||||
if ( labelNode == nullptr )
|
||||
{
|
||||
labelNode = new QskTextNode;
|
||||
handleNode->appendChildNode( labelNode );
|
||||
|
|
@ -349,9 +349,8 @@ QSGNode* SliderSkinlet::updateHandleNode(
|
|||
|
||||
const QString text = QString::number( slider->value(), 'f', 0 );
|
||||
|
||||
labelNode->setTextData( slider, text, textRect,
|
||||
font, QskTextOptions(), QskTextColors( Qt::white ),
|
||||
Qt::AlignHCenter, Qsk::Normal );
|
||||
labelNode->setTextData( slider, text, textRect, font, QskTextOptions(),
|
||||
QskTextColors( Qt::white ), Qt::AlignHCenter, Qsk::Normal );
|
||||
|
||||
return handleNode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class SliderSkinlet : public QskSliderSkinlet
|
|||
{
|
||||
using Inherited = QskSliderSkinlet;
|
||||
|
||||
public:
|
||||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
// we have a scale instead of a groove
|
||||
|
|
@ -28,11 +28,11 @@ public:
|
|||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode(
|
||||
const QskSkinnable*, quint8 nodeRole, QSGNode* ) const override;
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
QSGNode* updateScaleNode( const QskSlider*, QSGNode* ) const;
|
||||
QSGNode* updateDecorationNode( const QskSlider*, QSGNode* ) const;
|
||||
QSGNode* updateHandleNode( const QskSlider*, QSGNode* ) const;
|
||||
|
|
|
|||
|
|
@ -9,31 +9,31 @@
|
|||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QtMath>
|
||||
|
||||
class OtherSlider : public QskSlider
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/*
|
||||
Slider overriding many hints from the skin.
|
||||
"Preserved" is for horizontal, "Transposed" for vertical orientation
|
||||
*/
|
||||
|
||||
OtherSlider( QQuickItem* parentItem = nullptr ):
|
||||
QskSlider( parentItem )
|
||||
OtherSlider( QQuickItem* parentItem = nullptr )
|
||||
: QskSlider( parentItem )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using namespace QskRgbValue;
|
||||
|
|
@ -79,13 +79,13 @@ public:
|
|||
const Aspect aspect = Fill | placement;
|
||||
setMetric( aspect | Size, 0 );
|
||||
}
|
||||
|
||||
|
||||
// Handle
|
||||
|
||||
for ( auto placement : { Preserved, Transposed } )
|
||||
{
|
||||
const Aspect aspect = Handle | placement;
|
||||
|
||||
|
||||
setBoxBorderMetricsHint( aspect, 1 );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
|
||||
|
|
@ -107,9 +107,9 @@ public:
|
|||
|
||||
class SliderBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
SliderBox( QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Vertical, parentItem )
|
||||
public:
|
||||
SliderBox( QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Vertical, parentItem )
|
||||
{
|
||||
auto slider = new QskSlider( this );
|
||||
slider->setMinimum( 0 );
|
||||
|
|
@ -118,7 +118,7 @@ public:
|
|||
slider->setStepSize( 10 );
|
||||
slider->setSnap( true );
|
||||
|
||||
(void) new QskSeparator( Qt::Horizontal, this );
|
||||
( void ) new QskSeparator( Qt::Horizontal, this );
|
||||
|
||||
auto otherSlider = new OtherSlider( this );
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ public:
|
|||
{
|
||||
if ( QskSlider* slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) )
|
||||
{
|
||||
slider->setObjectName( "Slider " + QString::number(i + 1) );
|
||||
slider->setObjectName( "Slider " + QString::number( i + 1 ) );
|
||||
slider->setValue( slider->minimum() +
|
||||
0.5 * ( slider->maximum() - slider->minimum() ) );
|
||||
#if 0
|
||||
|
|
@ -177,7 +177,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Qt::Orientation inverted( Qt::Orientation orientation ) const
|
||||
{
|
||||
return ( orientation == Qt::Horizontal ) ? Qt::Vertical : Qt::Horizontal;
|
||||
|
|
|
|||
|
|
@ -7,24 +7,24 @@
|
|||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
class Label : public QskTextLabel
|
||||
{
|
||||
public:
|
||||
Label( const QString& text, QQuickItem* parent = nullptr ):
|
||||
QskTextLabel( text, parent )
|
||||
public:
|
||||
Label( const QString& text, QQuickItem* parent = nullptr )
|
||||
: QskTextLabel( text, parent )
|
||||
{
|
||||
setTextColor( Qt::darkRed );
|
||||
setFontRole( QskSkin::LargeFont );
|
||||
|
|
@ -34,9 +34,9 @@ public:
|
|||
|
||||
class TabView : public QskTabView
|
||||
{
|
||||
public:
|
||||
TabView( QQuickItem* parent = nullptr ):
|
||||
QskTabView( parent )
|
||||
public:
|
||||
TabView( QQuickItem* parent = nullptr )
|
||||
: QskTabView( parent )
|
||||
{
|
||||
for ( int i = 0; i < 6; i++ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@
|
|||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include <SkinnyShortcut.h>
|
||||
#include <SkinnyShapeFactory.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskScrollArea.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskScrollArea.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QPainter>
|
||||
|
|
@ -50,7 +50,7 @@ static QColor randomColor()
|
|||
"DarkSlateGray"
|
||||
};
|
||||
|
||||
const int index = qrand() % int( ( sizeof( colors ) / sizeof( colors[0] ) ) );
|
||||
const int index = qrand() % int( ( sizeof( colors ) / sizeof( colors[ 0 ] ) ) );
|
||||
return QColor( colors[ index ] );
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ static int randomShape()
|
|||
|
||||
class Thumbnail : public QskPushButton
|
||||
{
|
||||
public:
|
||||
Thumbnail( const QColor& color, int shape, QQuickItem* parentItem ):
|
||||
QskPushButton( parentItem )
|
||||
public:
|
||||
Thumbnail( const QColor& color, int shape, QQuickItem* parentItem )
|
||||
: QskPushButton( parentItem )
|
||||
{
|
||||
using namespace SkinnyShapeFactory;
|
||||
|
||||
|
|
@ -92,9 +92,9 @@ public:
|
|||
|
||||
class IconGrid : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
IconGrid( QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Horizontal, gridSize, parentItem )
|
||||
public:
|
||||
IconGrid( QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, gridSize, parentItem )
|
||||
{
|
||||
setMargins( 20 );
|
||||
setSpacing( 20 );
|
||||
|
|
@ -102,16 +102,16 @@ public:
|
|||
for ( int col = 0; col < gridSize; col++ )
|
||||
{
|
||||
for ( int row = 0; row < gridSize; row++ )
|
||||
(void) new Thumbnail( randomColor(), randomShape(), this );
|
||||
( void ) new Thumbnail( randomColor(), randomShape(), this );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ScrollArea : public QskScrollArea
|
||||
{
|
||||
public:
|
||||
ScrollArea( QQuickItem* parentItem = nullptr ) :
|
||||
QskScrollArea( parentItem )
|
||||
public:
|
||||
ScrollArea( QQuickItem* parentItem = nullptr )
|
||||
: QskScrollArea( parentItem )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
|
|
@ -146,10 +146,10 @@ int main( int argc, char* argv[] )
|
|||
with QskListView.
|
||||
|
||||
The thumbnails are implemented as buttons, so that we can see if the gesture
|
||||
recognition for the flicking works without stopping the buttons from being functional.
|
||||
recognition for the flicking works without stopping the buttons from being functional.
|
||||
|
||||
This example also shows, that blocking of the scene graph node creation
|
||||
( QskControl::DeferredUpdate + QskControl::CleanupOnVisibility )
|
||||
( QskControl::DeferredUpdate + QskControl::CleanupOnVisibility )
|
||||
could be improved to also respect being inside the window or a clip region.
|
||||
|
||||
But here we only want to demonstrate how QskScrollArea works.
|
||||
|
|
@ -161,8 +161,8 @@ int main( int argc, char* argv[] )
|
|||
auto buttonBox = new QskLinearBox( Qt::Horizontal, box );
|
||||
buttonBox->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
|
||||
|
||||
new QskPushButton( "Push Me", buttonBox );
|
||||
new QskPushButton( "Push Me", buttonBox );
|
||||
new QskPushButton( "Push Me", buttonBox );
|
||||
new QskPushButton( "Push Me", buttonBox );
|
||||
|
||||
auto scrollArea = new ScrollArea( box );
|
||||
scrollArea->setMargins( QMarginsF( 25, 25, 5, 5 ) );
|
||||
|
|
|
|||
|
|
@ -6,25 +6,25 @@
|
|||
#include <SkinnyFont.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskObjectCounter.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
class TextBox: public QskLinearBox
|
||||
class TextBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
TextBox( QQuickItem* parent = nullptr ):
|
||||
QskLinearBox( Qt::Vertical, 3, parent )
|
||||
public:
|
||||
TextBox( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Vertical, 3, parent )
|
||||
{
|
||||
const QStringList texts = { "Default", "Tiny", "Small",
|
||||
"Medium", "Large", "Huge" };
|
||||
const QStringList texts =
|
||||
{ "Default", "Tiny", "Small", "Medium", "Large", "Huge" };
|
||||
|
||||
for ( int i = 0; i < texts.size(); i++ )
|
||||
{
|
||||
auto label = new QskTextLabel( texts[i] + " Font", this );
|
||||
auto label = new QskTextLabel( texts[ i ] + " Font", this );
|
||||
label->setFontRole( i );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
class QskHunspellTextPredictor::PrivateData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Hunhandle* hunspellHandle;
|
||||
QVector< QString > candidates;
|
||||
};
|
||||
|
||||
QskHunspellTextPredictor::QskHunspellTextPredictor( QObject* object ):
|
||||
Inherited( Words, object ),
|
||||
m_data( new PrivateData() )
|
||||
QskHunspellTextPredictor::QskHunspellTextPredictor( QObject* object )
|
||||
: Inherited( Words, object )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
#if 1
|
||||
// TODO: loading the language specific one depending on the locale
|
||||
|
|
@ -58,11 +58,11 @@ void QskHunspellTextPredictor::request( const QString& text )
|
|||
QVector< QString > candidates;
|
||||
candidates.reserve( count );
|
||||
|
||||
for( int i = 0; i < count; i++ )
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
const QString suggestion = QString::fromUtf8( suggestions[i] ); // ### encoding?
|
||||
const QString suggestion = QString::fromUtf8( suggestions[ i ] ); // ### encoding?
|
||||
|
||||
if( suggestion.startsWith( text ) )
|
||||
if ( suggestion.startsWith( text ) )
|
||||
candidates.prepend( suggestion );
|
||||
else
|
||||
candidates.append( suggestion );
|
||||
|
|
|
|||
|
|
@ -13,18 +13,18 @@ class QSK_EXPORT QskHunspellTextPredictor : public QskTextPredictor
|
|||
{
|
||||
using Inherited = QskTextPredictor;
|
||||
|
||||
public:
|
||||
public:
|
||||
QskHunspellTextPredictor( QObject* = nullptr );
|
||||
~QskHunspellTextPredictor() override;
|
||||
|
||||
int candidateCount() const override;
|
||||
QString candidate( int pos ) const override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void request( const QString& ) override;
|
||||
void reset() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include <qpa/qplatforminputcontextplugin_p.h>
|
||||
#include <qpa/qplatforminputcontext.h>
|
||||
#include <qpa/qplatforminputcontextplugin_p.h>
|
||||
|
||||
#include "QskInputContext.h"
|
||||
|
||||
|
|
@ -14,15 +14,15 @@
|
|||
#include "QskHunspellTextPredictor.h"
|
||||
#endif
|
||||
|
||||
#include <QEvent>
|
||||
#include <QLocale>
|
||||
#include <QRectF>
|
||||
#include <QEvent>
|
||||
|
||||
namespace
|
||||
{
|
||||
class InputContextFactory : public QskInputContextFactory
|
||||
{
|
||||
public:
|
||||
public:
|
||||
virtual QskTextPredictor* createPredictor( const QLocale& locale ) const
|
||||
{
|
||||
#if HUNSPELL
|
||||
|
|
@ -49,7 +49,7 @@ class QskPlatformInputContext final : public QPlatformInputContext
|
|||
|
||||
using Inherited = QPlatformInputContext;
|
||||
|
||||
public:
|
||||
public:
|
||||
QskPlatformInputContext();
|
||||
virtual ~QskPlatformInputContext() = default;
|
||||
|
||||
|
|
@ -80,10 +80,10 @@ public:
|
|||
|
||||
bool filterEvent( const QEvent* ) override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
bool event( QEvent* ) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void updateContext();
|
||||
void updateLocale();
|
||||
|
||||
|
|
@ -129,13 +129,13 @@ void QskPlatformInputContext::updateLocale()
|
|||
{
|
||||
const auto oldLocale = m_locale;
|
||||
m_locale = m_context->locale();
|
||||
|
||||
|
||||
if ( oldLocale != m_locale )
|
||||
emitLocaleChanged();
|
||||
|
||||
|
||||
if ( m_locale.textDirection() != oldLocale.textDirection() )
|
||||
emitInputDirectionChanged( m_locale.textDirection() );
|
||||
}
|
||||
emitInputDirectionChanged( m_locale.textDirection() );
|
||||
}
|
||||
}
|
||||
|
||||
bool QskPlatformInputContext::isValid() const
|
||||
|
|
@ -165,7 +165,7 @@ void QskPlatformInputContext::update(
|
|||
void QskPlatformInputContext::invokeAction(
|
||||
QInputMethod::Action action, int cursorPosition )
|
||||
{
|
||||
if ( m_context )
|
||||
if ( m_context )
|
||||
m_context->invokeAction( action, cursorPosition );
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ bool QskPlatformInputContext::filterEvent( const QEvent* )
|
|||
|
||||
bool QskPlatformInputContext::event( QEvent* event )
|
||||
{
|
||||
switch( event->type() )
|
||||
switch ( event->type() )
|
||||
{
|
||||
case QEvent::LocaleChange:
|
||||
{
|
||||
|
|
@ -270,7 +270,7 @@ class QskInputContextPlugin final : public QPlatformInputContextPlugin
|
|||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA( IID QPlatformInputContextFactoryInterface_iid FILE "metadata.json" )
|
||||
|
||||
public:
|
||||
public:
|
||||
QPlatformInputContext* create(
|
||||
const QString& system, const QStringList& ) override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@
|
|||
|
||||
#include "pinyinime.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
class QskPinyinTextPredictor::PrivateData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
QStringList candidates;
|
||||
};
|
||||
|
||||
QskPinyinTextPredictor::QskPinyinTextPredictor( QObject* parent ):
|
||||
Inherited( Attributes(), parent ),
|
||||
m_data( new PrivateData )
|
||||
QskPinyinTextPredictor::QskPinyinTextPredictor( QObject* parent )
|
||||
: Inherited( Attributes(), parent )
|
||||
, m_data( new PrivateData )
|
||||
{
|
||||
#if 1
|
||||
const char dictionary[] = "XXX/3rdparty/pinyin/data/dict_pinyin.dat";
|
||||
|
|
@ -28,7 +28,7 @@ QskPinyinTextPredictor::QskPinyinTextPredictor( QObject* parent ):
|
|||
// ### prevent having 2 calls to im_open_decoder by using a singleton or so
|
||||
bool opened = ime_pinyin::im_open_decoder( dictionary, "" );
|
||||
|
||||
if( !opened )
|
||||
if ( !opened )
|
||||
{
|
||||
qWarning() << "could not open pinyin decoder dictionary at" << dictionary;
|
||||
}
|
||||
|
|
@ -70,21 +70,20 @@ void QskPinyinTextPredictor::request( const QString& text )
|
|||
size_t count = ime_pinyin::im_search(
|
||||
bytes.constData(), size_t( bytes.length() ) );
|
||||
|
||||
if( count <= 0 )
|
||||
if ( count <= 0 )
|
||||
return;
|
||||
|
||||
const size_t maxCount = 20;
|
||||
if ( count > maxCount )
|
||||
if ( count > maxCount )
|
||||
count = maxCount;
|
||||
|
||||
QVector< QChar > candidateBuffer;
|
||||
candidateBuffer.resize( ime_pinyin::kMaxSearchSteps + 1 );
|
||||
|
||||
|
||||
QStringList candidates;
|
||||
candidates.reserve( count );
|
||||
|
||||
for( unsigned int i = 0; i < count; i++ )
|
||||
for ( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
size_t length = static_cast< size_t >( candidateBuffer.length() - 1 );
|
||||
const auto buf = reinterpret_cast< ime_pinyin::char16* >( candidateBuffer.data() );
|
||||
|
|
@ -95,7 +94,7 @@ void QskPinyinTextPredictor::request( const QString& text )
|
|||
candidateBuffer.last() = 0;
|
||||
|
||||
auto candidate = QString( candidateBuffer.data() );
|
||||
candidate = QChar( Qt::Key( candidate[0].unicode() ) );
|
||||
candidate = QChar( Qt::Key( candidate[ 0 ].unicode() ) );
|
||||
|
||||
candidates += candidate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,18 @@ class QSK_EXPORT QskPinyinTextPredictor : public QskTextPredictor
|
|||
{
|
||||
using Inherited = QskTextPredictor;
|
||||
|
||||
public:
|
||||
public:
|
||||
QskPinyinTextPredictor( QObject* = nullptr );
|
||||
~QskPinyinTextPredictor() override;
|
||||
|
||||
int candidateCount() const override;
|
||||
QString candidate( int ) const override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void request( const QString& ) override;
|
||||
void reset() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
class Image::PrivateData
|
||||
{
|
||||
public:
|
||||
PrivateData():
|
||||
sourceSizeAdjustment( false ),
|
||||
deferredUpdates( true ),
|
||||
dirtyPolish( false ),
|
||||
dirtyUpdate( false )
|
||||
public:
|
||||
PrivateData()
|
||||
: sourceSizeAdjustment( false )
|
||||
, deferredUpdates( true )
|
||||
, dirtyPolish( false )
|
||||
, dirtyUpdate( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -26,9 +26,9 @@ public:
|
|||
bool dirtyUpdate : 1;
|
||||
};
|
||||
|
||||
Image::Image( QQuickItem* parent ):
|
||||
Inherited( parent ),
|
||||
m_data( new PrivateData() )
|
||||
Image::Image( QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +124,8 @@ void Image::itemChange( QQuickItem::ItemChange change,
|
|||
}
|
||||
}
|
||||
|
||||
void Image::geometryChanged( const QRectF& newGeometry,
|
||||
const QRectF& oldGeometry )
|
||||
void Image::geometryChanged(
|
||||
const QRectF& newGeometry, const QRectF& oldGeometry )
|
||||
{
|
||||
Inherited::geometryChanged( newGeometry, oldGeometry );
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Image : public QQuickImage
|
|||
|
||||
using Inherited = QQuickImage;
|
||||
|
||||
public:
|
||||
public:
|
||||
Image( QQuickItem* parent = nullptr );
|
||||
~Image() override;
|
||||
|
||||
|
|
@ -49,16 +49,16 @@ public:
|
|||
Q_INVOKABLE virtual bool hasWidthForHeight() const;
|
||||
Q_INVOKABLE virtual qreal widthForHeight( qreal height ) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void show();
|
||||
void hide();
|
||||
void setVisible( bool );
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNALS:
|
||||
void sourceSizeAdjustmentChanged();
|
||||
void deferredUpdatesChanged();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void geometryChanged( const QRectF&, const QRectF& ) override;
|
||||
void itemChange( ItemChange, const ItemChangeData& ) override;
|
||||
void componentComplete() override;
|
||||
|
|
@ -66,7 +66,7 @@ protected:
|
|||
QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override;
|
||||
void updatePolish() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
#include <SkinnyShapeProvider.h>
|
||||
#include <SkinnyShortcut.h>
|
||||
|
||||
#include <QskModule.h>
|
||||
#include <QskGraphicImageProvider.h>
|
||||
#include <QskModule.h>
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,26 +8,26 @@
|
|||
|
||||
#include <QskDialog.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskInputContext.h>
|
||||
#include <QskInputPanel.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskInputPanel.h>
|
||||
#include <QskInputContext.h>
|
||||
|
||||
#include <QskWindow.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include <QskObjectCounter.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QFontMetricsF>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define STRING(x) STRINGIFY(x)
|
||||
#define STRINGIFY( x ) #x
|
||||
#define STRING( x ) STRINGIFY( x )
|
||||
|
||||
static inline QString nativeLocaleString( const QLocale& locale )
|
||||
{
|
||||
switch( locale.language() )
|
||||
switch ( locale.language() )
|
||||
{
|
||||
case QLocale::Bulgarian:
|
||||
return QStringLiteral( "български език" );
|
||||
|
|
@ -46,7 +46,7 @@ static inline QString nativeLocaleString( const QLocale& locale )
|
|||
|
||||
case QLocale::English:
|
||||
{
|
||||
switch( locale.country() )
|
||||
switch ( locale.country() )
|
||||
{
|
||||
case QLocale::Canada:
|
||||
case QLocale::UnitedStates:
|
||||
|
|
@ -92,7 +92,7 @@ static inline QString nativeLocaleString( const QLocale& locale )
|
|||
case QLocale::Romanian:
|
||||
return QStringLiteral( "Română" );
|
||||
|
||||
case QLocale::Russia:
|
||||
case QLocale::Russian:
|
||||
return QStringLiteral( "Русский" );
|
||||
|
||||
case QLocale::Slovenian:
|
||||
|
|
@ -114,9 +114,9 @@ static inline QString nativeLocaleString( const QLocale& locale )
|
|||
|
||||
class InputBox : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
InputBox( QQuickItem* parentItem = nullptr ):
|
||||
QskLinearBox( Qt::Vertical, parentItem )
|
||||
public:
|
||||
InputBox( QQuickItem* parentItem = nullptr )
|
||||
: QskLinearBox( Qt::Vertical, parentItem )
|
||||
{
|
||||
setExtraSpacingAt( Qt::BottomEdge | Qt::RightEdge );
|
||||
|
||||
|
|
@ -150,10 +150,10 @@ class LocaleListView final : public QskListView
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LocaleListView( QQuickItem* parentItem = nullptr ):
|
||||
QskListView( parentItem ),
|
||||
m_maxWidth( 0.0 )
|
||||
public:
|
||||
LocaleListView( QQuickItem* parentItem = nullptr )
|
||||
: QskListView( parentItem )
|
||||
, m_maxWidth( 0.0 )
|
||||
{
|
||||
for ( auto language :
|
||||
{
|
||||
|
|
@ -166,7 +166,6 @@ public:
|
|||
QLocale::Slovak, QLocale::Turkish, QLocale::Chinese
|
||||
} )
|
||||
{
|
||||
|
||||
if ( language == QLocale::English )
|
||||
{
|
||||
append( QLocale( QLocale::English, QLocale::UnitedStates ) );
|
||||
|
|
@ -227,21 +226,21 @@ public:
|
|||
|
||||
QVariant valueAt( int row, int ) const override
|
||||
{
|
||||
return m_values[row].first;
|
||||
return m_values[ row ].first;
|
||||
}
|
||||
|
||||
QLocale localeAt( int row ) const
|
||||
{
|
||||
if ( row >= 0 && row < m_values.size() )
|
||||
return m_values[row].second;
|
||||
return m_values[ row ].second;
|
||||
|
||||
return QLocale();
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNALS:
|
||||
void selected( const QLocale& );
|
||||
|
||||
private:
|
||||
private:
|
||||
inline void append( const QLocale& locale )
|
||||
{
|
||||
m_values += qMakePair( nativeLocaleString( locale ), locale );
|
||||
|
|
@ -253,7 +252,7 @@ private:
|
|||
|
||||
class Window : public QskWindow
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Window()
|
||||
{
|
||||
populate();
|
||||
|
|
@ -266,7 +265,7 @@ public:
|
|||
box->setMargins( 20 );
|
||||
|
||||
auto listView = new LocaleListView( box );
|
||||
auto inputBox = new InputBox( box );
|
||||
auto inputBox = new InputBox( box );
|
||||
|
||||
/*
|
||||
Disable Qt::ClickFocus, so that the input panel stays open
|
||||
|
|
|
|||
|
|
@ -6,31 +6,31 @@
|
|||
#include "Callback.h"
|
||||
#include <QMetaMethod>
|
||||
|
||||
Callback::Callback():
|
||||
m_context( nullptr )
|
||||
Callback::Callback()
|
||||
: m_context( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
Callback::Callback( const QObject* context, const QMetaMethod& method ):
|
||||
m_context( const_cast< QObject* >( context ) ),
|
||||
m_invokable( method )
|
||||
Callback::Callback( const QObject* context, const QMetaMethod& method )
|
||||
: m_context( const_cast< QObject* >( context ) )
|
||||
, m_invokable( method )
|
||||
{
|
||||
}
|
||||
|
||||
Callback::Callback( const QObject* context, const char* methodName ):
|
||||
Callback( context, qskMetaMethod( context, methodName ) )
|
||||
Callback::Callback( const QObject* context, const char* methodName )
|
||||
: Callback( context, qskMetaMethod( context, methodName ) )
|
||||
{
|
||||
}
|
||||
|
||||
Callback::Callback( const QObject* context, const QMetaProperty& property ):
|
||||
m_context( const_cast< QObject* >( context ) ),
|
||||
m_invokable( property )
|
||||
Callback::Callback( const QObject* context, const QMetaProperty& property )
|
||||
: m_context( const_cast< QObject* >( context ) )
|
||||
, m_invokable( property )
|
||||
{
|
||||
}
|
||||
|
||||
Callback::Callback( const QObject* context, const QskMetaFunction& function ):
|
||||
m_context( const_cast< QObject* >( context ) ),
|
||||
m_invokable( function )
|
||||
Callback::Callback( const QObject* context, const QskMetaFunction& function )
|
||||
: m_context( const_cast< QObject* >( context ) )
|
||||
, m_invokable( function )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class QObject;
|
|||
|
||||
class Callback
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Callback();
|
||||
|
||||
Callback( const QObject*, const QskMetaFunction& );
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
const QObject* context() const;
|
||||
const QskMetaInvokable& invokable() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
QObject* m_context;
|
||||
QskMetaInvokable m_invokable;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,28 +5,28 @@
|
|||
|
||||
#include "Invoker.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QMetaProperty>
|
||||
#include <QThread>
|
||||
|
||||
Invoker::Invoker( QObject* parent ):
|
||||
QObject( parent )
|
||||
Invoker::Invoker( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
void Invoker::addFunctionCall( const QObject* object,
|
||||
const QskMetaFunction& function )
|
||||
void Invoker::addFunctionCall(
|
||||
const QObject* object, const QskMetaFunction& function )
|
||||
{
|
||||
m_callbacks.append( Callback( object, function ) );
|
||||
}
|
||||
|
||||
void Invoker::addMethodCall( const QObject* object,
|
||||
const char* methodName )
|
||||
void Invoker::addMethodCall(
|
||||
const QObject* object, const char* methodName )
|
||||
{
|
||||
m_callbacks.append( Callback( object, methodName ) );
|
||||
}
|
||||
|
||||
void Invoker::addPropertyCall( const QObject* object,
|
||||
const char* property )
|
||||
void Invoker::addPropertyCall(
|
||||
const QObject* object, const char* property )
|
||||
{
|
||||
const auto metaProperty = object->metaObject()->property(
|
||||
object->metaObject()->indexOfProperty( property ) );
|
||||
|
|
@ -34,16 +34,16 @@ void Invoker::addPropertyCall( const QObject* object,
|
|||
m_callbacks.append( Callback( object, metaProperty ) );
|
||||
}
|
||||
|
||||
void Invoker::invoke( qreal realValue, int intValue,
|
||||
Qt::ConnectionType connectionType )
|
||||
void Invoker::invoke(
|
||||
qreal realValue, int intValue, Qt::ConnectionType connectionType )
|
||||
{
|
||||
QString s = QString( "S: %1 + %2" ).arg( realValue ).arg( intValue );
|
||||
|
||||
for ( auto& callback : m_callbacks )
|
||||
{
|
||||
void* args[4] = { nullptr };
|
||||
void* args[ 4 ] = { nullptr };
|
||||
|
||||
void **a = args + 1;
|
||||
void** a = args + 1;
|
||||
const auto& invokable = callback.invokable();
|
||||
|
||||
for ( int i = 0; i < invokable.parameterCount(); i++ )
|
||||
|
|
@ -70,7 +70,7 @@ void Invoker::invoke( qreal realValue, int intValue,
|
|||
}
|
||||
}
|
||||
|
||||
switch( connectionType & 0x3 )
|
||||
switch ( connectionType & 0x3 )
|
||||
{
|
||||
case Qt::DirectConnection:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
class Invoker : public QObject
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Invoker( QObject* parent = nullptr );
|
||||
|
||||
void addFunctionCall( const QskMetaFunction& );
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
void invoke( qreal d, int i, Qt::ConnectionType );
|
||||
|
||||
private:
|
||||
private:
|
||||
QVector< Callback > m_callbacks;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "Invoker.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
void debugNone1()
|
||||
{
|
||||
|
|
@ -47,9 +48,9 @@ class MyObject : public QObject
|
|||
Q_PROPERTY( qreal value WRITE setValue )
|
||||
Q_PROPERTY( QString valueString WRITE setValueString )
|
||||
|
||||
public:
|
||||
MyObject( QObject* parent = nullptr ):
|
||||
QObject( parent )
|
||||
public:
|
||||
MyObject( QObject* parent = nullptr )
|
||||
: QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ public:
|
|||
qDebug() << "setValueString" << s;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void print0( double d, int i ) const
|
||||
{
|
||||
qDebug() << "print0" << d << i;
|
||||
|
|
@ -109,11 +110,11 @@ static auto fs = []( int i, double d ) { qDebug() << i << d; };
|
|||
|
||||
class Application : public QCoreApplication
|
||||
{
|
||||
public:
|
||||
Application( int& argc, char* argv[] ):
|
||||
QCoreApplication( argc, argv ),
|
||||
m_object( new MyObject() ),
|
||||
m_thread( new QThread( this ) )
|
||||
public:
|
||||
Application( int& argc, char* argv[] )
|
||||
: QCoreApplication( argc, argv )
|
||||
, m_object( new MyObject() )
|
||||
, m_thread( new QThread( this ) )
|
||||
{
|
||||
#if 1
|
||||
m_invoker.addPropertyCall( m_object, "number" );
|
||||
|
|
@ -124,7 +125,7 @@ public:
|
|||
#if 1
|
||||
m_invoker.addMethodCall( m_object, "print0(double,int)" );
|
||||
m_invoker.addMethodCall( m_object, "print1(double,int)" );
|
||||
m_invoker.addMethodCall( m_object, SLOT(print2(int,double)) );
|
||||
m_invoker.addMethodCall( m_object, SLOT( print2( int, double ) ) );
|
||||
m_invoker.addMethodCall( m_object, "print3(double)" );
|
||||
m_invoker.addMethodCall( m_object, "print4(int)" );
|
||||
m_invoker.addMethodCall( m_object, "print4(int)" );
|
||||
|
|
@ -194,7 +195,7 @@ public:
|
|||
QTimer::singleShot( 10, m_thread, &QThread::quit );
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Invoker m_invoker;
|
||||
MyObject* m_object;
|
||||
QThread* m_thread;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "QskMaterialSkin.h"
|
||||
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskDialogButton.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskInputPanelBox.h>
|
||||
#include <QskListView.h>
|
||||
|
|
@ -16,24 +16,24 @@
|
|||
#include <QskSeparator.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskSubWindow.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
#include <QskSkinlet.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskNamespace.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskNamespace.h>
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
#if 1
|
||||
// should be defined in the public header, so that
|
||||
|
|
@ -55,7 +55,7 @@ namespace
|
|||
{
|
||||
class ColorPalette
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ColorPalette( const QColor base = QColor::fromRgba( QskRgbValue::Grey100 ),
|
||||
const QColor& accent = QColor::fromRgba( QskRgbValue::Blue500 ),
|
||||
const QColor& contrast = QColor::fromRgba( QskRgbValue::White ) )
|
||||
|
|
@ -95,13 +95,13 @@ namespace
|
|||
|
||||
class QskMaterialSkin::PrivateData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
|
||||
QskMaterialSkin::QskMaterialSkin( QObject* parent ):
|
||||
Inherited( parent ),
|
||||
m_data( new PrivateData() )
|
||||
QskMaterialSkin::QskMaterialSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
m_data->palette = ColorPalette( QskRgbValue::Grey100,
|
||||
QskRgbValue::Blue500, QskRgbValue::White );
|
||||
|
|
@ -190,7 +190,7 @@ void QskMaterialSkin::initTextLabelHints()
|
|||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setSkinHint( Q::Text | Alignment, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTextInputHints()
|
||||
|
|
@ -199,13 +199,13 @@ void QskMaterialSkin::initTextInputHints()
|
|||
using Q = QskTextInput;
|
||||
|
||||
setSkinHint( Q::Text | Alignment,
|
||||
static_cast<int>( Qt::AlignLeft | Qt::AlignTop ) );
|
||||
static_cast< int >( Qt::AlignLeft | Qt::AlignTop ) );
|
||||
|
||||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::PanelSelected, pal.accentColor );
|
||||
setColor( Q::TextSelected, pal.contrastColor );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::PanelSelected, pal.accentColor );
|
||||
setColor( Q::TextSelected, pal.contrastColor );
|
||||
|
||||
setMargins( Q::Panel | Padding, 5 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class QSK_EXPORT QskMaterialSkin : public QskSkin
|
|||
|
||||
using Inherited = QskSkin;
|
||||
|
||||
public:
|
||||
public:
|
||||
QskMaterialSkin( QObject* parent = nullptr );
|
||||
~QskMaterialSkin() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void resetColors( const QColor& accent ) override;
|
||||
|
||||
void initHints();
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
static const QString materialSkinName = QStringLiteral( "material" );
|
||||
|
||||
QskMaterialSkinFactory::QskMaterialSkinFactory( QObject* parent ):
|
||||
QskSkinFactory( parent )
|
||||
QskMaterialSkinFactory::QskMaterialSkinFactory( QObject* parent )
|
||||
: QskSkinFactory( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskMaterialSkinFactory : public QskSkinFactory
|
|||
Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" )
|
||||
Q_INTERFACES( QskSkinFactory )
|
||||
|
||||
public:
|
||||
public:
|
||||
QskMaterialSkinFactory( QObject* parent = nullptr );
|
||||
~QskMaterialSkinFactory() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,37 +5,37 @@
|
|||
|
||||
#include "QskSquiekSkin.h"
|
||||
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskDialogButton.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskPageIndicator.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskInputPanelBox.h>
|
||||
#include <QskInputPredictionBar.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
#include <QskScrollView.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskPageIndicator.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskScrollView.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskSubWindow.h>
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
#include <QskSkinlet.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskNamespace.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskNamespace.h>
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
static const int qskDuration = 200;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ namespace
|
|||
{
|
||||
class ColorPalette
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ColorPalette( const QColor& themeColor = QskRgbValue::Silver )
|
||||
{
|
||||
const bool isBright = themeColor.value() > 128;
|
||||
|
|
@ -112,13 +112,13 @@ namespace
|
|||
|
||||
class QskSquiekSkin::PrivateData
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
|
||||
QskSquiekSkin::QskSquiekSkin( QObject* parent ):
|
||||
Inherited( parent ),
|
||||
m_data( new PrivateData() )
|
||||
QskSquiekSkin::QskSquiekSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
initHints();
|
||||
setupFonts( "DejaVuSans" );
|
||||
|
|
@ -156,7 +156,7 @@ void QskSquiekSkin::setButton(
|
|||
QskGradient gradient;
|
||||
gradient.setOrientation( QskGradient::Vertical );
|
||||
|
||||
switch( style )
|
||||
switch ( style )
|
||||
{
|
||||
case Raised:
|
||||
{
|
||||
|
|
@ -208,12 +208,12 @@ void QskSquiekSkin::setPanel( QskAspect::Aspect aspect, PanelStyle style )
|
|||
setButton( aspect, style, 1 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setTab( QskAspect::Aspect aspect,
|
||||
Qt::Orientation orientation )
|
||||
void QskSquiekSkin::setTab( QskAspect::Aspect aspect, Qt::Orientation orientation )
|
||||
{
|
||||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setGradient( aspect, QskGradient( QskGradient::Vertical, pal.lighter125, pal.lighter150 ) );
|
||||
setGradient( aspect,
|
||||
QskGradient( QskGradient::Vertical, pal.lighter125, pal.lighter150 ) );
|
||||
setBoxBorderColors( aspect, pal.darker200 );
|
||||
|
||||
QskBoxBorderMetrics border( 1 );
|
||||
|
|
@ -298,7 +298,7 @@ void QskSquiekSkin::initTextLabelHints()
|
|||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setSkinHint( Q::Text | Alignment, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTextInputHints()
|
||||
|
|
@ -309,11 +309,11 @@ void QskSquiekSkin::initTextInputHints()
|
|||
const ColorPalette& pal = m_data->palette;
|
||||
|
||||
setSkinHint( Q::Text | Alignment,
|
||||
static_cast<int>( Qt::AlignLeft | Qt::AlignTop ) );
|
||||
static_cast< int >( Qt::AlignLeft | Qt::AlignTop ) );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::PanelSelected, pal.highlighted );
|
||||
setColor( Q::TextSelected, pal.highlightedText );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::PanelSelected, pal.highlighted );
|
||||
setColor( Q::TextSelected, pal.highlightedText );
|
||||
|
||||
setMargins( Q::Panel | Padding, 5 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class QSK_EXPORT QskSquiekSkin : public QskSkin
|
|||
|
||||
using Inherited = QskSkin;
|
||||
|
||||
public:
|
||||
public:
|
||||
QskSquiekSkin( QObject* parent = nullptr );
|
||||
~QskSquiekSkin() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void resetColors( const QColor& accent ) override;
|
||||
|
||||
void initHints();
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
static const QString squiekSkinName = QStringLiteral( "squiek" );
|
||||
|
||||
QskSquiekSkinFactory::QskSquiekSkinFactory( QObject* parent ):
|
||||
QskSkinFactory( parent )
|
||||
QskSquiekSkinFactory::QskSquiekSkinFactory( QObject* parent )
|
||||
: QskSkinFactory( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskSquiekSkinFactory : public QskSkinFactory
|
|||
Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" )
|
||||
Q_INTERFACES( QskSkinFactory )
|
||||
|
||||
public:
|
||||
public:
|
||||
QskSquiekSkinFactory( QObject* parent = nullptr );
|
||||
~QskSquiekSkinFactory() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "QskAspect.h"
|
||||
|
||||
#include <qalgorithms.h>
|
||||
#include <qdebug.h>
|
||||
#include <qmetaobject.h>
|
||||
#include <qalgorithms.h>
|
||||
#include <qvector.h>
|
||||
|
||||
#include <bitset>
|
||||
|
|
@ -57,8 +57,8 @@ QskAspect::Subcontrol QskAspect::nextSubcontrol(
|
|||
auto& names = qskAspectRegistry->subControlNames;
|
||||
auto& hashTable = qskAspectRegistry->subControlTable;
|
||||
|
||||
Q_ASSERT_X( names.size() <= LastSubcontrol,
|
||||
"QskAspect", "There are no free subcontrol aspects; please modify your"
|
||||
Q_ASSERT_X( names.size() <= LastSubcontrol, "QskAspect",
|
||||
"There are no free subcontrol aspects; please modify your"
|
||||
" application to declare fewer aspects, or increase the mask size of"
|
||||
" QskAspect::Subcontrol in QskAspect.h." );
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ QDebug operator<<( QDebug debug, const QskAspect::Aspect& aspect )
|
|||
|
||||
void qskDebugState( QDebug debug, const QMetaObject* metaObject, QskAspect::State state )
|
||||
{
|
||||
QDebugStateSaver saver(debug);
|
||||
QDebugStateSaver saver( debug );
|
||||
|
||||
debug.resetFormat();
|
||||
debug.noquote();
|
||||
|
|
@ -266,7 +266,7 @@ void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect::Asp
|
|||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
QDebugStateSaver saver(debug);
|
||||
QDebugStateSaver saver( debug );
|
||||
|
||||
debug.resetFormat();
|
||||
debug.noquote();
|
||||
|
|
@ -284,7 +284,7 @@ void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect::Asp
|
|||
if ( aspect.isAnimator() )
|
||||
debug << "(A)";
|
||||
|
||||
switch( aspect.type() )
|
||||
switch ( aspect.type() )
|
||||
{
|
||||
case Color:
|
||||
{
|
||||
|
|
@ -324,13 +324,13 @@ const char* QskAspect::Aspect::toPrintable() const
|
|||
debug << *this;
|
||||
|
||||
// we should find a better impementation
|
||||
static QByteArray bytes[10];
|
||||
static QByteArray bytes[ 10 ];
|
||||
static int counter = 0;
|
||||
|
||||
counter = ( counter + 1 ) % 10;
|
||||
|
||||
bytes[counter] = tmp.toUtf8();
|
||||
return bytes[counter].constData();
|
||||
bytes[ counter ] = tmp.toUtf8();
|
||||
return bytes[ counter ].constData();
|
||||
}
|
||||
|
||||
QskAspect::State QskAspect::Aspect::topState() const
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@
|
|||
#ifndef QSK_ASPECT_H
|
||||
#define QSK_ASPECT_H
|
||||
|
||||
#include "QskGlobal.h"
|
||||
#include "QskFlags.h"
|
||||
|
||||
#include <qmetaobject.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifdef Q_MOC_RUN
|
||||
|
|
@ -27,8 +29,8 @@ QSK_NAMESPACE( QskAspect )
|
|||
{
|
||||
enum Subcontrol : quint16
|
||||
{
|
||||
Control = 0,
|
||||
LastSubcontrol = ( 1 << 12 ) - 1
|
||||
Control = 0,
|
||||
LastSubcontrol = ( 1 << 12 ) - 1
|
||||
};
|
||||
QSK_ENUM( Subcontrol )
|
||||
|
||||
|
|
@ -93,20 +95,20 @@ QSK_NAMESPACE( QskAspect )
|
|||
Preserved = 0,
|
||||
Transposed = 1
|
||||
};
|
||||
QSK_ENUM ( Placement )
|
||||
QSK_ENUM( Placement )
|
||||
|
||||
enum State : quint16
|
||||
{
|
||||
NoState = 0,
|
||||
NoState = 0,
|
||||
|
||||
FirstSystemState = 1 << 0,
|
||||
FirstUserState = 1 << 4,
|
||||
LastUserState = 1 << 11,
|
||||
LastSystemState = 1 << 15,
|
||||
FirstSystemState = 1 << 0,
|
||||
FirstUserState = 1 << 4,
|
||||
LastUserState = 1 << 11,
|
||||
LastSystemState = 1 << 15,
|
||||
|
||||
AllStates = 0xFFFF
|
||||
AllStates = 0xFFFF
|
||||
};
|
||||
QSK_ENUM ( State )
|
||||
QSK_ENUM( State )
|
||||
|
||||
extern const QMetaObject staticMetaObject;
|
||||
}
|
||||
|
|
@ -120,7 +122,7 @@ namespace QskAspect
|
|||
{
|
||||
class QSK_EXPORT Aspect
|
||||
{
|
||||
public:
|
||||
public:
|
||||
constexpr Aspect();
|
||||
constexpr Aspect( Subcontrol );
|
||||
constexpr Aspect( Type );
|
||||
|
|
@ -175,8 +177,9 @@ namespace QskAspect
|
|||
|
||||
const char* toPrintable() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
constexpr Aspect( Subcontrol, Type, Placement );
|
||||
|
||||
constexpr Aspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states );
|
||||
|
||||
|
|
@ -202,34 +205,35 @@ namespace QskAspect
|
|||
};
|
||||
};
|
||||
|
||||
inline constexpr Aspect::Aspect():
|
||||
Aspect( Control, Flag, Preserved )
|
||||
inline constexpr Aspect::Aspect()
|
||||
: Aspect( Control, Flag, Preserved )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Subcontrol subControl ):
|
||||
Aspect( subControl, Flag, Preserved )
|
||||
inline constexpr Aspect::Aspect( Subcontrol subControl )
|
||||
: Aspect( subControl, Flag, Preserved )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Type type ):
|
||||
Aspect( Control, type, Preserved )
|
||||
inline constexpr Aspect::Aspect( Type type )
|
||||
: Aspect( Control, type, Preserved )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Placement placement ):
|
||||
Aspect( Control, Flag, placement )
|
||||
inline constexpr Aspect::Aspect( Placement placement )
|
||||
: Aspect( Control, Flag, placement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Subcontrol subControl, Type type, Placement placement ):
|
||||
Aspect( subControl, type, false, 0, placement, NoState )
|
||||
inline constexpr Aspect::Aspect(
|
||||
Subcontrol subControl, Type type, Placement placement )
|
||||
: Aspect( subControl, type, false, 0, placement, NoState )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states ):
|
||||
m_bits { subControl, type, isAnimator, primitive, placement, 0, states, 0 }
|
||||
uint primitive, uint placement, uint states )
|
||||
: m_bits { subControl, type, isAnimator, primitive, placement, 0, states, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +261,7 @@ namespace QskAspect
|
|||
inline constexpr Aspect Aspect::operator|( Type type ) const
|
||||
{
|
||||
return Aspect( m_bits.subControl, type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( FlagPrimitive primitive ) const
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static inline bool qskIsVisble( const QColor& c )
|
|||
|
||||
static inline void qskSetColors( const QColor& c, QColor* colors )
|
||||
{
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = c.toRgb();
|
||||
colors[ 0 ] = colors[ 1 ] = colors[ 2 ] = colors[ 3 ] = c.toRgb();
|
||||
}
|
||||
|
||||
static inline void qskSetColors(
|
||||
|
|
@ -58,18 +58,18 @@ QskBoxBorderColors::~QskBoxBorderColors()
|
|||
|
||||
bool QskBoxBorderColors::operator==( const QskBoxBorderColors& other ) const
|
||||
{
|
||||
return ( m_colors[0] == other.m_colors[0] )
|
||||
&& ( m_colors[1] == other.m_colors[1] )
|
||||
&& ( m_colors[2] == other.m_colors[2] )
|
||||
&& ( m_colors[3] == other.m_colors[3] );
|
||||
return ( m_colors[ 0 ] == other.m_colors[ 0 ] ) &&
|
||||
( m_colors[ 1 ] == other.m_colors[ 1 ] ) &&
|
||||
( m_colors[ 2 ] == other.m_colors[ 2 ] ) &&
|
||||
( m_colors[ 3 ] == other.m_colors[ 3 ] );
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setAlpha( int alpha )
|
||||
{
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if ( m_colors[i].isValid() && m_colors[i].alpha() )
|
||||
m_colors[i].setAlpha( alpha );
|
||||
if ( m_colors[ i ].isValid() && m_colors[ i ].alpha() )
|
||||
m_colors[ i ].setAlpha( alpha );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ void QskBoxBorderColors::setColorsAt( Qt::Edges edges, const QColor& color )
|
|||
|
||||
QColor QskBoxBorderColors::colorAt( Qt::Edge edge ) const
|
||||
{
|
||||
switch( edge )
|
||||
switch ( edge )
|
||||
{
|
||||
case Qt::TopEdge:
|
||||
return m_colors[ Qsk::Top ];
|
||||
|
|
@ -130,16 +130,16 @@ QColor QskBoxBorderColors::colorAt( Qt::Edge edge ) const
|
|||
|
||||
bool QskBoxBorderColors::isVisible() const
|
||||
{
|
||||
if ( qskIsVisble( m_colors[0] ) )
|
||||
if ( qskIsVisble( m_colors[ 0 ] ) )
|
||||
return true;
|
||||
|
||||
if ( qskIsVisble( m_colors[1] ) )
|
||||
if ( qskIsVisble( m_colors[ 1 ] ) )
|
||||
return true;
|
||||
|
||||
if ( qskIsVisble( m_colors[2] ) )
|
||||
if ( qskIsVisble( m_colors[ 2 ] ) )
|
||||
return true;
|
||||
|
||||
if ( qskIsVisble( m_colors[3] ) )
|
||||
if ( qskIsVisble( m_colors[ 3 ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -147,13 +147,13 @@ bool QskBoxBorderColors::isVisible() const
|
|||
|
||||
bool QskBoxBorderColors::isMonochrome() const
|
||||
{
|
||||
if ( m_colors[1] != m_colors[0] )
|
||||
if ( m_colors[ 1 ] != m_colors[ 0 ] )
|
||||
return false;
|
||||
|
||||
if ( m_colors[2] != m_colors[1] )
|
||||
if ( m_colors[ 2 ] != m_colors[ 1 ] )
|
||||
return false;
|
||||
|
||||
if ( m_colors[3] != m_colors[2] )
|
||||
if ( m_colors[ 3 ] != m_colors[ 2 ] )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -166,8 +166,8 @@ QskBoxBorderColors QskBoxBorderColors::interpolated(
|
|||
|
||||
for ( size_t i = 0; i < 4; i++ )
|
||||
{
|
||||
colors.m_colors[i] = QskRgbValue::interpolated(
|
||||
m_colors[i], to.m_colors[i], ratio );
|
||||
colors.m_colors[ i ] = QskRgbValue::interpolated(
|
||||
m_colors[ i ], to.m_colors[ i ], ratio );
|
||||
}
|
||||
|
||||
return colors;
|
||||
|
|
@ -183,12 +183,12 @@ uint QskBoxBorderColors::hash( uint seed ) const
|
|||
{
|
||||
const QRgb rgb[] =
|
||||
{
|
||||
m_colors[0].rgba(),
|
||||
m_colors[1].rgba(),
|
||||
m_colors[2].rgba(),
|
||||
m_colors[3].rgba(),
|
||||
m_colors[ 0 ].rgba(),
|
||||
m_colors[ 1 ].rgba(),
|
||||
m_colors[ 2 ].rgba(),
|
||||
m_colors[ 3 ].rgba(),
|
||||
};
|
||||
|
||||
|
||||
return qHashBits( rgb, sizeof( rgb ), seed );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ class QDebug;
|
|||
|
||||
class QSK_EXPORT QskBoxBorderColors
|
||||
{
|
||||
public:
|
||||
public:
|
||||
QskBoxBorderColors();
|
||||
|
||||
QskBoxBorderColors( const QColor& left, const QColor& top,
|
||||
const QColor& right, const QColor& bottom );
|
||||
|
||||
|
|
@ -54,18 +55,18 @@ public:
|
|||
bool isMonochrome() const;
|
||||
bool isVisible() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
// should be stored as QRgb
|
||||
QColor m_colors[ 4 ];
|
||||
};
|
||||
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( Qt::GlobalColor color ):
|
||||
QskBoxBorderColors( QColor( color ) )
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( Qt::GlobalColor color )
|
||||
: QskBoxBorderColors( QColor( color ) )
|
||||
{
|
||||
}
|
||||
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( QRgb rgb ):
|
||||
QskBoxBorderColors( QColor::fromRgba( rgb ) )
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( QRgb rgb )
|
||||
: QskBoxBorderColors( QColor::fromRgba( rgb ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,8 +88,9 @@ QskBoxBorderMetrics QskBoxBorderMetrics::interpolated(
|
|||
return QskBoxBorderMetrics( widths, m_sizeMode );
|
||||
}
|
||||
|
||||
QVariant QskBoxBorderMetrics::interpolate( const QskBoxBorderMetrics& from,
|
||||
const QskBoxBorderMetrics& to, qreal progress )
|
||||
QVariant QskBoxBorderMetrics::interpolate(
|
||||
const QskBoxBorderMetrics& from, const QskBoxBorderMetrics& to,
|
||||
qreal progress )
|
||||
{
|
||||
return QVariant::fromValue( from.interpolated( to, progress ) );
|
||||
}
|
||||
|
|
@ -119,4 +120,3 @@ QDebug operator<<( QDebug debug, const QskBoxBorderMetrics& metrics )
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#include "QskGlobal.h"
|
||||
#include "QskMargins.h"
|
||||
|
||||
#include <qnamespace.h>
|
||||
#include <qmetatype.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qsize.h>
|
||||
|
||||
class QDebug;
|
||||
|
|
@ -18,12 +18,17 @@ class QVariant;
|
|||
|
||||
class QSK_EXPORT QskBoxBorderMetrics
|
||||
{
|
||||
public:
|
||||
public:
|
||||
constexpr QskBoxBorderMetrics();
|
||||
constexpr QskBoxBorderMetrics( qreal width, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
constexpr QskBoxBorderMetrics(
|
||||
qreal width, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
constexpr QskBoxBorderMetrics( qreal left, qreal top,
|
||||
qreal right, qreal bottom, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
constexpr QskBoxBorderMetrics( const QskMargins& widths, Qt::SizeMode sizeMode = Qt::AbsoluteSize );
|
||||
|
||||
constexpr QskBoxBorderMetrics(
|
||||
const QskMargins& widths, Qt::SizeMode sizeMode = Qt::AbsoluteSize );
|
||||
|
||||
~QskBoxBorderMetrics();
|
||||
|
||||
|
|
@ -41,41 +46,44 @@ public:
|
|||
void setSizeMode( Qt::SizeMode );
|
||||
Qt::SizeMode sizeMode() const;
|
||||
|
||||
QskBoxBorderMetrics interpolated( const QskBoxBorderMetrics&, qreal value ) const;
|
||||
QskBoxBorderMetrics toAbsolute ( const QSizeF& ) const;
|
||||
QskBoxBorderMetrics interpolated(
|
||||
const QskBoxBorderMetrics&, qreal value ) const;
|
||||
|
||||
QskBoxBorderMetrics toAbsolute( const QSizeF& ) const;
|
||||
|
||||
uint hash( uint seed = 0 ) const;
|
||||
|
||||
static QVariant interpolate( const QskBoxBorderMetrics&,
|
||||
const QskBoxBorderMetrics&, qreal progress );
|
||||
|
||||
private:
|
||||
private:
|
||||
QskMargins m_widths;
|
||||
Qt::SizeMode m_sizeMode : 2;
|
||||
};
|
||||
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics():
|
||||
m_sizeMode( Qt::AbsoluteSize )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics( qreal width, Qt::SizeMode sizeMode ):
|
||||
m_widths( width ),
|
||||
m_sizeMode( sizeMode )
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics()
|
||||
: m_sizeMode( Qt::AbsoluteSize )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics(
|
||||
const QskMargins& widths, Qt::SizeMode sizeMode ):
|
||||
m_widths( widths ),
|
||||
m_sizeMode( sizeMode )
|
||||
qreal width, Qt::SizeMode sizeMode )
|
||||
: m_widths( width )
|
||||
, m_sizeMode( sizeMode )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics( qreal left, qreal top,
|
||||
qreal right, qreal bottom, Qt::SizeMode sizeMode ):
|
||||
m_widths( left, top, right, bottom ),
|
||||
m_sizeMode( sizeMode )
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics(
|
||||
const QskMargins& widths, Qt::SizeMode sizeMode )
|
||||
: m_widths( widths )
|
||||
, m_sizeMode( sizeMode )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskBoxBorderMetrics::QskBoxBorderMetrics(
|
||||
qreal left, qreal top, qreal right, qreal bottom, Qt::SizeMode sizeMode )
|
||||
: m_widths( left, top, right, bottom )
|
||||
, m_sizeMode( sizeMode )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ static inline qreal qskAbsoluted( qreal length, qreal percentage )
|
|||
}
|
||||
|
||||
QskBoxShapeMetrics::QskBoxShapeMetrics(
|
||||
qreal radiusX, qreal radiusY, Qt::SizeMode sizeMode ):
|
||||
m_sizeMode( sizeMode ),
|
||||
m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
qreal radiusX, qreal radiusY, Qt::SizeMode sizeMode )
|
||||
: m_sizeMode( sizeMode )
|
||||
, m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
{
|
||||
setRadius( radiusX, radiusY );
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ bool QskBoxShapeMetrics::operator==( const QskBoxShapeMetrics& other ) const
|
|||
|
||||
for ( size_t i = 0; i < 4; i++ )
|
||||
{
|
||||
if ( m_radii[i] != other.m_radii[i] )
|
||||
if ( m_radii[ i ] != other.m_radii[ i ] )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -68,8 +68,10 @@ void QskBoxShapeMetrics::setAspectRatioMode( Qt::AspectRatioMode aspectRatioMode
|
|||
}
|
||||
|
||||
void QskBoxShapeMetrics::setRadius(
|
||||
qreal topLeftX, qreal topLeftY, qreal topRightX, qreal topRightY,
|
||||
qreal bottomLeftX, qreal bottomLeftY, qreal bottomRightX, qreal bottomRightY )
|
||||
qreal topLeftX, qreal topLeftY,
|
||||
qreal topRightX, qreal topRightY,
|
||||
qreal bottomLeftX, qreal bottomLeftY,
|
||||
qreal bottomRightX, qreal bottomRightY )
|
||||
{
|
||||
m_radii[ Qt::TopLeftCorner ].setWidth( qMax( topLeftX, 0.0 ) );
|
||||
m_radii[ Qt::TopLeftCorner ].setHeight( qMax( topLeftY, 0.0 ) );
|
||||
|
|
@ -96,23 +98,23 @@ void QskBoxShapeMetrics::setRadius( Qt::Corner corner, qreal radiusX, qreal radi
|
|||
bool QskBoxShapeMetrics::isRectellipse() const
|
||||
{
|
||||
const QSizeF* r = m_radii;
|
||||
return ( r[1] == r[0] ) && ( r[2] == r[1] ) && ( r[3] == r[2] );
|
||||
return ( r[ 1 ] == r[ 0 ] ) && ( r[ 2 ] == r[ 1 ] ) && ( r[ 3 ] == r[ 2 ] );
|
||||
}
|
||||
|
||||
bool QskBoxShapeMetrics::isRectangle() const
|
||||
{
|
||||
const QSizeF* r = m_radii;
|
||||
|
||||
if ( ( r[0].width() > 0.0 ) || ( r[0].height() > 0.0 ) )
|
||||
if ( ( r[ 0 ].width() > 0.0 ) || ( r[ 0 ].height() > 0.0 ) )
|
||||
return false;
|
||||
|
||||
if ( ( r[1].width() > 0.0 ) || ( r[1].height() > 0.0 ) )
|
||||
if ( ( r[ 1 ].width() > 0.0 ) || ( r[ 1 ].height() > 0.0 ) )
|
||||
return false;
|
||||
|
||||
if ( ( r[2].width() > 0.0 ) || ( r[2].height() > 0.0 ) )
|
||||
if ( ( r[ 2 ].width() > 0.0 ) || ( r[ 2 ].height() > 0.0 ) )
|
||||
return false;
|
||||
|
||||
if ( ( r[3].width() > 0.0 ) || ( r[3].height() > 0.0 ) )
|
||||
if ( ( r[ 3 ].width() > 0.0 ) || ( r[ 3 ].height() > 0.0 ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -123,7 +125,7 @@ QskBoxShapeMetrics QskBoxShapeMetrics::rotated() const
|
|||
QskBoxShapeMetrics other;
|
||||
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
other.m_radii[i] = m_radii[i].transposed();
|
||||
other.m_radii[ i ] = m_radii[ i ].transposed();
|
||||
|
||||
other.m_sizeMode = m_sizeMode;
|
||||
|
||||
|
|
@ -151,7 +153,7 @@ QskBoxShapeMetrics QskBoxShapeMetrics::toAbsolute( const QSizeF& size ) const
|
|||
const qreal rx = qskAbsoluted( size.width(), radii.width() );
|
||||
const qreal ry = qskAbsoluted( size.height(), radii.height() );
|
||||
|
||||
switch( m_aspectRatioMode )
|
||||
switch ( m_aspectRatioMode )
|
||||
{
|
||||
case Qt::IgnoreAspectRatio:
|
||||
{
|
||||
|
|
@ -185,17 +187,17 @@ QskBoxShapeMetrics QskBoxShapeMetrics::interpolated(
|
|||
if ( ( *this == to ) || ( m_sizeMode != to.m_sizeMode ) )
|
||||
return to;
|
||||
|
||||
QSizeF radii[4];
|
||||
radii[0] = qskInterpolatedSize( m_radii[0], to.m_radii[0], ratio );
|
||||
radii[1] = qskInterpolatedSize( m_radii[1], to.m_radii[1], ratio );
|
||||
radii[2] = qskInterpolatedSize( m_radii[2], to.m_radii[2], ratio );
|
||||
radii[3] = qskInterpolatedSize( m_radii[3], to.m_radii[3], ratio );
|
||||
QSizeF radii[ 4 ];
|
||||
radii[ 0 ] = qskInterpolatedSize( m_radii[ 0 ], to.m_radii[ 0 ], ratio );
|
||||
radii[ 1 ] = qskInterpolatedSize( m_radii[ 1 ], to.m_radii[ 1 ], ratio );
|
||||
radii[ 2 ] = qskInterpolatedSize( m_radii[ 2 ], to.m_radii[ 2 ], ratio );
|
||||
radii[ 3 ] = qskInterpolatedSize( m_radii[ 3 ], to.m_radii[ 3 ], ratio );
|
||||
|
||||
return QskBoxShapeMetrics( to.m_sizeMode, radii );
|
||||
}
|
||||
|
||||
QVariant QskBoxShapeMetrics::interpolate( const QskBoxShapeMetrics& from,
|
||||
const QskBoxShapeMetrics& to, qreal progress )
|
||||
QVariant QskBoxShapeMetrics::interpolate(
|
||||
const QskBoxShapeMetrics& from, const QskBoxShapeMetrics& to, qreal progress )
|
||||
{
|
||||
return QVariant::fromValue( from.interpolated( to, progress ) );
|
||||
}
|
||||
|
|
@ -232,4 +234,3 @@ QDebug operator<<( QDebug debug, const QskBoxShapeMetrics& metrics )
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "QskGlobal.h"
|
||||
|
||||
#include <qnamespace.h>
|
||||
#include <qmetatype.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qsize.h>
|
||||
|
||||
class QVariant;
|
||||
|
|
@ -17,8 +17,9 @@ class QMarginsF;
|
|||
|
||||
class QSK_EXPORT QskBoxShapeMetrics
|
||||
{
|
||||
public:
|
||||
public:
|
||||
constexpr QskBoxShapeMetrics();
|
||||
|
||||
constexpr QskBoxShapeMetrics( qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
|
|
@ -62,8 +63,11 @@ public:
|
|||
void setAspectRatioMode( Qt::AspectRatioMode );
|
||||
Qt::AspectRatioMode aspectRatioMode() const;
|
||||
|
||||
QskBoxShapeMetrics interpolated( const QskBoxShapeMetrics&, qreal value ) const;
|
||||
QskBoxShapeMetrics toAbsolute ( const QSizeF& ) const;
|
||||
QskBoxShapeMetrics interpolated(
|
||||
const QskBoxShapeMetrics&, qreal value ) const;
|
||||
|
||||
QskBoxShapeMetrics toAbsolute( const QSizeF& ) const;
|
||||
|
||||
QskBoxShapeMetrics rotated() const;
|
||||
|
||||
QMarginsF padding( const QSizeF& ) const;
|
||||
|
|
@ -73,11 +77,11 @@ public:
|
|||
static QVariant interpolate( const QskBoxShapeMetrics&,
|
||||
const QskBoxShapeMetrics&, qreal progress );
|
||||
|
||||
private:
|
||||
inline constexpr QskBoxShapeMetrics( Qt::SizeMode sizeMode, const QSizeF radii[4] ):
|
||||
m_radii{ radii[0], radii[1], radii[2], radii[3] },
|
||||
m_sizeMode( sizeMode ),
|
||||
m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
private:
|
||||
inline constexpr QskBoxShapeMetrics( Qt::SizeMode sizeMode, const QSizeF radii[ 4 ] )
|
||||
: m_radii{ radii[ 0 ], radii[ 1 ], radii[ 2 ], radii[ 3 ] }
|
||||
, m_sizeMode( sizeMode )
|
||||
, m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -86,24 +90,24 @@ private:
|
|||
Qt::AspectRatioMode m_aspectRatioMode : 2;
|
||||
};
|
||||
|
||||
inline constexpr QskBoxShapeMetrics::QskBoxShapeMetrics():
|
||||
m_radii{ { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.0 } },
|
||||
m_sizeMode( Qt::AbsoluteSize ),
|
||||
m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
inline constexpr QskBoxShapeMetrics::QskBoxShapeMetrics()
|
||||
: m_radii{ { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.0 }, { 0.0, 0.0 } }
|
||||
, m_sizeMode( Qt::AbsoluteSize )
|
||||
, m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
{
|
||||
}
|
||||
|
||||
inline QskBoxShapeMetrics::QskBoxShapeMetrics( qreal radius, Qt::SizeMode sizeMode ):
|
||||
QskBoxShapeMetrics( radius, radius, sizeMode )
|
||||
inline QskBoxShapeMetrics::QskBoxShapeMetrics( qreal radius, Qt::SizeMode sizeMode )
|
||||
: QskBoxShapeMetrics( radius, radius, sizeMode )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskBoxShapeMetrics::QskBoxShapeMetrics( qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode sizeMode ):
|
||||
m_radii{ { topLeft, topLeft }, { topRight, topRight },
|
||||
{ bottomLeft, bottomLeft }, { bottomRight, bottomRight } },
|
||||
m_sizeMode( sizeMode ),
|
||||
m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode sizeMode )
|
||||
: m_radii{ { topLeft, topLeft }, { topRight, topRight },
|
||||
{ bottomLeft, bottomLeft }, { bottomRight, bottomRight } }
|
||||
, m_sizeMode( sizeMode )
|
||||
, m_aspectRatioMode( Qt::KeepAspectRatio )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +149,7 @@ inline void QskBoxShapeMetrics::setRadius( Qt::Corner corner, const QSizeF& radi
|
|||
}
|
||||
|
||||
inline void QskBoxShapeMetrics::setRadius(
|
||||
qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight )
|
||||
qreal topLeft, qreal topRight, qreal bottomLeft, qreal bottomRight )
|
||||
{
|
||||
setRadius( topLeft, topLeft, topRight, topRight,
|
||||
bottomLeft, bottomLeft, bottomRight, bottomRight );
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Qt::SizeMode QskCorner::sizeMode() const
|
|||
void QskCorner::setAspectRatioMode( Qt::AspectRatioMode mode )
|
||||
{
|
||||
m_metrics.setAspectRatioMode( mode );
|
||||
}
|
||||
}
|
||||
|
||||
Qt::AspectRatioMode QskCorner::aspectRatioMode() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class QSK_EXPORT QskCorner
|
|||
Q_PROPERTY( Qt::SizeMode sizeMode READ sizeMode WRITE setSizeMode )
|
||||
Q_PROPERTY( Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode )
|
||||
|
||||
public:
|
||||
public:
|
||||
QskCorner();
|
||||
QskCorner( Qt::SizeMode, qreal radius );
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
const QskBoxShapeMetrics& metrics() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
// QskCorner could be replaced by QskBoxShapeMetrics TODO ...
|
||||
QskBoxShapeMetrics m_metrics;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include "QskFunctions.h"
|
||||
|
||||
#include <qguiapplication.h>
|
||||
#include <qscreen.h>
|
||||
#include <qmath.h>
|
||||
#include <qscreen.h>
|
||||
|
||||
template< class Rect, class Value >
|
||||
static inline Rect qskAlignedRect( const Rect& outerRect,
|
||||
|
|
@ -12,7 +12,7 @@ static inline Rect qskAlignedRect( const Rect& outerRect,
|
|||
|
||||
Rect r( 0, 0, width, height );
|
||||
|
||||
switch( alignment & Qt::AlignHorizontal_Mask )
|
||||
switch ( alignment & Qt::AlignHorizontal_Mask )
|
||||
{
|
||||
case Qt::AlignLeft:
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ static inline Rect qskAlignedRect( const Rect& outerRect,
|
|||
}
|
||||
}
|
||||
|
||||
switch( alignment & Qt::AlignVertical_Mask )
|
||||
switch ( alignment & Qt::AlignVertical_Mask )
|
||||
{
|
||||
case Qt::AlignTop:
|
||||
{
|
||||
|
|
@ -86,26 +86,26 @@ QRectF qskValidOrEmptyInnerRect( const QRectF& rect, const QMarginsF& margins )
|
|||
{
|
||||
x = rect.x() + rect.width() * ( margins.left() / marginsWidth );
|
||||
w = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = rect.x() + margins.left();
|
||||
w = rect.width() - marginsWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( marginsHeight > rect.height() )
|
||||
{
|
||||
y = rect.y() + rect.height() * ( margins.top() / marginsHeight );
|
||||
h = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y = rect.y() + margins.top();
|
||||
h = rect.height() - marginsHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return QRectF( x, y, w, h );
|
||||
}
|
||||
}
|
||||
|
||||
qreal qskDpiScaled( qreal value )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ inline QMarginsF qskMargins( const QRectF& rect, const QRectF& innerRect )
|
|||
innerRect.left() - rect.left(),
|
||||
innerRect.top() - rect.top(),
|
||||
rect.right() - innerRect.right(),
|
||||
rect.bottom() - innerRect.bottom()
|
||||
);
|
||||
rect.bottom() - innerRect.bottom() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef QSK_GLOBAL_H
|
||||
#define QSK_GLOBAL_H
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <qcompilerdetection.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
// QSK_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
|
||||
|
|
@ -39,19 +39,20 @@
|
|||
#define QSK_QT_PRIVATE_END \
|
||||
QT_WARNING_POP
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
|
||||
#define qskAsConst qAsConst
|
||||
|
||||
#else
|
||||
|
||||
template <typename T> struct QskAddConst { typedef const T Type; };
|
||||
template < typename T >
|
||||
struct QskAddConst { typedef const T Type; };
|
||||
|
||||
template <typename T>
|
||||
constexpr typename QskAddConst<T>::Type &qskAsConst( T &t ) noexcept { return t; }
|
||||
template < typename T >
|
||||
constexpr typename QskAddConst< T >::Type& qskAsConst( T& t ) noexcept { return t; }
|
||||
|
||||
template <typename T>
|
||||
void qskAsConst( const T && ) = delete;
|
||||
template< typename T >
|
||||
void qskAsConst( const T&& ) = delete;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#include "QskGradient.h"
|
||||
#include "QskRgbValue.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qhashfunctions.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
static void qskRegisterGradient()
|
||||
{
|
||||
|
|
@ -21,8 +21,7 @@ static inline bool qskIsGradientValid( const QVector< QskGradientStop >& stops )
|
|||
if ( stops.size() < 2 )
|
||||
return false;
|
||||
|
||||
if ( stops.first().position() != 0.0 ||
|
||||
stops.last().position() != 1.0 )
|
||||
if ( stops.first().position() != 0.0 || stops.last().position() != 1.0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -32,10 +31,10 @@ static inline bool qskIsGradientValid( const QVector< QskGradientStop >& stops )
|
|||
|
||||
for ( int i = 1; i < stops.size(); i++ )
|
||||
{
|
||||
if ( stops[i].position() < stops[i - 1].position() )
|
||||
if ( stops[ i ].position() < stops[ i - 1 ].position() )
|
||||
return false;
|
||||
|
||||
if ( !stops[i].color().isValid() )
|
||||
if ( !stops[ i ].color().isValid() )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +45,7 @@ static inline bool qskIsMonochrome( const QVector< QskGradientStop >& stops )
|
|||
{
|
||||
for ( int i = 1; i < stops.size(); i++ )
|
||||
{
|
||||
if ( stops[i].color() != stops[0].color() )
|
||||
if ( stops[ i ].color() != stops[ 0 ].color() )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +71,7 @@ static inline bool qskComparePositions(
|
|||
// the first is always at 0.0, the last at 1.0
|
||||
for ( int i = 1; i < s1.count() - 1; i++ )
|
||||
{
|
||||
if ( s1[i].position() != s2[i].position() )
|
||||
if ( s1[ i ].position() != s2[ i ].position() )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -92,16 +91,16 @@ static inline QVector< QskGradientStop > qskExpandedStops(
|
|||
stops += s1.first();
|
||||
|
||||
int i = 1, j = 1;
|
||||
while( ( i < s1.count() - 1 ) || ( j < s2.count() - 1 ) )
|
||||
while ( ( i < s1.count() - 1 ) || ( j < s2.count() - 1 ) )
|
||||
{
|
||||
if ( s1[i].position() < s2[j].position() )
|
||||
if ( s1[ i ].position() < s2[ j ].position() )
|
||||
{
|
||||
stops += s1[i++];
|
||||
stops += s1[ i++ ];
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal pos = s2[j++].position();
|
||||
stops += QskGradientStop( pos, qskInterpolated( s1[i - 1], s1[i], pos ) );
|
||||
const qreal pos = s2[ j++ ].position();
|
||||
stops += QskGradientStop( pos, qskInterpolated( s1[ i - 1 ], s1[ i ], pos ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,14 +109,14 @@ static inline QVector< QskGradientStop > qskExpandedStops(
|
|||
return stops;
|
||||
}
|
||||
|
||||
QskGradientStop::QskGradientStop():
|
||||
m_position( -1.0 )
|
||||
QskGradientStop::QskGradientStop()
|
||||
: m_position( -1.0 )
|
||||
{
|
||||
}
|
||||
|
||||
QskGradientStop::QskGradientStop( qreal position, const QColor& color ):
|
||||
m_position( position ),
|
||||
m_color( color )
|
||||
QskGradientStop::QskGradientStop( qreal position, const QColor& color )
|
||||
: m_position( position )
|
||||
, m_color( color )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -169,28 +168,28 @@ QColor QskGradientStop::interpolated(
|
|||
return QskRgbValue::interpolated( min->color(), max->color(), r );
|
||||
}
|
||||
|
||||
QskGradient::QskGradient():
|
||||
m_orientation( Vertical )
|
||||
QskGradient::QskGradient()
|
||||
: m_orientation( Vertical )
|
||||
{
|
||||
}
|
||||
|
||||
QskGradient::QskGradient( const QColor& color ):
|
||||
m_orientation( Vertical )
|
||||
QskGradient::QskGradient( const QColor& color )
|
||||
: m_orientation( Vertical )
|
||||
{
|
||||
setColor( color );
|
||||
}
|
||||
|
||||
QskGradient::QskGradient( Orientation orientation,
|
||||
const QColor& startColor, const QColor& stopColor ):
|
||||
m_orientation( orientation )
|
||||
const QColor& startColor, const QColor& stopColor )
|
||||
: m_orientation( orientation )
|
||||
{
|
||||
setColors( startColor, stopColor );
|
||||
}
|
||||
|
||||
QskGradient::QskGradient( Orientation orientation,
|
||||
const QVector< QskGradientStop >& stops ):
|
||||
m_orientation( orientation ),
|
||||
m_stops( stops )
|
||||
const QVector< QskGradientStop >& stops )
|
||||
: m_orientation( orientation )
|
||||
, m_stops( stops )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -249,10 +248,10 @@ void QskGradient::setColor( const QColor& color )
|
|||
void QskGradient::setColors( const QColor& startColor, const QColor& stopColor )
|
||||
{
|
||||
m_stops.resize( 2 );
|
||||
m_stops[0].setPosition( 0.0 );
|
||||
m_stops[0].setColor( startColor );
|
||||
m_stops[1].setPosition( 1.0 );
|
||||
m_stops[1].setColor( stopColor );
|
||||
m_stops[ 0 ].setPosition( 0.0 );
|
||||
m_stops[ 0 ].setColor( startColor );
|
||||
m_stops[ 1 ].setPosition( 1.0 );
|
||||
m_stops[ 1 ].setColor( stopColor );
|
||||
}
|
||||
|
||||
void QskGradient::setStops( const QVector< QskGradientStop >& stops )
|
||||
|
|
@ -283,7 +282,7 @@ void QskGradient::setStopAt( int index, qreal stop )
|
|||
if ( index >= m_stops.size() )
|
||||
m_stops.resize( index + 1 );
|
||||
|
||||
m_stops[index].setPosition( stop );
|
||||
m_stops[ index ].setPosition( stop );
|
||||
}
|
||||
|
||||
qreal QskGradient::stopAt( int index ) const
|
||||
|
|
@ -291,7 +290,7 @@ qreal QskGradient::stopAt( int index ) const
|
|||
if ( index >= m_stops.size() )
|
||||
return -1.0;
|
||||
|
||||
return m_stops[index].position();
|
||||
return m_stops[ index ].position();
|
||||
}
|
||||
|
||||
void QskGradient::setColorAt( int index, const QColor& color )
|
||||
|
|
@ -305,7 +304,7 @@ void QskGradient::setColorAt( int index, const QColor& color )
|
|||
if ( index >= m_stops.size() )
|
||||
m_stops.resize( index + 1 );
|
||||
|
||||
m_stops[index].setColor( color );
|
||||
m_stops[ index ].setColor( color );
|
||||
}
|
||||
|
||||
QColor QskGradient::colorAt( int index ) const
|
||||
|
|
@ -313,7 +312,7 @@ QColor QskGradient::colorAt( int index ) const
|
|||
if ( index >= m_stops.size() )
|
||||
return QColor();
|
||||
|
||||
return m_stops[index].color();
|
||||
return m_stops[ index ].color();
|
||||
}
|
||||
|
||||
void QskGradient::setAlpha( int alpha )
|
||||
|
|
@ -367,15 +366,15 @@ QskGradient QskGradient::interpolated(
|
|||
{
|
||||
// we can ignore our stops
|
||||
|
||||
const QColor c = m_stops[0].color();
|
||||
const QColor c = m_stops[ 0 ].color();
|
||||
|
||||
QVector< QskGradientStop > s2 = to.m_stops;
|
||||
for ( int i = 0; i < s2.count(); i++ )
|
||||
{
|
||||
const QColor c2 = QskRgbValue::interpolated(
|
||||
c, s2[i].color(), value );
|
||||
c, s2[ i ].color(), value );
|
||||
|
||||
s2[i].setColor( c2 );
|
||||
s2[ i ].setColor( c2 );
|
||||
}
|
||||
|
||||
return QskGradient( to.m_orientation, s2 );
|
||||
|
|
@ -385,15 +384,15 @@ QskGradient QskGradient::interpolated(
|
|||
{
|
||||
// we can ignore the stops of to
|
||||
|
||||
const QColor c = to.m_stops[0].color();
|
||||
const QColor c = to.m_stops[ 0 ].color();
|
||||
|
||||
QVector< QskGradientStop > s2 = m_stops;
|
||||
for ( int i = 0; i < s2.count(); i++ )
|
||||
{
|
||||
const QColor c2 = QskRgbValue::interpolated(
|
||||
s2[i].color(), c, value );
|
||||
s2[ i ].color(), c, value );
|
||||
|
||||
s2[i].setColor( c2 );
|
||||
s2[ i ].setColor( c2 );
|
||||
}
|
||||
|
||||
return QskGradient( m_orientation, s2 );
|
||||
|
|
@ -406,15 +405,15 @@ QskGradient QskGradient::interpolated(
|
|||
at the same positions
|
||||
*/
|
||||
|
||||
const QVector< QskGradientStop > s1 = qskExpandedStops( m_stops, to.m_stops );
|
||||
QVector< QskGradientStop > s2 = qskExpandedStops( to.m_stops, m_stops );
|
||||
const auto s1 = qskExpandedStops( m_stops, to.m_stops );
|
||||
auto s2 = qskExpandedStops( to.m_stops, m_stops );
|
||||
|
||||
for ( int i = 0; i < s1.count(); i++ )
|
||||
{
|
||||
const QColor c2 = QskRgbValue::interpolated(
|
||||
s1[i].color(), s2[i].color(), value );
|
||||
s1[ i ].color(), s2[ i ].color(), value );
|
||||
|
||||
s2[i].setColor( c2 );
|
||||
s2[ i ].setColor( c2 );
|
||||
}
|
||||
|
||||
return QskGradient( m_orientation, s2 );
|
||||
|
|
@ -428,7 +427,7 @@ QskGradient QskGradient::interpolated(
|
|||
final gradient.
|
||||
*/
|
||||
|
||||
const QColor c = m_stops[0].color();
|
||||
const QColor c = m_stops[ 0 ].color();
|
||||
|
||||
if ( value <= 0.5 )
|
||||
{
|
||||
|
|
@ -437,9 +436,9 @@ QskGradient QskGradient::interpolated(
|
|||
for ( int i = 0; i < s2.count(); i++ )
|
||||
{
|
||||
const QColor c2 = QskRgbValue::interpolated(
|
||||
s2[i].color(), c, 2 * value );
|
||||
s2[ i ].color(), c, 2 * value );
|
||||
|
||||
s2[i].setColor( c2 );
|
||||
s2[ i ].setColor( c2 );
|
||||
}
|
||||
|
||||
return QskGradient( m_orientation, s2 );
|
||||
|
|
@ -451,9 +450,9 @@ QskGradient QskGradient::interpolated(
|
|||
for ( int i = 0; i < s2.count(); i++ )
|
||||
{
|
||||
const QColor c2 = QskRgbValue::interpolated(
|
||||
c, s2[i].color(), 2 * ( value - 0.5 ) );
|
||||
c, s2[ i ].color(), 2 * ( value - 0.5 ) );
|
||||
|
||||
s2[i].setColor( c2 );
|
||||
s2[ i ].setColor( c2 );
|
||||
}
|
||||
|
||||
return QskGradient( to.m_orientation, s2 );
|
||||
|
|
@ -467,7 +466,6 @@ QVariant QskGradient::interpolate(
|
|||
return QVariant::fromValue( from.interpolated( to, progress ) );
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
||||
#include <qdebug.h>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "QskGlobal.h"
|
||||
|
||||
#include <qmetatype.h>
|
||||
#include <qcolor.h>
|
||||
#include <qmetatype.h>
|
||||
#include <qvector.h>
|
||||
|
||||
class QDebug;
|
||||
|
|
@ -22,7 +22,7 @@ class QSK_EXPORT QskGradientStop
|
|||
Q_PROPERTY( qreal position READ position WRITE setPosition RESET resetPosition )
|
||||
Q_PROPERTY( QColor color READ color WRITE setColor RESET resetColor )
|
||||
|
||||
public:
|
||||
public:
|
||||
QskGradientStop();
|
||||
QskGradientStop( qreal position, const QColor& color );
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
uint hash( uint seed ) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
qreal m_position;
|
||||
QColor m_color;
|
||||
};
|
||||
|
|
@ -54,7 +54,7 @@ class QSK_EXPORT QskGradient
|
|||
Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
|
||||
Q_PROPERTY( QVector< QskGradientStop > stops READ stops WRITE setStops )
|
||||
|
||||
public:
|
||||
public:
|
||||
// TODO: radial/canonical gradients + other diagonal linear gradients
|
||||
enum Orientation
|
||||
{
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
uint hash( uint seed ) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
void setStopAt( int index, qreal stop );
|
||||
qreal stopAt( int index ) const;
|
||||
|
||||
|
|
@ -119,13 +119,13 @@ private:
|
|||
QVector< QskGradientStop > m_stops;
|
||||
};
|
||||
|
||||
inline QskGradient::QskGradient( Qt::GlobalColor color ):
|
||||
QskGradient( QColor( color ) )
|
||||
inline QskGradient::QskGradient( Qt::GlobalColor color )
|
||||
: QskGradient( QColor( color ) )
|
||||
{
|
||||
}
|
||||
|
||||
inline QskGradient::QskGradient( QRgb rgb ):
|
||||
QskGradient( QColor::fromRgba( rgb ) )
|
||||
inline QskGradient::QskGradient( QRgb rgb )
|
||||
: QskGradient( QColor::fromRgba( rgb ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue