making clazy happier
This commit is contained in:
parent
3504525840
commit
6db25ff7bc
@ -298,10 +298,10 @@ public:
|
||||
// finally connect buttons/slider/labels
|
||||
|
||||
connect( plusButton, &QskPushButton::pressed,
|
||||
[ this ]() { increment( 1 ); } );
|
||||
this, [ this ]() { increment( 1 ); } );
|
||||
|
||||
connect( minusButton, &QskPushButton::pressed,
|
||||
[ this ]() { increment( -1 ); } );
|
||||
this, [ this ]() { increment( -1 ); } );
|
||||
|
||||
connect( m_slider, &QskSlider::valueChanged,
|
||||
this, &SliderBox::setValue );
|
||||
@ -370,7 +370,7 @@ public:
|
||||
setAlignment( button, Qt::AlignCenter );
|
||||
|
||||
connect( button, &QskPushButton::pressed,
|
||||
[ = ]() { shift( button->offset() ); } );
|
||||
this, [ = ]() { shift( button->offset() ); } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,10 @@ Theme::Theme( QObject* parent ):
|
||||
m_accent( qskSetup->skin()->color( QskAspect::Color ) )
|
||||
{
|
||||
connect( qskSetup, &QskSetup::skinChanged,
|
||||
[this]( QskSkin* ) { updateColors(); } );
|
||||
this, [this]( QskSkin* ) { updateColors(); } );
|
||||
|
||||
connect( qskSetup, &QskSetup::skinChanged,
|
||||
[this]( QskSkin* ) { Q_EMIT skinChanged(); } );
|
||||
this, [this]( QskSkin* ) { Q_EMIT skinChanged(); } );
|
||||
}
|
||||
|
||||
void Theme::setAccent( QColor color )
|
||||
|
@ -28,10 +28,11 @@ linux {
|
||||
-isystem $$[QT_INSTALL_HEADERS] \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtCore \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtGui \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui/private \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQuick \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQuick/$$[QT_VERSION]/QtQuick/private \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQml
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQuick/$$[QT_VERSION]/QtQuick \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQml \
|
||||
-isystem $$[QT_INSTALL_HEADERS]/QtQml/$$[QT_VERSION]/QtQml \
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,4 +39,20 @@
|
||||
#define QSK_QT_PRIVATE_END \
|
||||
QT_WARNING_POP
|
||||
|
||||
#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>
|
||||
constexpr typename QskAddConst<T>::Type &qskAsConst( T &t ) noexcept { return t; }
|
||||
|
||||
template <typename T>
|
||||
void qskAsConst( const T && ) = delete;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -50,13 +50,13 @@ public:
|
||||
|
||||
void addObject( QObject* object )
|
||||
{
|
||||
for ( auto counter : m_counterSet )
|
||||
for ( auto counter : qskAsConst( m_counterSet ) )
|
||||
counter->addObject( object );
|
||||
}
|
||||
|
||||
void removeObject( QObject* object )
|
||||
{
|
||||
for ( auto counter : m_counterSet )
|
||||
for ( auto counter : qskAsConst( m_counterSet ) )
|
||||
counter->removeObject( object );
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,6 @@ namespace
|
||||
int current;
|
||||
int maximum;
|
||||
};
|
||||
|
||||
static Statistics qskStatistics;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -227,13 +225,15 @@ void QskAnimatorDriver::advanceAnimators( QQuickWindow* window )
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC( QskAnimatorDriver, qskAnimatorDriver )
|
||||
Q_GLOBAL_STATIC( Statistics, qskStatistics )
|
||||
|
||||
QskAnimator::QskAnimator():
|
||||
m_window( nullptr ),
|
||||
m_duration( 200 ),
|
||||
m_startTime( -1 )
|
||||
{
|
||||
qskStatistics.increment();
|
||||
if ( qskStatistics )
|
||||
qskStatistics->increment();
|
||||
}
|
||||
|
||||
QskAnimator::~QskAnimator()
|
||||
@ -241,7 +241,8 @@ QskAnimator::~QskAnimator()
|
||||
if ( qskAnimatorDriver )
|
||||
qskAnimatorDriver->unregisterAnimator( this );
|
||||
|
||||
qskStatistics.decrement();
|
||||
if ( qskStatistics )
|
||||
qskStatistics->decrement();
|
||||
}
|
||||
|
||||
QQuickWindow* QskAnimator::window() const
|
||||
@ -372,7 +373,8 @@ QMetaObject::Connection QskAnimator::addAdvanceHandler( QObject* receiver,
|
||||
|
||||
void QskAnimator::debugStatistics( QDebug debug )
|
||||
{
|
||||
qskStatistics.debugStatistics( debug );
|
||||
if ( qskStatistics )
|
||||
qskStatistics->debugStatistics( debug );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <QLocale>
|
||||
#include <QVector>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qquickitem_p.h>
|
||||
@ -99,7 +100,7 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
static QskWindowStore qskReleasedWindowCounter;
|
||||
Q_GLOBAL_STATIC( QskWindowStore, qskReleasedWindowCounter )
|
||||
|
||||
class QskControlPrivate : public QQuickItemPrivate
|
||||
{
|
||||
@ -1045,7 +1046,7 @@ void QskControl::releaseResources()
|
||||
// sequences to be able to provide the correct "oldWindow"
|
||||
// in the WindowChange event.
|
||||
|
||||
qskReleasedWindowCounter.setWindow( window() );
|
||||
qskReleasedWindowCounter->setWindow( window() );
|
||||
}
|
||||
|
||||
const QSGNode* QskControl::itemNode( const QQuickItem* item )
|
||||
@ -1125,7 +1126,7 @@ void QskControl::itemChange( QQuickItem::ItemChange change,
|
||||
}
|
||||
|
||||
QskWindowChangeEvent event(
|
||||
qskReleasedWindowCounter.window(), value.window );
|
||||
qskReleasedWindowCounter->window(), value.window );
|
||||
QCoreApplication::sendEvent( this, &event );
|
||||
|
||||
break;
|
||||
|
@ -9,9 +9,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
static const QString factoryId = "QSkinny";
|
||||
static const QString squiekSkinName = "Squiek";
|
||||
static const QString materialSkinName = "Material";
|
||||
static const char factoryId[] = "qskinny";
|
||||
static const char squiekSkinName[] = "Squiek";
|
||||
static const char materialSkinName[] = "Material";
|
||||
|
||||
class SkinFactory final : public QskSkinFactory
|
||||
{
|
||||
@ -53,7 +53,7 @@ static FactoryTable& qskGetFactoryTable()
|
||||
if ( qskFactoryTable->isEmpty() )
|
||||
{
|
||||
static SkinFactory dummySkinFactory ( nullptr );
|
||||
qskFactoryTable->insert( factoryId.toLower(), &dummySkinFactory );
|
||||
qskFactoryTable->insert( factoryId, &dummySkinFactory );
|
||||
}
|
||||
|
||||
return *qskFactoryTable;
|
||||
|
@ -202,7 +202,8 @@ namespace
|
||||
addControlAnimators( control, animatorHint, candidates );
|
||||
}
|
||||
|
||||
for ( auto child : item->childItems() )
|
||||
const auto children = item->childItems();
|
||||
for ( auto child : children )
|
||||
addAnimators( child, animatorHint, candidates, skin );
|
||||
}
|
||||
|
||||
@ -448,7 +449,8 @@ void QskSkinTransition::process()
|
||||
each object.
|
||||
*/
|
||||
|
||||
for ( const auto window : qGuiApp->topLevelWindows() )
|
||||
const auto windows = qGuiApp->topLevelWindows();
|
||||
for ( const auto window : windows )
|
||||
{
|
||||
if ( auto quickWindow = qobject_cast< const QQuickWindow* >( window ) )
|
||||
{
|
||||
|
@ -126,17 +126,19 @@ QskWindow::~QskWindow()
|
||||
{
|
||||
// When being used from Qml the item destruction would run in the most
|
||||
// unefficient way, leading to lots of QQuickItem::ItemChildRemovedChange
|
||||
// depending operations. We change this.
|
||||
// depending operations. So let's remove the toplevel children manually.
|
||||
|
||||
QList<QQuickItem *> children;
|
||||
for ( auto child : contentItem()->childItems() )
|
||||
QList<QQuickItem *> items;
|
||||
|
||||
const auto children = contentItem()->childItems();
|
||||
for ( auto child : children )
|
||||
{
|
||||
if ( child->parent() == contentItem() )
|
||||
children += child;
|
||||
items += child;
|
||||
}
|
||||
|
||||
for ( auto child : children )
|
||||
delete child;
|
||||
for ( auto item : qskAsConst( items ) )
|
||||
delete item;
|
||||
}
|
||||
|
||||
void QskWindow::resizeF( const QSizeF& size )
|
||||
@ -156,7 +158,12 @@ bool QskWindow::deleteOnClose() const
|
||||
void QskWindow::setDeleteOnClose( bool on )
|
||||
{
|
||||
Q_D( QskWindow );
|
||||
d->deleteOnClose = on;
|
||||
|
||||
if ( on != d->deleteOnClose )
|
||||
{
|
||||
d->deleteOnClose = on;
|
||||
Q_EMIT deleteOnCloseChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QskWindow::setAutoLayoutChildren( bool on )
|
||||
@ -377,7 +384,8 @@ void QskWindow::layoutItems()
|
||||
|
||||
const QSizeF sz( contentItem()->width(), contentItem()->height() );
|
||||
|
||||
for ( auto child : contentItem()->childItems() )
|
||||
const auto children = contentItem()->childItems();
|
||||
for ( auto child : children )
|
||||
{
|
||||
if ( !QskControl::isTransparentForPositioner( child ) )
|
||||
{
|
||||
|
@ -16,7 +16,8 @@ class QSK_EXPORT QskWindow : public QQuickWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( bool deleteOnClose READ deleteOnClose WRITE setDeleteOnClose FINAL )
|
||||
Q_PROPERTY( bool deleteOnClose READ deleteOnClose
|
||||
WRITE setDeleteOnClose NOTIFY deleteOnCloseChanged FINAL )
|
||||
|
||||
Q_PROPERTY( bool autoLayoutChildren READ autoLayoutChildren
|
||||
WRITE setAutoLayoutChildren NOTIFY autoLayoutChildrenChanged FINAL )
|
||||
@ -72,6 +73,7 @@ Q_SIGNALS:
|
||||
void localeChanged( const QLocale& );
|
||||
void framebufferModeChanged( FramebufferMode );
|
||||
void autoLayoutChildrenChanged();
|
||||
void deleteOnCloseChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setLocale( const QLocale& );
|
||||
|
@ -92,7 +92,7 @@ void QskDialogButtonBox::setOrientation( Qt::Orientation orientation )
|
||||
|
||||
for ( int i = 0; i < QskDialog::NButtonRoles; i++ )
|
||||
{
|
||||
for ( QskPushButton* button : m_data->buttonLists[i] )
|
||||
for ( QskPushButton* button : qskAsConst( m_data->buttonLists[i] ) )
|
||||
{
|
||||
// avoid that buttons get deleted
|
||||
// together with the layout
|
||||
@ -307,7 +307,7 @@ void QskDialogButtonBox::clear()
|
||||
{
|
||||
for ( int i = 0; i < QskDialog::NButtonRoles; i++ )
|
||||
{
|
||||
for ( QQuickItem* button : m_data->buttonLists[i] )
|
||||
for ( const QQuickItem* button : qskAsConst( m_data->buttonLists[i] ) )
|
||||
delete button;
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ void QskDialogButtonBox::setStandardButtons(
|
||||
{
|
||||
for ( int i = 0; i < QskDialog::NButtonRoles; i++ )
|
||||
{
|
||||
for ( QQuickItem* button : m_data->buttonLists[i] )
|
||||
for ( const QQuickItem* button : qskAsConst( m_data->buttonLists[i] ) )
|
||||
delete button;
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,8 @@ void QskGraphic::updateState( const QPaintEngineState& state )
|
||||
}
|
||||
else if ( auto gradient = pen.brush().gradient() )
|
||||
{
|
||||
for ( const auto& stop : gradient->stops() )
|
||||
const auto stops = gradient->stops();
|
||||
for ( const auto& stop : stops )
|
||||
qskInsertColor( stop.second, m_data->colorTable );
|
||||
}
|
||||
}
|
||||
@ -925,7 +926,8 @@ void QskGraphic::updateState( const QPaintEngineState& state )
|
||||
}
|
||||
else if ( auto gradient = brush.gradient() )
|
||||
{
|
||||
for ( const auto& stop : gradient->stops() )
|
||||
const auto stops = gradient->stops();
|
||||
for ( const auto& stop : stops )
|
||||
qskInsertColor( stop.second, m_data->colorTable );
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "QskGridBox.h"
|
||||
#include "QskLayoutItem.h"
|
||||
#include "QskLayoutEngine.h"
|
||||
#include <QtGui/private/qabstractlayoutstyleinfo_p.h>
|
||||
#include <QtGui/private/qgridlayoutengine_p.h>
|
||||
#include <private/qabstractlayoutstyleinfo_p.h>
|
||||
#include <private/qgridlayoutengine_p.h>
|
||||
|
||||
class QskGridBox::PrivateData
|
||||
{
|
||||
|
@ -6,7 +6,17 @@
|
||||
#ifndef QSK_LAYOUT_ENGINE_H
|
||||
#define QSK_LAYOUT_ENGINE_H
|
||||
|
||||
#include <QtGui/private/qgridlayoutengine_p.h>
|
||||
#include "QskGlobal.h"
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
/*
|
||||
QskLayoutEngine.h should be hidden into some cpp file
|
||||
as it needs private headers. TODO
|
||||
*/
|
||||
|
||||
#include <private/qgridlayoutengine_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
|
||||
class QskLayoutItem;
|
||||
class QQuickItem;
|
||||
|
@ -8,7 +8,15 @@
|
||||
|
||||
#include "QskGlobal.h"
|
||||
#include "QskSizePolicy.h"
|
||||
#include <QtGui/private/qgridlayoutengine_p.h>
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
/*
|
||||
QskLayoutItem.h should be hidden into some cpp file
|
||||
as it needs private headers. TODO
|
||||
*/
|
||||
|
||||
#include <private/qgridlayoutengine_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
class QQuickItem;
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
#include "QskBoxBorderColors.h"
|
||||
#include "QskGradient.h"
|
||||
|
||||
|
||||
#include <QSGVertexColorMaterial>
|
||||
#include <QSGFlatColorMaterial>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
static QSGVertexColorMaterial qskMaterialVertex;
|
||||
Q_GLOBAL_STATIC( QSGVertexColorMaterial, qskMaterialVertex )
|
||||
|
||||
static inline uint qskMetricsHash( const QskBoxShapeMetrics& shape,
|
||||
const QskBoxBorderMetrics& borderMetrics )
|
||||
@ -38,13 +38,13 @@ QskBoxNode::QskBoxNode():
|
||||
m_colorsHash( 0 ),
|
||||
m_geometry( QSGGeometry::defaultAttributes_ColoredPoint2D(), 0 )
|
||||
{
|
||||
setMaterial( &qskMaterialVertex );
|
||||
setMaterial( qskMaterialVertex );
|
||||
setGeometry( &m_geometry );
|
||||
}
|
||||
|
||||
QskBoxNode::~QskBoxNode()
|
||||
{
|
||||
if ( material() != &qskMaterialVertex )
|
||||
if ( material() != qskMaterialVertex )
|
||||
delete material();
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ void QskBoxNode::setMonochrome( bool on )
|
||||
{
|
||||
const auto material = this->material();
|
||||
|
||||
if ( on == ( material != &qskMaterialVertex ) )
|
||||
if ( on == ( material != qskMaterialVertex ) )
|
||||
return;
|
||||
|
||||
m_geometry.allocate( 0 );
|
||||
@ -181,7 +181,7 @@ void QskBoxNode::setMonochrome( bool on )
|
||||
}
|
||||
else
|
||||
{
|
||||
setMaterial( &qskMaterialVertex );
|
||||
setMaterial( qskMaterialVertex );
|
||||
delete material;
|
||||
|
||||
const QSGGeometry g( QSGGeometry::defaultAttributes_ColoredPoint2D(), 0 );
|
||||
|
@ -116,7 +116,9 @@ static void qskRenderText(
|
||||
for ( int i = 0; i < layout->lineCount(); ++i )
|
||||
{
|
||||
auto line = layout->lineAt( i );
|
||||
for ( const auto& glyphRun : line.glyphRuns() )
|
||||
|
||||
const auto glyphRuns = line.glyphRuns();
|
||||
for ( const auto& glyphRun : glyphRuns )
|
||||
{
|
||||
const bool doCreate = !glyphNode;
|
||||
if ( doCreate )
|
||||
|
Loading…
x
Reference in New Issue
Block a user