upport for Qt < Qt 5.12 dropped

This commit is contained in:
Uwe Rathmann 2022-03-08 11:53:46 +01:00
parent 2bfb68c7de
commit ae2c6d87a8
29 changed files with 32 additions and 316 deletions

View File

@ -25,9 +25,9 @@ controls is limited to the needs of the driving projects.
QSkinny is supposed to run on all platforms being supported by Qt/Quick. QSkinny is supposed to run on all platforms being supported by Qt/Quick.
But so far only Linux is actively tested. But so far only Linux is actively tested.
It might support all versions Qt >= 5.6, but you can rely on: It might support all versions Qt >= 5.12, but you can rely on:
- Qt 5.6 - Qt 5.15
- current long term supported ( LTS ) version of Qt - current long term supported ( LTS ) version of Qt
- current version of Qt - current version of Qt

View File

@ -28,11 +28,7 @@ namespace
LinesNode( int lineCount = 0 ) LinesNode( int lineCount = 0 )
: m_geometry( QSGGeometry::defaultAttributes_Point2D(), 2 * lineCount ) : m_geometry( QSGGeometry::defaultAttributes_Point2D(), 2 * lineCount )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
m_geometry.setDrawingMode( QSGGeometry::DrawLines ); m_geometry.setDrawingMode( QSGGeometry::DrawLines );
#else
m_geometry.setDrawingMode( GL_LINES );
#endif
m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern ); m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
setGeometry( &m_geometry ); setGeometry( &m_geometry );

View File

