Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
01fca282b7 | |
|
f1b32e5d45 | |
|
a0f3a925ff | |
|
1430210424 |
|
@ -27,8 +27,9 @@ controls is limited to the needs of the driving projects.
|
|||
|
||||
QSkinny is supposed to run on all platforms being supported by Qt/Quick.
|
||||
But so far only Linux is actively tested.
|
||||
It might support all versions Qt >= 5.12, but you can rely on:
|
||||
It might support all versions Qt >= 5.6, but you can rely on:
|
||||
|
||||
- Qt 5.6
|
||||
- Qt 5.15
|
||||
- current long term supported ( LTS ) version of Qt
|
||||
- current version of Qt
|
||||
|
|
|
@ -28,7 +28,11 @@ namespace
|
|||
LinesNode( int lineCount = 0 )
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 2 * lineCount )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
m_geometry.setDrawingMode( QSGGeometry::DrawLines );
|
||||
#else
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
#endif
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
|
||||
setGeometry( &m_geometry );
|
||||
|
|
|
@ -48,7 +48,11 @@ void DiagramDataNode::update( const QRectF& rect, Type type,
|
|||
m_type = type;
|
||||
|
||||
const auto drawingMode =
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
( m_type == Line ) ? QSGGeometry::DrawLines : QSGGeometry::DrawTriangleStrip;
|
||||
#else
|
||||
( m_type == Line ) ? GL_LINES : GL_TRIANGLE_STRIP;
|
||||
#endif
|
||||
|
||||
m_geometry.setDrawingMode( drawingMode );
|
||||
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
DiagramSegmentsNode::DiagramSegmentsNode()
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
m_geometry.setDrawingMode( QSGGeometry::DrawLines );
|
||||
#else
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
#endif
|
||||
|
||||
setGeometry( &m_geometry );
|
||||
setMaterial( &m_material );
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
RadialTickmarksNode::RadialTickmarksNode()
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
m_geometry.setDrawingMode( QSGGeometry::DrawLines );
|
||||
#else
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
#endif
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
|
||||
setGeometry( &m_geometry );
|
||||
|
|
|
@ -37,7 +37,11 @@ namespace
|
|||
TicksNode( const QColor& color )
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
m_geometry.setDrawingMode( QSGGeometry::DrawLines );
|
||||
#else
|
||||
m_geometry.setDrawingMode( GL_LINES );
|
||||
#endif
|
||||
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
|
||||
m_material.setColor( color );
|
||||
|
|
|
@ -158,7 +158,7 @@ class IconGrid : public QskLinearBox
|
|||
const int dim = dimension();
|
||||
|
||||
// we know, that all items have the same size
|
||||
const auto itemSize = itemAtIndex( 0 )->size();
|
||||
const auto itemSize = qskItemSize( itemAtIndex( 0 ) );
|
||||
|
||||
const int rowMin = rect.top() / ( itemSize.height() + spacing() );
|
||||
const int rowMax = rect.bottom() / ( itemSize.height() + spacing() );
|
||||
|
|
|
@ -172,6 +172,7 @@ debug {
|
|||
}
|
||||
|
||||
# DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000
|
||||
DEFINES += QSK_BUILD
|
||||
|
||||
LOCAL_PRI=$$(QSK_LOCAL_PRI)
|
||||
|
||||
|
|
|
@ -31,16 +31,40 @@ qvgrcc.CONFIG += add_inputs_as_makefile_deps
|
|||
QRC_SHADOW_CLONE = $$shell_path( $${OUT_PWD}/${QMAKE_FILE_BASE}_shadow.qrc )
|
||||
qtPrepareTool(QMAKE_RCC, rcc, _DEP)
|
||||
|
||||
equals( OUT_PWD, $${_PRO_FILE_PWD_} ) {
|
||||
lessThan(QT_MAJOR_VERSION, 6): lessThan(QT_MINOR_VERSION, 12) {
|
||||
|
||||
qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
|
||||
# Since Qt 5.12 "rcc --list" works for qvg files, that do not yet exist
|
||||
# To get these rules working for earlier versions we derive the qvg
|
||||
# files from the SVGSOURCES
|
||||
|
||||
defineReplace(qvgfiles) {
|
||||
|
||||
svgfiles = $$1
|
||||
|
||||
files =
|
||||
for( svgfile, svgfiles) {
|
||||
filename = $$basename( svgfile )
|
||||
files += $$shell_path( $${QVG_DIR}/$$replace( filename, svg, qvg ) )
|
||||
}
|
||||
|
||||
return( $$files )
|
||||
}
|
||||
|
||||
qvgrcc.depends += $$qvgfiles( $${SVGSOURCES} )
|
||||
|
||||
} else {
|
||||
|
||||
qvgrcc.depend_command = \
|
||||
$${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \
|
||||
$$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \
|
||||
$${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE}
|
||||
equals( OUT_PWD, $${_PRO_FILE_PWD_} ) {
|
||||
|
||||
qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
|
||||
|
||||
} else {
|
||||
|
||||
qvgrcc.depend_command = \
|
||||
$${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \
|
||||
$$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \
|
||||
$${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE}
|
||||
}
|
||||
}
|
||||
|
||||
equals( OUT_PWD, $${_PRO_FILE_PWD_} ) {
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
|
||||
#include "Image.h"
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qquickimage_p_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
// QQuickImagePrivate is not exported, so we
|
||||
// we can't derive here
|
||||
|
||||
class ImagePrivate : public QQuickImagePrivate
|
||||
class Image::PrivateData
|
||||
{
|
||||
public:
|
||||
ImagePrivate()
|
||||
PrivateData()
|
||||
: sourceSizeAdjustment( false )
|
||||
, deferredUpdates( true )
|
||||
, dirtyPolish( false )
|
||||
|
@ -28,7 +27,8 @@ class ImagePrivate : public QQuickImagePrivate
|
|||
};
|
||||
|
||||
Image::Image( QQuickItem* parent )
|
||||
: QQuickImage( *( new ImagePrivate() ), parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,36 +48,32 @@ void Image::hide()
|
|||
|
||||
void Image::setSourceSizeAdjustment( bool on )
|
||||
{
|
||||
Q_D( Image );
|
||||
|
||||
if ( on != d->sourceSizeAdjustment )
|
||||
if ( on != m_data->sourceSizeAdjustment )
|
||||
{
|
||||
d->sourceSizeAdjustment = on;
|
||||
m_data->sourceSizeAdjustment = on;
|
||||
Q_EMIT sourceSizeAdjustmentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool Image::sourceSizeAdjustment() const
|
||||
{
|
||||
return d_func()->sourceSizeAdjustment;
|
||||
return m_data->sourceSizeAdjustment;
|
||||
}
|
||||
|
||||
void Image::setDeferredUpdates( bool on )
|
||||
{
|
||||
Q_D( Image );
|
||||
|
||||
if ( on != d->deferredUpdates )
|
||||
if ( on != m_data->deferredUpdates )
|
||||
{
|
||||
d->deferredUpdates = on;
|
||||
m_data->deferredUpdates = on;
|
||||
|
||||
if ( !on )
|
||||
{
|
||||
// when having blocked updates we reschedule them
|
||||
|
||||
if ( d->dirtyPolish )
|
||||
if ( m_data->dirtyPolish )
|
||||
polish();
|
||||
|
||||
if ( d->dirtyUpdate )
|
||||
if ( m_data->dirtyUpdate )
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -85,20 +81,18 @@ void Image::setDeferredUpdates( bool on )
|
|||
|
||||
bool Image::deferredUpdates() const
|
||||
{
|
||||
return d_func()->deferredUpdates;
|
||||
return m_data->deferredUpdates;
|
||||
}
|
||||
|
||||
void Image::setSourceSize( const QSize& size )
|
||||
{
|
||||
if ( !( size.isEmpty() && sourceSize().isEmpty() ) )
|
||||
Inherited::setSourceSize( size );
|
||||
QQuickImage::setSourceSize( size );
|
||||
}
|
||||
|
||||
void Image::componentComplete()
|
||||
{
|
||||
Q_D( const Image );
|
||||
|
||||
if ( d->deferredUpdates && d->sourceSizeAdjustment )
|
||||
if ( m_data->deferredUpdates && m_data->sourceSizeAdjustment )
|
||||
{
|
||||
// QQuickImage::componentComplete() calls load
|
||||
// long before we have the final geometry
|
||||
|
@ -119,14 +113,12 @@ void Image::itemChange( QQuickItem::ItemChange change,
|
|||
|
||||
if ( change == ItemVisibleHasChanged )
|
||||
{
|
||||
Q_D( const Image );
|
||||
|
||||
if ( value.boolValue )
|
||||
{
|
||||
if ( d->dirtyPolish )
|
||||
if ( m_data->dirtyPolish )
|
||||
polish();
|
||||
|
||||
if ( d->dirtyUpdate )
|
||||
if ( m_data->dirtyUpdate )
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -158,11 +150,9 @@ void Image::geometryChanged(
|
|||
|
||||
void Image::adjustSourceSize( const QSizeF& size )
|
||||
{
|
||||
Q_D( const Image );
|
||||
|
||||
if ( d->sourceSizeAdjustment )
|
||||
if ( m_data->sourceSizeAdjustment )
|
||||
{
|
||||
if ( d->deferredUpdates )
|
||||
if ( m_data->deferredUpdates )
|
||||
{
|
||||
setImplicitSize( size.width(), size.height() );
|
||||
polish();
|
||||
|
@ -176,39 +166,35 @@ void Image::adjustSourceSize( const QSizeF& size )
|
|||
|
||||
void Image::updatePolish()
|
||||
{
|
||||
Q_D( Image );
|
||||
|
||||
if ( d->deferredUpdates )
|
||||
if ( m_data->deferredUpdates )
|
||||
{
|
||||
if ( !isVisible() )
|
||||
{
|
||||
d->dirtyPolish = true;
|
||||
m_data->dirtyPolish = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( d->sourceSizeAdjustment )
|
||||
if ( m_data->sourceSizeAdjustment )
|
||||
setSourceSize( QSize( int( width() ), int( height() ) ) );
|
||||
}
|
||||
|
||||
d->dirtyPolish = false;
|
||||
m_data->dirtyPolish = false;
|
||||
|
||||
Inherited::updatePolish();
|
||||
}
|
||||
|
||||
QSGNode* Image::updatePaintNode( QSGNode* oldNode, UpdatePaintNodeData* data )
|
||||
{
|
||||
Q_D( Image );
|
||||
|
||||
if ( d->deferredUpdates )
|
||||
if ( m_data->deferredUpdates )
|
||||
{
|
||||
if ( !isVisible() )
|
||||
{
|
||||
d->dirtyUpdate = true;
|
||||
m_data->dirtyUpdate = true;
|
||||
return oldNode;
|
||||
}
|
||||
}
|
||||
|
||||
d->dirtyUpdate = false;
|
||||
m_data->dirtyUpdate = false;
|
||||
|
||||
return Inherited::updatePaintNode( oldNode, data );
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ QSK_QT_PRIVATE_BEGIN
|
|||
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
class ImagePrivate;
|
||||
#include <memory>
|
||||
|
||||
class Image : public QQuickImage
|
||||
{
|
||||
|
@ -80,5 +80,6 @@ class Image : public QQuickImage
|
|||
private:
|
||||
void adjustSourceSize( const QSizeF& );
|
||||
|
||||
Q_DECLARE_PRIVATE( Image )
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
@ -29,8 +29,12 @@ namespace
|
|||
private:
|
||||
static ImageType type()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 )
|
||||
return Texture;
|
||||
#else
|
||||
const auto backend = QQuickWindow::sceneGraphBackend();
|
||||
return ( backend == "software" ) ? Image : Texture;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -94,7 +94,9 @@ namespace
|
|||
bool updateMaterial = ( oldMaterial == nullptr )
|
||||
|| newMaterial->compare( oldMaterial ) != 0;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||
updateMaterial |= state.isCachedMaterialDataDirty();
|
||||
#endif
|
||||
|
||||
if ( updateMaterial )
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ SUBDIRS = \
|
|||
qmlexport \
|
||||
tools \
|
||||
support \
|
||||
tests \
|
||||
examples \
|
||||
playground
|
||||
|
||||
|
@ -23,7 +22,6 @@ qmlexport.depends = src
|
|||
inputcontext.depends = src
|
||||
skins.depends = src
|
||||
tools.depends = src
|
||||
tests.depends = src support
|
||||
support.depends = src skins
|
||||
examples.depends = tools support skins qmlexport
|
||||
playground.depends = tools support skins qmlexport
|
||||
|
|
|
@ -159,7 +159,11 @@ qreal qskHorizontalAdvance( const QFont& font, const QString& text )
|
|||
|
||||
qreal qskHorizontalAdvance( const QFontMetricsF& fontMetrics, const QString& text )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 )
|
||||
return fontMetrics.horizontalAdvance( text );
|
||||
#else
|
||||
return fontMetrics.width( text );
|
||||
#endif
|
||||
}
|
||||
|
||||
qreal qskFuzzyFloor( qreal value, qreal stepSize )
|
||||
|
|
|
@ -39,6 +39,22 @@
|
|||
#define QSK_QT_PRIVATE_END \
|
||||
QT_WARNING_POP
|
||||
|
||||
#if defined( QSK_BUILD )
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 7, 0 )
|
||||
|
||||
template< typename T >
|
||||
struct QskAddConst { typedef const T Type; };
|
||||
|
||||
template< typename T >
|
||||
constexpr typename QskAddConst< T >::Type& qAsConst( T& t ) noexcept { return t; }
|
||||
|
||||
template< typename T >
|
||||
void qAsConst( const T&& ) = delete;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
using QskHashValue = uint;
|
||||
#else
|
||||
|
|
|
@ -233,10 +233,7 @@ QskGradient::QskGradient( Orientation orientation, const QskGradientStops& stops
|
|||
setStops( stops );
|
||||
}
|
||||
|
||||
QskGradient::QskGradient( Qt::Orientation orientation, QGradient::Preset preset )
|
||||
: QskGradient( qskOrientation( orientation ), preset )
|
||||
{
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||
|
||||
QskGradient::QskGradient( Orientation orientation, QGradient::Preset preset )
|
||||
: QskGradient( orientation )
|
||||
|
@ -244,6 +241,8 @@ QskGradient::QskGradient( Orientation orientation, QGradient::Preset preset )
|
|||
setStops( qskGradientStops( QGradient( preset ).stops() ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QskGradient::~QskGradient()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -48,15 +48,17 @@ class QSK_EXPORT QskGradient
|
|||
QskGradient( Qt::GlobalColor );
|
||||
QskGradient( QRgb );
|
||||
QskGradient( const QColor& );
|
||||
QskGradient( QGradient::Preset );
|
||||
|
||||
QskGradient( Qt::Orientation, const QVector< QskGradientStop >& );
|
||||
QskGradient( Qt::Orientation, const QColor&, const QColor& );
|
||||
QskGradient( Qt::Orientation, QGradient::Preset );
|
||||
|
||||
QskGradient( Orientation, const QVector< QskGradientStop >& );
|
||||
QskGradient( Orientation, const QColor&, const QColor& );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||
QskGradient( QGradient::Preset );
|
||||
QskGradient( Orientation, QGradient::Preset );
|
||||
#endif
|
||||
|
||||
~QskGradient();
|
||||
|
||||
|
@ -136,11 +138,15 @@ inline QskGradient::QskGradient( QRgb rgb )
|
|||
{
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||
|
||||
inline QskGradient::QskGradient( QGradient::Preset preset )
|
||||
: QskGradient( Vertical, preset )
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline QskGradient::Orientation QskGradient::orientation() const
|
||||
{
|
||||
return static_cast< Orientation >( m_orientation );
|
||||
|
|
|
@ -19,22 +19,21 @@ class QSK_EXPORT QskGradientStop
|
|||
Q_PROPERTY( QColor color READ color WRITE setColor RESET resetColor )
|
||||
|
||||
public:
|
||||
constexpr QskGradientStop() noexcept;
|
||||
constexpr QskGradientStop( qreal position, const QColor& ) noexcept;
|
||||
|
||||
QskGradientStop() noexcept;
|
||||
QskGradientStop( qreal position, const QColor& ) noexcept;
|
||||
QskGradientStop( qreal position, Qt::GlobalColor ) noexcept;
|
||||
QskGradientStop( qreal position, QRgb ) noexcept;
|
||||
|
||||
constexpr bool operator==( const QskGradientStop& ) const noexcept;
|
||||
constexpr bool operator!=( const QskGradientStop& ) const noexcept;
|
||||
bool operator==( const QskGradientStop& ) const noexcept;
|
||||
bool operator!=( const QskGradientStop& ) const noexcept;
|
||||
|
||||
void setStop( qreal position, const QColor& ) noexcept;
|
||||
|
||||
constexpr qreal position() const noexcept;
|
||||
qreal position() const noexcept;
|
||||
void setPosition( qreal position ) noexcept;
|
||||
void resetPosition() noexcept;
|
||||
|
||||
constexpr const QColor& color() const noexcept;
|
||||
const QColor& color() const noexcept;
|
||||
void setColor( const QColor& ) noexcept;
|
||||
void resetColor() noexcept;
|
||||
|
||||
|
@ -54,12 +53,12 @@ class QSK_EXPORT QskGradientStop
|
|||
|
||||
Q_DECLARE_METATYPE( QskGradientStop )
|
||||
|
||||
inline constexpr QskGradientStop::QskGradientStop() noexcept
|
||||
inline QskGradientStop::QskGradientStop() noexcept
|
||||
: m_position( -1.0 )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskGradientStop::QskGradientStop(
|
||||
inline QskGradientStop::QskGradientStop(
|
||||
qreal position, const QColor& color ) noexcept
|
||||
: m_position( position )
|
||||
, m_color( color )
|
||||
|
@ -78,22 +77,22 @@ inline QskGradientStop::QskGradientStop(
|
|||
{
|
||||
}
|
||||
|
||||
inline constexpr qreal QskGradientStop::position() const noexcept
|
||||
inline qreal QskGradientStop::position() const noexcept
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
inline constexpr const QColor& QskGradientStop::color() const noexcept
|
||||
inline const QColor& QskGradientStop::color() const noexcept
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
inline constexpr bool QskGradientStop::operator==( const QskGradientStop& other ) const noexcept
|
||||
inline bool QskGradientStop::operator==( const QskGradientStop& other ) const noexcept
|
||||
{
|
||||
return ( m_position == other.m_position ) && ( m_color == other.m_color );
|
||||
}
|
||||
|
||||
inline constexpr bool QskGradientStop::operator!=( const QskGradientStop& other ) const noexcept
|
||||
inline bool QskGradientStop::operator!=( const QskGradientStop& other ) const noexcept
|
||||
{
|
||||
return ( !( *this == other ) );
|
||||
}
|
||||
|
|
|
@ -9,9 +9,36 @@
|
|||
#include "QskGlobal.h"
|
||||
#include <qmetaobject.h>
|
||||
|
||||
namespace Qsk
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 )
|
||||
// hack to run moc over a namespace
|
||||
|
||||
#ifdef Q_MOC_RUN
|
||||
|
||||
#define QSK_NAMESPACE( name ) struct name
|
||||
#define QSK_ENUM( name ) Q_GADGET Q_ENUM( name )
|
||||
|
||||
#else
|
||||
|
||||
#define QSK_NAMESPACE( name ) namespace name
|
||||
#define QSK_ENUM( name ) \
|
||||
inline constexpr const QMetaObject* qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
|
||||
inline constexpr const char* qt_getEnumName(name) noexcept { return #name; }
|
||||
|
||||
#endif
|
||||
|
||||
#define QSK_Q_NAMESPACE extern const QMetaObject staticMetaObject;
|
||||
|
||||
#else
|
||||
|
||||
#define QSK_NAMESPACE( name ) namespace name
|
||||
#define QSK_ENUM Q_ENUM_NS
|
||||
|
||||
#define QSK_Q_NAMESPACE Q_NAMESPACE
|
||||
#endif
|
||||
|
||||
QSK_NAMESPACE( Qsk )
|
||||
{
|
||||
QSK_EXPORT Q_NAMESPACE
|
||||
QSK_EXPORT QSK_Q_NAMESPACE
|
||||
|
||||
enum Direction
|
||||
{
|
||||
|
@ -20,7 +47,7 @@ namespace Qsk
|
|||
TopToBottom,
|
||||
BottomToTop
|
||||
};
|
||||
Q_ENUM_NS( Direction )
|
||||
QSK_ENUM( Direction )
|
||||
|
||||
enum Position
|
||||
{
|
||||
|
@ -29,7 +56,7 @@ namespace Qsk
|
|||
Right,
|
||||
Bottom
|
||||
};
|
||||
Q_ENUM_NS( Position )
|
||||
QSK_ENUM( Position )
|
||||
|
||||
enum TextStyle
|
||||
{
|
||||
|
@ -38,17 +65,21 @@ namespace Qsk
|
|||
Raised,
|
||||
Sunken
|
||||
};
|
||||
Q_ENUM_NS( TextStyle )
|
||||
QSK_ENUM( TextStyle )
|
||||
|
||||
enum Visibility
|
||||
{
|
||||
Visible = 1 << 0,
|
||||
Hidden = 1 << 1
|
||||
};
|
||||
Q_ENUM_NS( Visibility )
|
||||
QSK_ENUM( Visibility )
|
||||
|
||||
Q_DECLARE_FLAGS( Visibilities, Visibility )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( Visibilities )
|
||||
}
|
||||
|
||||
#undef QSK_NAMESPACE
|
||||
#undef QSK_ENUM
|
||||
#undef QSK_Q_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,14 @@
|
|||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 )
|
||||
#ifndef foreach
|
||||
// qhighdpiscaling_p.h needs it
|
||||
#define foreach Q_FOREACH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
|
@ -42,10 +50,16 @@ const QPlatformIntegration* qskPlatformIntegration()
|
|||
|
||||
bool qskMaybeDesktopPlatform()
|
||||
{
|
||||
#if QT_CONFIG(cursor)
|
||||
// this is what QC2 is doing for menus ?
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
#if !QT_CONFIG(cursor)
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( const auto platform = QGuiApplicationPrivate::platformIntegration() )
|
||||
return platform->hasCapability( QPlatformIntegration::MultipleWindows );
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,11 @@ namespace
|
|||
IndicatorNode()
|
||||
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 3 )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
m_geometry.setDrawingMode( QSGGeometry::DrawLineStrip );
|
||||
#else
|
||||
m_geometry.setDrawingMode( GL_LINE_STRIP );
|
||||
#endif
|
||||
m_geometry.setLineWidth( 2 );
|
||||
setGeometry( &m_geometry );
|
||||
|
||||
|
|
|
@ -769,6 +769,55 @@ bool QskControl::event( QEvent* event )
|
|||
|
||||
bool QskControl::childMouseEventFilter( QQuickItem* item, QEvent* event )
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
|
||||
|
||||
if ( event->type() == QEvent::MouseButtonPress )
|
||||
{
|
||||
auto me = static_cast< QMouseEvent* >( event );
|
||||
|
||||
if ( me->source() == Qt::MouseEventSynthesizedByQt )
|
||||
{
|
||||
/*
|
||||
Unhandled touch events result in creating synthetic
|
||||
mouse events. For all versions < 5.10 those events are
|
||||
passed through childMouseEventFilter without doing the
|
||||
extra checks, that are done for real mouse events.
|
||||
Furthermore the coordinates are relative
|
||||
to this - not to item.
|
||||
|
||||
To avoid having a different behavior between using
|
||||
mouse and touch, we do those checks here.
|
||||
*/
|
||||
|
||||
auto itm = item;
|
||||
auto pos = item->mapFromScene( me->windowPos() );
|
||||
|
||||
for ( itm = item; itm != this; itm = itm->parentItem() )
|
||||
{
|
||||
if ( itm->acceptedMouseButtons() & me->button() )
|
||||
{
|
||||
if ( itm->contains( pos ) )
|
||||
break;
|
||||
}
|
||||
|
||||
pos += QPointF( itm->x(), itm->y() );
|
||||
}
|
||||
|
||||
if ( itm != item )
|
||||
{
|
||||
if ( itm == this )
|
||||
return false;
|
||||
|
||||
QScopedPointer< QMouseEvent > clonedEvent(
|
||||
QQuickWindowPrivate::cloneMouseEvent( me, &pos ) );
|
||||
|
||||
return d_func()->maybeGesture( itm, clonedEvent.data() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return d_func()->maybeGesture( item, event );
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,10 @@ qreal qskWheelIncrement( const QWheelEvent* event )
|
|||
|
||||
auto angleDelta = event->angleDelta();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
if ( event->inverted() )
|
||||
angleDelta.setY( -angleDelta.y() );
|
||||
#endif
|
||||
|
||||
const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
|
||||
return delta / QWheelEvent::DefaultDeltasPerStep;
|
||||
|
|
|
@ -74,6 +74,7 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener
|
|||
}
|
||||
|
||||
private:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
void itemGeometryChanged( QQuickItem* item,
|
||||
QQuickGeometryChange change, const QRectF& ) override
|
||||
{
|
||||
|
@ -87,6 +88,21 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener
|
|||
if ( doUpdate )
|
||||
m_grabber->updateGeometry();
|
||||
}
|
||||
#else
|
||||
void itemGeometryChanged(
|
||||
QQuickItem* item, const QRectF& newRect, const QRectF& oldRect ) override
|
||||
{
|
||||
bool doUpdate = false;
|
||||
|
||||
if ( item == itemAbove )
|
||||
doUpdate = newRect.topLeft() != oldRect.topLeft();
|
||||
else
|
||||
doUpdate = newRect.size() != oldRect.size();
|
||||
|
||||
if ( doUpdate )
|
||||
m_grabber->updateGeometry();
|
||||
}
|
||||
#endif
|
||||
|
||||
void itemParentChanged( QQuickItem* item, QQuickItem* parentItem ) override
|
||||
{
|
||||
|
@ -109,7 +125,9 @@ QskInputGrabber::QskInputGrabber( QQuickItem* parent )
|
|||
, m_data( new PrivateData( this ) )
|
||||
{
|
||||
setAcceptedMouseButtons( Qt::AllButtons );
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||
setAcceptTouchEvents( true );
|
||||
#endif
|
||||
setAcceptHoverEvents( true );
|
||||
|
||||
setPlacementPolicy( QskPlacementPolicy::Ignore );
|
||||
|
|
|
@ -323,7 +323,10 @@ QPointF QskListView::scrollOffset( const QWheelEvent* event ) const
|
|||
const auto viewHeight = viewContentsRect().height();
|
||||
const qreal rowHeight = this->rowHeight();
|
||||
|
||||
const int numLines = QGuiApplication::styleHints()->wheelScrollLines();
|
||||
int numLines = 3;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
|
||||
numLines = QGuiApplication::styleHints()->wheelScrollLines();
|
||||
#endif
|
||||
|
||||
qreal dy = numLines * rowHeight;
|
||||
if ( event->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier ) )
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace
|
|||
class Option
|
||||
{
|
||||
public:
|
||||
Option() = default;
|
||||
|
||||
Option( const QUrl& graphicSource, const QString& text )
|
||||
: graphicSource( graphicSource )
|
||||
, text( text )
|
||||
|
|
|
@ -16,6 +16,13 @@ QSK_QT_PRIVATE_END
|
|||
#include <qpa/qplatforminputcontext.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
QSizeF qskItemSize( const QQuickItem* item )
|
||||
{
|
||||
// obsolete for Qt >= 5.10
|
||||
auto d = QQuickItemPrivate::get( item );
|
||||
return QSizeF( d->width, d->height );
|
||||
}
|
||||
|
||||
QRectF qskItemRect( const QQuickItem* item )
|
||||
{
|
||||
auto d = QQuickItemPrivate::get( item );
|
||||
|
@ -51,7 +58,19 @@ bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child )
|
|||
if ( item == nullptr || child == nullptr )
|
||||
return false;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
return item->isAncestorOf( child );
|
||||
#else
|
||||
while ( child )
|
||||
{
|
||||
if ( child == item )
|
||||
return true;
|
||||
|
||||
child = child->parentItem();
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool qskIsVisibleToParent( const QQuickItem* item )
|
||||
|
@ -656,7 +675,7 @@ void qskItemUpdateRecursive( QQuickItem* item )
|
|||
qskItemUpdateRecursive( child );
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
|
||||
static const QQuickPointerTouchEvent* qskPointerPressEvent( const QQuickWindowPrivate* wd )
|
||||
{
|
||||
|
@ -693,7 +712,7 @@ bool qskGrabMouse( QQuickItem* item )
|
|||
|
||||
item->setKeepMouseGrab( true );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
|
||||
auto wd = QQuickWindowPrivate::get( item->window() );
|
||||
if ( wd->touchMouseDevice == nullptr )
|
||||
|
|
|
@ -53,6 +53,7 @@ QSK_EXPORT void qskSetPlacementPolicy( QQuickItem*, QskPlacementPolicy );
|
|||
|
||||
QSK_EXPORT QskPlacementPolicy::Policy qskEffectivePlacementPolicy( const QQuickItem* );
|
||||
|
||||
QSK_EXPORT QSizeF qskItemSize( const QQuickItem* );
|
||||
QSK_EXPORT QRectF qskItemRect( const QQuickItem* );
|
||||
|
||||
QSK_EXPORT QRectF qskItemGeometry( const QQuickItem* );
|
||||
|
|
|
@ -166,6 +166,12 @@ QskQuickItem::QskQuickItem( QskQuickItemPrivate& dd, QQuickItem* parent )
|
|||
{
|
||||
setFlag( QQuickItem::ItemHasContents, true );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
|
||||
// since Qt 5.10 we have QQuickItem::ItemEnabledHasChanged
|
||||
connect( this, &QQuickItem::enabledChanged,
|
||||
this, &QskQuickItem::sendEnabledChangeEvent );
|
||||
#endif
|
||||
|
||||
if ( dd.updateFlags & QskQuickItem::DeferredUpdate )
|
||||
qskFilterWindow( window() );
|
||||
|
||||
|
@ -183,6 +189,11 @@ QskQuickItem::~QskQuickItem()
|
|||
|
||||
if ( qskRegistry )
|
||||
qskRegistry->remove( this );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
|
||||
disconnect( this, &QQuickItem::enabledChanged,
|
||||
this, &QskQuickItem::sendEnabledChangeEvent );
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* QskQuickItem::className() const
|
||||
|
@ -580,6 +591,11 @@ void QskQuickItem::resetImplicitSize()
|
|||
}
|
||||
}
|
||||
|
||||
void QskQuickItem::sendEnabledChangeEvent()
|
||||
{
|
||||
qskSendEventTo( this, QEvent::EnabledChange );
|
||||
}
|
||||
|
||||
bool QskQuickItem::event( QEvent* event )
|
||||
{
|
||||
const int eventType = event->type();
|
||||
|
@ -771,11 +787,13 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change,
|
|||
|
||||
break;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||
case QQuickItem::ItemEnabledHasChanged:
|
||||
{
|
||||
qskSendEventTo( this, QEvent::EnabledChange );
|
||||
sendEnabledChangeEvent();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case QQuickItem::ItemVisibleHasChanged:
|
||||
{
|
||||
Q_D( QskQuickItem );
|
||||
|
|
|
@ -60,6 +60,9 @@ class QSK_EXPORT QskQuickItem : public QQuickItem
|
|||
bool hasChildItems() const;
|
||||
|
||||
QRectF rect() const;
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
|
||||
QSizeF size() const;
|
||||
#endif
|
||||
QSizeF implicitSize() const;
|
||||
|
||||
void setGeometry( qreal x, qreal y, qreal width, qreal height );
|
||||
|
@ -159,6 +162,7 @@ class QSK_EXPORT QskQuickItem : public QQuickItem
|
|||
void childrenRect() = delete;
|
||||
|
||||
void applyUpdateFlag( UpdateFlag, bool on );
|
||||
void sendEnabledChangeEvent();
|
||||
|
||||
QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override final;
|
||||
virtual QSGNode* updateItemPaintNode( QSGNode* );
|
||||
|
@ -194,6 +198,15 @@ inline void QskQuickItem::setSize( qreal width, qreal height )
|
|||
QQuickItem::setSize( QSizeF( width, height ) );
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
|
||||
|
||||
inline QSizeF QskQuickItem::size() const
|
||||
{
|
||||
return QSizeF( width(), height() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline QSizeF QskQuickItem::implicitSize() const
|
||||
{
|
||||
return QSizeF( implicitWidth(), implicitHeight() );
|
||||
|
|
|
@ -241,6 +241,7 @@ namespace
|
|||
|
||||
void itemChange( ItemChange, const ItemChangeData& ) override;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
void itemGeometryChanged( QQuickItem*,
|
||||
QQuickGeometryChange change, const QRectF& ) override
|
||||
{
|
||||
|
@ -248,6 +249,15 @@ namespace
|
|||
scrolledItemGeometryChange();
|
||||
}
|
||||
|
||||
#else
|
||||
void itemGeometryChanged( QQuickItem*,
|
||||
const QRectF& newRect, const QRectF& oldRect ) override
|
||||
{
|
||||
if ( oldRect.size() != newRect.size() )
|
||||
scrolledItemGeometryChange();
|
||||
}
|
||||
#endif
|
||||
|
||||
void updateNode( QSGNode* ) override;
|
||||
|
||||
private:
|
||||
|
@ -500,7 +510,7 @@ QSizeF QskScrollArea::layoutSizeHint( Qt::SizeHint which, const QSizeF& constrai
|
|||
}
|
||||
else
|
||||
{
|
||||
hint = contentItem->size();
|
||||
hint = qskItemSize( contentItem );
|
||||
}
|
||||
|
||||
if ( verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff )
|
||||
|
|
|
@ -332,7 +332,11 @@ QString QskSkin::dialogButtonText( int action ) const
|
|||
const auto theme = QGuiApplicationPrivate::platformTheme();
|
||||
|
||||
auto text = theme->standardButtonText( action );
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 7, 0 )
|
||||
text.remove( '&' );
|
||||
#else
|
||||
text = QPlatformTheme::removeMnemonics( text );
|
||||
#endif
|
||||
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,18 @@
|
|||
|
||||
static inline bool qskIsControl( const QskSkinnable* skinnable )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
return skinnable->metaObject()->inherits( &QskControl::staticMetaObject );
|
||||
#else
|
||||
for ( auto mo = skinnable->metaObject();
|
||||
mo != nullptr; mo = mo->superClass() )
|
||||
{
|
||||
if ( mo == &QskControl::staticMetaObject )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool qskSetFlag( QskSkinnable* skinnable,
|
||||
|
|
|
@ -126,8 +126,8 @@ void QskSubWindowArea::itemChange(
|
|||
{
|
||||
// the child is not fully constructed
|
||||
// and we have to delay checking for sub windows
|
||||
QMetaObject::invokeMethod( this,
|
||||
[ this ] { qskUpdateEventFilter( this ); }, Qt::QueuedConnection );
|
||||
QTimer::singleShot( 0, this,
|
||||
[ this ] { qskUpdateEventFilter( this ); } );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,10 @@ static inline void qskBindSignals(
|
|||
QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged,
|
||||
input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::textEdited,
|
||||
input, [ input ] { Q_EMIT input->textEdited( input->text() ); } );
|
||||
#endif
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged,
|
||||
input, &QskTextInput::validatorChanged );
|
||||
|
@ -48,8 +50,10 @@ static inline void qskBindSignals(
|
|||
QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged,
|
||||
input, [ input ] { qskPropagateReadOnly( input ); } );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged,
|
||||
input, &QskTextInput::overwriteModeChanged );
|
||||
#endif
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged,
|
||||
input, &QskTextInput::maximumLengthChanged );
|
||||
|
@ -215,7 +219,9 @@ namespace
|
|||
return;
|
||||
|
||||
setCursorVisible( on );
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
d->setBlinkingCursorEnabled( on );
|
||||
#endif
|
||||
|
||||
if ( !on )
|
||||
{
|
||||
|
@ -557,7 +563,11 @@ void QskTextInput::setActivationModes( ActivationModes modes )
|
|||
|
||||
static inline void qskUpdateInputMethodFont( const QskTextInput* input )
|
||||
{
|
||||
const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
|
||||
auto queries = Qt::ImCursorRectangle | Qt::ImFont;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
queries |= Qt::ImAnchorRectangle;
|
||||
#endif
|
||||
|
||||
qskUpdateInputMethod( input, queries );
|
||||
}
|
||||
|
||||
|
@ -777,6 +787,8 @@ QString QskTextInput::preeditText() const
|
|||
return d->m_textLayout.preeditAreaText();
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
|
||||
bool QskTextInput::overwriteMode() const
|
||||
{
|
||||
return m_data->textInput->overwriteMode();
|
||||
|
@ -787,6 +799,8 @@ void QskTextInput::setOverwriteMode( bool overwrite )
|
|||
m_data->textInput->setOverwriteMode( overwrite );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool QskTextInput::hasAcceptableInput() const
|
||||
{
|
||||
return m_data->textInput->hasAcceptableInput();
|
||||
|
@ -820,7 +834,9 @@ QVariant QskTextInput::inputMethodQuery(
|
|||
{
|
||||
return locale();
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
case Qt::ImInputItemClipRectangle:
|
||||
#endif
|
||||
case Qt::ImCursorRectangle:
|
||||
{
|
||||
QVariant v = m_data->textInput->inputMethodQuery( query, argument );
|
||||
|
|
|
@ -137,8 +137,10 @@ class QSK_EXPORT QskTextInput : public QskControl
|
|||
QString displayText() const;
|
||||
QString preeditText() const;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
bool overwriteMode() const;
|
||||
void setOverwriteMode( bool );
|
||||
#endif
|
||||
|
||||
bool hasAcceptableInput() const;
|
||||
bool fixup();
|
||||
|
@ -168,14 +170,20 @@ class QSK_EXPORT QskTextInput : public QskControl
|
|||
void textChanged( const QString& );
|
||||
void displayTextChanged( const QString& );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
|
||||
void textEdited( const QString& );
|
||||
#endif
|
||||
|
||||
void descriptionChanged( const QString& );
|
||||
|
||||
void textOptionsChanged();
|
||||
void fontRoleChanged();
|
||||
void alignmentChanged();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
void overwriteModeChanged( bool );
|
||||
#endif
|
||||
|
||||
void maximumLengthChanged( int );
|
||||
|
||||
void echoModeChanged( EchoMode );
|
||||
|
|
|
@ -204,6 +204,18 @@ QskWindow::~QskWindow()
|
|||
{
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 9, 0 )
|
||||
|
||||
void QskWindow::setFlag(Qt::WindowType flag, bool on)
|
||||
{
|
||||
if( on )
|
||||
setFlags( flags() | flag );
|
||||
else
|
||||
setFlags( flags() & ~flag );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void QskWindow::setScreen( const QString& name )
|
||||
{
|
||||
if ( !name.isEmpty() )
|
||||
|
|
|
@ -43,6 +43,10 @@ class QSK_EXPORT QskWindow : public QQuickWindow
|
|||
using Inherited::setScreen;
|
||||
void setScreen( const QString& );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 9, 0 )
|
||||
void setFlag( Qt::WindowType, bool on = true );
|
||||
#endif
|
||||
|
||||
bool deleteOnClose() const;
|
||||
void setDeleteOnClose( bool );
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ QskGraphicProvider* QskGraphicProviderMap::take( const QString& providerId )
|
|||
{
|
||||
QskGraphicProvider* provider = nullptr;
|
||||
|
||||
const auto it = m_data->hashTab.constFind( qskKey( providerId ) );
|
||||
if ( it != m_data->hashTab.constEnd() )
|
||||
const auto it = m_data->hashTab.find( qskKey( providerId ) );
|
||||
if ( it != m_data->hashTab.end() )
|
||||
{
|
||||
provider = it.value();
|
||||
m_data->hashTab.erase( it );
|
||||
|
@ -67,8 +67,8 @@ QskGraphicProvider* QskGraphicProviderMap::take( const QString& providerId )
|
|||
|
||||
QskGraphicProvider* QskGraphicProviderMap::provider( const QString& providerId ) const
|
||||
{
|
||||
const auto it = m_data->hashTab.constFind( qskKey( providerId ) );
|
||||
if ( it == m_data->hashTab.constEnd() )
|
||||
const auto it = m_data->hashTab.find( qskKey( providerId ) );
|
||||
if ( it == m_data->hashTab.end() )
|
||||
return nullptr;
|
||||
|
||||
if ( it.value().isNull() )
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
|
||||
class QskGraphic;
|
||||
|
||||
namespace QskStandardSymbol
|
||||
class QSK_EXPORT QskStandardSymbol
|
||||
{
|
||||
QSK_EXPORT Q_NAMESPACE
|
||||
Q_GADGET
|
||||
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
NoSymbol = -1,
|
||||
|
@ -30,9 +31,9 @@ namespace QskStandardSymbol
|
|||
SymbolTypeCount
|
||||
};
|
||||
|
||||
Q_ENUM_NS( Type )
|
||||
Q_ENUM( Type )
|
||||
|
||||
QSK_EXPORT QskGraphic graphic( Type );
|
||||
}
|
||||
static QskGraphic graphic( Type );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -454,6 +454,7 @@ void QskInputPanel::updateInputPanel( Qt::InputMethodQueries queries )
|
|||
setLocale( event.value( Qt::ImPreferredLanguage ).toLocale() );
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
|
||||
if ( queries & Qt::ImInputItemClipRectangle )
|
||||
{
|
||||
/*
|
||||
|
@ -461,6 +462,7 @@ void QskInputPanel::updateInputPanel( Qt::InputMethodQueries queries )
|
|||
so that it does not hide the item.
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void QskInputPanel::updateLocale( const QLocale& locale )
|
||||
|
|
|
@ -27,11 +27,15 @@
|
|||
|
||||
static inline bool qskHasOpenGLRenderer( const QQuickWindow* window )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
if ( window == nullptr )
|
||||
return false;
|
||||
|
||||
const auto renderer = window->rendererInterface();
|
||||
return renderer->graphicsApi() == QSGRendererInterface::OpenGL;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint qskCreateTextureOpenGL( QQuickWindow* window,
|
||||
|
|
|
@ -21,7 +21,11 @@ class QskTickmarksNodePrivate final : public QSGGeometryNodePrivate
|
|||
QskTickmarksNodePrivate()
|
||||
: geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
|
||||
geometry.setDrawingMode( QSGGeometry::DrawLines );
|
||||
#else
|
||||
geometry.setDrawingMode( GL_LINES );
|
||||
#endif
|
||||
geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
CONFIG += qskexample
|
||||
CONFIG += console
|
||||
CONFIG += testcase
|
||||
|
||||
QT += testlib
|
||||
|
||||
HEADERS += \
|
||||
main.h
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
|
@ -1,223 +0,0 @@
|
|||
#include "main.h"
|
||||
|
||||
#include <QskCheckBox.h>
|
||||
|
||||
void CheckBoxTests::init()
|
||||
{
|
||||
root = new QskControl();
|
||||
}
|
||||
|
||||
void CheckBoxTests::cleanup()
|
||||
{
|
||||
delete root;
|
||||
}
|
||||
|
||||
void CheckBoxTests::checkbox()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
QVERIFY( t->isCheckable() );
|
||||
}
|
||||
|
||||
void CheckBoxTests::click()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
t->click();
|
||||
QVERIFY( t->isChecked() );
|
||||
}
|
||||
|
||||
void CheckBoxTests::toggle()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
t->toggle();
|
||||
QVERIFY( t->isChecked() );
|
||||
|
||||
t->toggle();
|
||||
QVERIFY( t->isChecked() == false );
|
||||
}
|
||||
|
||||
void CheckBoxTests::tristate()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
QVERIFY( t->isTristate() == false );
|
||||
|
||||
t->setCheckState( Qt::CheckState::PartiallyChecked );
|
||||
|
||||
QVERIFY( t->isChecked() == true );
|
||||
QVERIFY( t->isTristate() == true );
|
||||
}
|
||||
|
||||
void CheckBoxTests::higherGroupUpdatesLower()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
auto t3 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t2 );
|
||||
t->addToGroup( t3 );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
QVERIFY( t1->isChecked() == false );
|
||||
QVERIFY( t2->isChecked() == false );
|
||||
QVERIFY( t3->isChecked() == false );
|
||||
|
||||
t->setChecked( true );
|
||||
QVERIFY( t->isChecked() );
|
||||
QVERIFY( t1->isChecked() );
|
||||
QVERIFY( t2->isChecked() );
|
||||
QVERIFY( t3->isChecked() );
|
||||
|
||||
t->setChecked( false );
|
||||
QVERIFY( t->isChecked() == false );
|
||||
QVERIFY( t1->isChecked() == false );
|
||||
QVERIFY( t2->isChecked() == false );
|
||||
QVERIFY( t3->isChecked() == false );
|
||||
|
||||
}
|
||||
|
||||
void CheckBoxTests::lowerGroupUpdatesHigher()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t2 );
|
||||
|
||||
t1->setChecked( true );
|
||||
QVERIFY( t->isChecked() );
|
||||
QVERIFY( t->isTristate() );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
QVERIFY( t1->isChecked() == true );
|
||||
QVERIFY( t2->isChecked() == false );
|
||||
|
||||
|
||||
t2->setChecked( true );
|
||||
QVERIFY( t->isChecked() );
|
||||
QVERIFY( t->isTristate() );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::Checked );
|
||||
QVERIFY( t1->isChecked() == true );
|
||||
QVERIFY( t2->isChecked() == true );
|
||||
|
||||
t1->setChecked( false );
|
||||
QVERIFY( t->isChecked() );
|
||||
QVERIFY( t->isTristate() );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
QVERIFY( t1->isChecked() == false );
|
||||
QVERIFY( t2->isChecked() == true );
|
||||
|
||||
t2->setChecked( false );
|
||||
QVERIFY( t->isChecked() == false );
|
||||
QVERIFY( t->isTristate() );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::Unchecked );
|
||||
QVERIFY( t1->isChecked() == false );
|
||||
QVERIFY( t2->isChecked() == false );
|
||||
}
|
||||
|
||||
void CheckBoxTests::addToGroup()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t2 );
|
||||
|
||||
t->setChecked( true );
|
||||
QVERIFY( t->isChecked() );
|
||||
QVERIFY( t1->isChecked() );
|
||||
QVERIFY( t2->isChecked() );
|
||||
|
||||
auto t3 = new QskCheckBox( root );
|
||||
t->addToGroup( t3 );
|
||||
|
||||
QVERIFY( t->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
|
||||
t3->setChecked( true );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::Checked );
|
||||
auto t4 = new QskCheckBox( root );
|
||||
t4->setChecked( true );
|
||||
t->addToGroup( t4 );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::Checked );
|
||||
}
|
||||
|
||||
void CheckBoxTests::addPartlyToGroup() {
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t1a = new QskCheckBox( root );
|
||||
auto t1b = new QskCheckBox( root );
|
||||
|
||||
t1->addToGroup( t1a );
|
||||
t1->addToGroup( t1b );
|
||||
|
||||
t1a->setChecked( true );
|
||||
|
||||
QVERIFY( t1->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
t->addToGroup( t1 );
|
||||
QVERIFY( t1->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
}
|
||||
|
||||
void CheckBoxTests::removeFromGroup()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t2 );
|
||||
|
||||
t2->setChecked( true );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
|
||||
t->removeFromGroup( t2 );
|
||||
QVERIFY( t->isChecked() == false );
|
||||
}
|
||||
|
||||
void CheckBoxTests::groupMemberGetsDeleted()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t2 );
|
||||
|
||||
t2->setChecked( true );
|
||||
QVERIFY( t->checkState() == Qt::CheckState::PartiallyChecked );
|
||||
|
||||
delete t2;
|
||||
QVERIFY( t->isChecked() == false );
|
||||
}
|
||||
|
||||
void CheckBoxTests::addTwiceToSameGroup()
|
||||
{
|
||||
auto t = new QskCheckBox( root );
|
||||
|
||||
auto t1 = new QskCheckBox( root );
|
||||
auto t2 = new QskCheckBox( root );
|
||||
|
||||
t->addToGroup( t1 );
|
||||
t->addToGroup( t1 );
|
||||
t->removeFromGroup( t1 );
|
||||
|
||||
t->addToGroup( t2 );
|
||||
|
||||
t2->setChecked( true );
|
||||
|
||||
QVERIFY( t->checkState() == Qt::CheckState::Checked );
|
||||
}
|
||||
|
||||
#include "moc_main.cpp"
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <qobject.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class QskControl;
|
||||
class CheckBoxTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QskControl * root;
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void checkbox();
|
||||
void click();
|
||||
void toggle();
|
||||
void tristate();
|
||||
void higherGroupUpdatesLower();
|
||||
void lowerGroupUpdatesHigher();
|
||||
void addToGroup();
|
||||
void addPartlyToGroup();
|
||||
void removeFromGroup();
|
||||
void groupMemberGetsDeleted();
|
||||
void addTwiceToSameGroup();
|
||||
};
|
||||
|
||||
QTEST_MAIN(CheckBoxTests)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
checkboxes
|
||||
|
Loading…
Reference in New Issue