@ -46,7 +46,7 @@ MenuBar::MenuBar( QQuickItem* parent )
m_entryStrings = { "Dashboard", "Rooms", "Devices", "Statistics", "Storage", "Members" }; m_entryStrings = { "Dashboard", "Rooms", "Devices", "Statistics", "Storage", "Members" };
for( const auto& entryString : qskAsConst( m_entryStrings ) ) for( const auto& entryString : qAsConst( m_entryStrings ) )
{ {
auto* entry = new MenuItem( entryString, this ); auto* entry = new MenuItem( entryString, this );
m_entries.append( entry ); m_entries.append( entry );

View File

@ -31,29 +31,6 @@ qvgrcc.CONFIG += add_inputs_as_makefile_deps
QRC_SHADOW_CLONE = $$shell_path( $${OUT_PWD}/${QMAKE_FILE_BASE}_shadow.qrc ) QRC_SHADOW_CLONE = $$shell_path( $${OUT_PWD}/${QMAKE_FILE_BASE}_shadow.qrc )
qtPrepareTool(QMAKE_RCC, rcc, _DEP) qtPrepareTool(QMAKE_RCC, rcc, _DEP)
lessThan(QT_MAJOR_VERSION, 6): lessThan(QT_MINOR_VERSION, 12) {
# 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 {
equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { equals( OUT_PWD, $${_PRO_FILE_PWD_} ) {
qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
@ -65,7 +42,6 @@ lessThan(QT_MAJOR_VERSION, 6): lessThan(QT_MINOR_VERSION, 12) {
$$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \ $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \
$${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE} $${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE}
} }
}
equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { equals( OUT_PWD, $${_PRO_FILE_PWD_} ) {

View File

@ -39,23 +39,6 @@
#define QSK_QT_PRIVATE_END \ #define QSK_QT_PRIVATE_END \
QT_WARNING_POP 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
#ifdef Q_FALLTHROUGH #ifdef Q_FALLTHROUGH
#define QSK_FALLTHROUGH Q_FALLTHROUGH #define QSK_FALLTHROUGH Q_FALLTHROUGH
#else #else

View File

@ -9,36 +9,9 @@
#include "QskGlobal.h" #include "QskGlobal.h"
#include <qmetaobject.h> #include <qmetaobject.h>
#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 ) namespace Qsk
// 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 QSK_Q_NAMESPACE QSK_EXPORT Q_NAMESPACE
enum Direction enum Direction
{ {
@ -47,7 +20,7 @@ QSK_NAMESPACE( Qsk )
TopToBottom, TopToBottom,
BottomToTop BottomToTop
}; };
QSK_ENUM( Direction ) Q_ENUM_NS( Direction )
enum Position enum Position
{ {
@ -56,7 +29,7 @@ QSK_NAMESPACE( Qsk )
Right, Right,
Bottom Bottom
}; };
QSK_ENUM( Position ) Q_ENUM_NS( Position )
enum TextStyle enum TextStyle
{ {
@ -65,11 +38,7 @@ QSK_NAMESPACE( Qsk )
Raised, Raised,
Sunken Sunken
}; };
QSK_ENUM( TextStyle ) Q_ENUM_NS( TextStyle )
} }
#undef QSK_NAMESPACE
#undef QSK_ENUM
#undef QSK_Q_NAMESPACE
#endif #endif

View File

@ -162,7 +162,7 @@ void CounterHook::addObject( QObject* object )
{ {
const bool isItem = qskIsItem( object ); const bool isItem = qskIsItem( object );
for ( auto counterData : qskAsConst( m_counterDataSet ) ) for ( auto counterData : qAsConst( m_counterDataSet ) )
{ {
counterData->counter[ QskObjectCounter::Objects ].increment(); counterData->counter[ QskObjectCounter::Objects ].increment();
@ -182,7 +182,7 @@ void CounterHook::removeObject( QObject* object )
{ {
const bool isItem = qskIsItem( object ); const bool isItem = qskIsItem( object );
for ( auto counterData : qskAsConst( m_counterDataSet ) ) for ( auto counterData : qAsConst( m_counterDataSet ) )
{ {
counterData->counter[ QskObjectCounter::Objects ].decrement(); counterData->counter[ QskObjectCounter::Objects ].decrement();

View File

@ -5,14 +5,6 @@
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h> #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> #include <private/qhighdpiscaling_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END

View File

@ -758,55 +758,6 @@ bool QskControl::event( QEvent* event )
bool QskControl::childMouseEventFilter( QQuickItem* item, 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 ); return d_func()->maybeGesture( item, event );
} }

View File

@ -105,10 +105,8 @@ qreal qskWheelIncrement( const QWheelEvent* event )
auto angleDelta = event->angleDelta(); auto angleDelta = event->angleDelta();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
if ( event->inverted() ) if ( event->inverted() )
angleDelta.setY( -angleDelta.y() ); angleDelta.setY( -angleDelta.y() );
#endif
const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x(); const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
return delta / QWheelEvent::DefaultDeltasPerStep; return delta / QWheelEvent::DefaultDeltasPerStep;

View File

@ -49,7 +49,7 @@ class QskFocusIndicator::PrivateData
public: public:
void resetConnections() void resetConnections()
{ {
for ( const auto& connection : qskAsConst( connections ) ) for ( const auto& connection : qAsConst( connections ) )
QObject::disconnect( connection ); QObject::disconnect( connection );
connections.clear(); connections.clear();

View File

@ -130,7 +130,7 @@ namespace
{ {
Timer* timer = nullptr; Timer* timer = nullptr;
for ( auto t : qskAsConst( m_table ) ) for ( auto t : qAsConst( m_table ) )
{ {
if ( t->recognizer() == nullptr || if ( t->recognizer() == nullptr ||
t->recognizer() == recognizer ) t->recognizer() == recognizer )
@ -151,7 +151,7 @@ namespace
void stopTimer( const QskGestureRecognizer* recognizer ) void stopTimer( const QskGestureRecognizer* recognizer )
{ {
for ( auto timer : qskAsConst( m_table ) ) for ( auto timer : qAsConst( m_table ) )
{ {
if ( timer->recognizer() == recognizer ) if ( timer->recognizer() == recognizer )
{ {

View File

@ -74,7 +74,6 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener
} }
private: private:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
void itemGeometryChanged( QQuickItem* item, void itemGeometryChanged( QQuickItem* item,
QQuickGeometryChange change, const QRectF& ) override QQuickGeometryChange change, const QRectF& ) override
{ {
@ -88,21 +87,6 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener
if ( doUpdate ) if ( doUpdate )
m_grabber->updateGeometry(); 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 void itemParentChanged( QQuickItem* item, QQuickItem* parentItem ) override
{ {
@ -125,9 +109,7 @@ QskInputGrabber::QskInputGrabber( QQuickItem* parent )
, m_data( new PrivateData( this ) ) , m_data( new PrivateData( this ) )
{ {
setAcceptedMouseButtons( Qt::AllButtons ); setAcceptedMouseButtons( Qt::AllButtons );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
setAcceptTouchEvents( true ); setAcceptTouchEvents( true );
#endif
setAcceptHoverEvents( true ); setAcceptHoverEvents( true );
setTransparentForPositioner( true ); setTransparentForPositioner( true );

View File

@ -323,10 +323,7 @@ QPointF QskListView::scrollOffset( const QWheelEvent* event ) const
const auto viewHeight = viewContentsRect().height(); const auto viewHeight = viewContentsRect().height();
const qreal rowHeight = this->rowHeight(); const qreal rowHeight = this->rowHeight();
int numLines = 3; const int numLines = QGuiApplication::styleHints()->wheelScrollLines();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
numLines = QGuiApplication::styleHints()->wheelScrollLines();
#endif
qreal dy = numLines * rowHeight; qreal dy = numLines * rowHeight;
if ( event->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier ) ) if ( event->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier ) )

View File

@ -58,19 +58,7 @@ bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child )
if ( item == nullptr || child == nullptr ) if ( item == nullptr || child == nullptr )
return false; return false;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
return item->isAncestorOf( child ); return item->isAncestorOf( child );
#else
while ( child )
{
if ( child == item )
return true;
child = child->parentItem();
}
return false;
#endif
} }
bool qskIsVisibleToParent( const QQuickItem* item ) bool qskIsVisibleToParent( const QQuickItem* item )
@ -645,7 +633,7 @@ void qskItemUpdateRecursive( QQuickItem* item )
qskItemUpdateRecursive( child ); qskItemUpdateRecursive( child );
} }
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
static const QQuickPointerTouchEvent* qskPointerPressEvent( const QQuickWindowPrivate* wd ) static const QQuickPointerTouchEvent* qskPointerPressEvent( const QQuickWindowPrivate* wd )
{ {
@ -682,7 +670,7 @@ bool qskGrabMouse( QQuickItem* item )
item->setKeepMouseGrab( true ); item->setKeepMouseGrab( true );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
auto wd = QQuickWindowPrivate::get( item->window() ); auto wd = QQuickWindowPrivate::get( item->window() );
if ( wd->touchMouseDevice == nullptr ) if ( wd->touchMouseDevice == nullptr )

View File

@ -157,12 +157,6 @@ QskQuickItem::QskQuickItem( QskQuickItemPrivate& dd, QQuickItem* parent )
{ {
setFlag( QQuickItem::ItemHasContents, true ); 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 ) if ( dd.updateFlags & QskQuickItem::DeferredUpdate )
qskFilterWindow( window() ); qskFilterWindow( window() );
@ -180,11 +174,6 @@ QskQuickItem::~QskQuickItem()
if ( qskRegistry ) if ( qskRegistry )
qskRegistry->remove( this ); 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 const char* QskQuickItem::className() const
@ -597,11 +586,6 @@ void QskQuickItem::resetImplicitSize()
} }
} }
void QskQuickItem::sendEnabledChangeEvent()
{
qskSendEventTo( this, QEvent::EnabledChange );
}
bool QskQuickItem::event( QEvent* event ) bool QskQuickItem::event( QEvent* event )
{ {
const int eventType = event->type(); const int eventType = event->type();
@ -796,7 +780,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change,
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
case QQuickItem::ItemEnabledHasChanged: case QQuickItem::ItemEnabledHasChanged:
{ {
sendEnabledChangeEvent(); qskSendEventTo( this, QEvent::EnabledChange );
break; break;
} }
#endif #endif

View File

@ -63,9 +63,6 @@ class QSK_EXPORT QskQuickItem : public QQuickItem
bool hasChildItems() const; bool hasChildItems() const;
QRectF rect() const; QRectF rect() const;
#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 )
QSizeF size() const;
#endif
QSizeF implicitSize() const; QSizeF implicitSize() const;
void setGeometry( qreal x, qreal y, qreal width, qreal height ); void setGeometry( qreal x, qreal y, qreal width, qreal height );
@ -168,7 +165,6 @@ class QSK_EXPORT QskQuickItem : public QQuickItem
void childrenRect() = delete; void childrenRect() = delete;
void applyUpdateFlag( UpdateFlag, bool on ); void applyUpdateFlag( UpdateFlag, bool on );
void sendEnabledChangeEvent();
QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override final; QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override final;
virtual QSGNode* updateItemPaintNode( QSGNode* ); virtual QSGNode* updateItemPaintNode( QSGNode* );
@ -204,15 +200,6 @@ inline void QskQuickItem::setSize( qreal width, qreal height )
QQuickItem::setSize( QSizeF( width, 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 inline QSizeF QskQuickItem::implicitSize() const
{ {
return QSizeF( implicitWidth(), implicitHeight() ); return QSizeF( implicitWidth(), implicitHeight() );

View File

@ -241,7 +241,6 @@ namespace
void itemChange( ItemChange, const ItemChangeData& ) override; void itemChange( ItemChange, const ItemChangeData& ) override;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
void itemGeometryChanged( QQuickItem*, void itemGeometryChanged( QQuickItem*,
QQuickGeometryChange change, const QRectF& ) override QQuickGeometryChange change, const QRectF& ) override
{ {
@ -249,15 +248,6 @@ namespace
scrolledItemGeometryChange(); scrolledItemGeometryChange();
} }
#else
void itemGeometryChanged( QQuickItem*,
const QRectF& newRect, const QRectF& oldRect ) override
{
if ( oldRect.size() != newRect.size() )
scrolledItemGeometryChange();
}
#endif
void updateNode( QSGNode* ) override; void updateNode( QSGNode* ) override;
private: private:

View File

@ -173,7 +173,7 @@ void QskShortcutHandler::remove( int id )
Finally let's check if we can disconnect Finally let's check if we can disconnect
from the destroyed signals from the destroyed signals
*/ */
for ( const auto& entry : qskAsConst( m_invokeDataMap ) ) for ( const auto& entry : qAsConst( m_invokeDataMap ) )
{ {
if ( item == nullptr && receiver == nullptr ) if ( item == nullptr && receiver == nullptr )
break; break;
@ -276,7 +276,7 @@ bool QskShortcutHandler::invoke( QQuickItem* item, const QKeySequence& sequence
{ {
bool found = false; bool found = false;
for ( const auto& entry : qskAsConst( m_invokeDataMap ) ) for ( const auto& entry : qAsConst( m_invokeDataMap ) )
{ {
auto& data = entry.second; auto& data = entry.second;

View File

@ -341,7 +341,7 @@ class QskSkinManager::PrivateData
{ {
if ( !pluginsRegistered ) if ( !pluginsRegistered )
{ {
for ( const auto& path : qskAsConst( pluginPaths ) ) for ( const auto& path : qAsConst( pluginPaths ) )
registerPlugins( path + QStringLiteral( "/skins" ) ); registerPlugins( path + QStringLiteral( "/skins" ) );
pluginsRegistered = true; pluginsRegistered = true;

View File

@ -35,18 +35,7 @@
static inline bool qskIsControl( const QskSkinnable* skinnable ) static inline bool qskIsControl( const QskSkinnable* skinnable )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
return skinnable->metaObject()->inherits( &QskControl::staticMetaObject ); 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 QVariant qskTypedNullValue( const QVariant& value ) static inline QVariant qskTypedNullValue( const QVariant& value )

View File

@ -36,10 +36,8 @@ static inline void qskBindSignals(
QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged, QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged,
input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } ); input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
QObject::connect( wrappedInput, &QQuickTextInput::textEdited, QObject::connect( wrappedInput, &QQuickTextInput::textEdited,
input, [ input ] { Q_EMIT input->textEdited( input->text() ); } ); input, [ input ] { Q_EMIT input->textEdited( input->text() ); } );
#endif
QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged, QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged,
input, &QskTextInput::validatorChanged ); input, &QskTextInput::validatorChanged );
@ -50,10 +48,8 @@ static inline void qskBindSignals(
QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged, QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged,
input, [ input ] { qskPropagateReadOnly( input ); } ); input, [ input ] { qskPropagateReadOnly( input ); } );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged, QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged,
input, &QskTextInput::overwriteModeChanged ); input, &QskTextInput::overwriteModeChanged );
#endif
QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged, QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged,
input, &QskTextInput::maximumLengthChanged ); input, &QskTextInput::maximumLengthChanged );
@ -219,9 +215,7 @@ namespace
return; return;
setCursorVisible( on ); setCursorVisible( on );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
d->setBlinkingCursorEnabled( on ); d->setBlinkingCursorEnabled( on );
#endif
if ( !on ) if ( !on )
{ {
@ -561,11 +555,7 @@ void QskTextInput::setActivationModes( ActivationModes modes )
static inline void qskUpdateInputMethodFont( const QskTextInput* input ) static inline void qskUpdateInputMethodFont( const QskTextInput* input )
{ {
auto queries = Qt::ImCursorRectangle | Qt::ImFont; const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
queries |= Qt::ImAnchorRectangle;
#endif
qskUpdateInputMethod( input, queries ); qskUpdateInputMethod( input, queries );
} }
@ -785,8 +775,6 @@ QString QskTextInput::preeditText() const
return d->m_textLayout.preeditAreaText(); return d->m_textLayout.preeditAreaText();
} }
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
bool QskTextInput::overwriteMode() const bool QskTextInput::overwriteMode() const
{ {
return m_data->textInput->overwriteMode(); return m_data->textInput->overwriteMode();
@ -797,8 +785,6 @@ void QskTextInput::setOverwriteMode( bool overwrite )
m_data->textInput->setOverwriteMode( overwrite ); m_data->textInput->setOverwriteMode( overwrite );
} }
#endif
bool QskTextInput::hasAcceptableInput() const bool QskTextInput::hasAcceptableInput() const
{ {
return m_data->textInput->hasAcceptableInput(); return m_data->textInput->hasAcceptableInput();
@ -832,9 +818,7 @@ QVariant QskTextInput::inputMethodQuery(
{ {
return locale(); return locale();
} }
#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 )
case Qt::ImInputItemClipRectangle: case Qt::ImInputItemClipRectangle:
#endif
case Qt::ImCursorRectangle: case Qt::ImCursorRectangle:
{ {
QVariant v = m_data->textInput->inputMethodQuery( query, argument ); QVariant v = m_data->textInput->inputMethodQuery( query, argument );

View File

@ -137,10 +137,8 @@ class QSK_EXPORT QskTextInput : public QskControl
QString displayText() const; QString displayText() const;
QString preeditText() const; QString preeditText() const;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
bool overwriteMode() const; bool overwriteMode() const;
void setOverwriteMode( bool ); void setOverwriteMode( bool );
#endif
bool hasAcceptableInput() const; bool hasAcceptableInput() const;
bool fixup(); bool fixup();
@ -170,20 +168,14 @@ class QSK_EXPORT QskTextInput : public QskControl
void textChanged( const QString& ); void textChanged( const QString& );
void displayTextChanged( const QString& ); void displayTextChanged( const QString& );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 )
void textEdited( const QString& ); void textEdited( const QString& );
#endif
void descriptionChanged( const QString& ); void descriptionChanged( const QString& );
void textOptionsChanged(); void textOptionsChanged();
void fontRoleChanged(); void fontRoleChanged();
void alignmentChanged(); void alignmentChanged();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
void overwriteModeChanged( bool ); void overwriteModeChanged( bool );
#endif
void maximumLengthChanged( int ); void maximumLengthChanged( int );
void echoModeChanged( EchoMode ); void echoModeChanged( EchoMode );

View File

@ -201,37 +201,8 @@ QskWindow::QskWindow( QQuickRenderControl* renderControl, QWindow* parent )
QskWindow::~QskWindow() QskWindow::~QskWindow()
{ {
#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 0 )
// When being used from Qml the item destruction would run in the most
// unefficient way, leading to lots of QQuickItem::ItemChildRemovedChange
// depending operations.
QVector< QPointer< QQuickItem > > items;
const auto children = contentItem()->childItems();
for ( auto child : children )
{
if ( child->parent() == contentItem() )
items += child;
} }
for ( auto& item : qskAsConst( items ) )
delete item;
#endif
}
#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 ) void QskWindow::setScreen( const QString& name )
{ {
if ( !name.isEmpty() ) if ( !name.isEmpty() )

View File

@ -43,10 +43,6 @@ class QSK_EXPORT QskWindow : public QQuickWindow
using Inherited::setScreen; using Inherited::setScreen;
void setScreen( const QString& ); void setScreen( const QString& );
#if QT_VERSION < QT_VERSION_CHECK( 5, 9, 0 )
void setFlag( Qt::WindowType, bool on = true );
#endif
bool deleteOnClose() const; bool deleteOnClose() const;
void setDeleteOnClose( bool ); void setDeleteOnClose( bool );

View File

@ -131,7 +131,7 @@ QskDialogButtonBox::~QskDialogButtonBox()
{ {
for ( int i = 0; i < QskDialog::NActionRoles; i++ ) for ( int i = 0; i < QskDialog::NActionRoles; i++ )
{ {
for ( auto button : qskAsConst( m_data->buttons[ i ] ) ) for ( auto button : qAsConst( m_data->buttons[ i ] ) )
{ {
/* /*
The destructor of QQuickItem sets the parentItem of The destructor of QQuickItem sets the parentItem of
@ -595,14 +595,9 @@ QString QskDialogButtonBox::buttonText( QskDialog::Action action )
{ {
// should be redirected through the skin ! // should be redirected through the skin !
const QPlatformTheme* theme = QGuiApplicationPrivate::platformTheme(); const auto theme = QGuiApplicationPrivate::platformTheme();
QString text = theme->standardButtonText( action ); QString text = theme->standardButtonText( action );
#if QT_VERSION < QT_VERSION_CHECK( 5, 7, 0 )
text.remove( '&' );
#else
text = QPlatformTheme::removeMnemonics( text ); text = QPlatformTheme::removeMnemonics( text );
#endif
return text; return text;
} }

View File

@ -565,7 +565,7 @@ QRectF QskGraphic::scaledBoundingRect( qreal sx, qreal sy ) const
QRectF rect = transform.mapRect( m_data->pointRect ); QRectF rect = transform.mapRect( m_data->pointRect );
for ( const auto& info : qskAsConst( m_data->pathInfos ) ) for ( const auto& info : qAsConst( m_data->pathInfos ) )
rect |= info.scaledBoundingRect( sx, sy, scalePens ); rect |= info.scaledBoundingRect( sx, sy, scalePens );
return rect; return rect;
@ -678,7 +678,7 @@ void QskGraphic::render( QPainter* painter, const QRectF& rect,
const bool scalePens = !( m_data->renderHints & RenderPensUnscaled ); const bool scalePens = !( m_data->renderHints & RenderPensUnscaled );
for ( const auto& info : qskAsConst( m_data->pathInfos ) ) for ( const auto& info : qAsConst( m_data->pathInfos ) )
{ {
const qreal ssx = info.scaleFactorX( const qreal ssx = info.scaleFactorX(
m_data->pointRect, rect, scalePens ); m_data->pointRect, rect, scalePens );

View File

@ -316,7 +316,7 @@ void QskStackBox::autoRemoveItem( QQuickItem* item )
void QskStackBox::clear( bool autoDelete ) void QskStackBox::clear( bool autoDelete )
{ {
for ( const auto item : qskAsConst( m_data->items ) ) for ( const auto item : qAsConst( m_data->items ) )
{ {
if( autoDelete && ( item->parent() == this ) ) if( autoDelete && ( item->parent() == this ) )
delete item; delete item;

View File

@ -21,11 +21,7 @@ class QskTickmarksNodePrivate final : public QSGGeometryNodePrivate
QskTickmarksNodePrivate() QskTickmarksNodePrivate()
: geometry( QSGGeometry::defaultAttributes_Point2D(), 0 ) : geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
geometry.setDrawingMode( QSGGeometry::DrawLines ); geometry.setDrawingMode( QSGGeometry::DrawLines );
#else
geometry.setDrawingMode( GL_LINES );
#endif
geometry.setVertexDataPattern( QSGGeometry::StaticPattern ); geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
} }