adjustments for Qt 6.0.0 beta5

This commit is contained in:
Uwe Rathmann 2020-11-21 20:36:47 +01:00
parent 6be542394a
commit e8351e4496
5 changed files with 38 additions and 8 deletions

View File

@ -35,6 +35,12 @@ QStringList QskMain::skinList() const
QQmlListProperty< QObject > QskMain::data() QQmlListProperty< QObject > QskMain::data()
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
using SizeType = qsizetype;
#else
using SizeType = int;
#endif
return QQmlListProperty< QObject >( return QQmlListProperty< QObject >(
this, nullptr, this, nullptr,
[]( QQmlListProperty< QObject >* property, QObject* value ) []( QQmlListProperty< QObject >* property, QObject* value )
@ -45,9 +51,9 @@ QQmlListProperty< QObject > QskMain::data()
[]( QQmlListProperty< QObject >* property ) []( QQmlListProperty< QObject >* property )
{ {
auto main = static_cast< const QskMain* >( property->object ); auto main = static_cast< const QskMain* >( property->object );
return static_cast< int >( main->m_data.count() ); return static_cast< SizeType >( main->m_data.count() );
}, },
[]( QQmlListProperty< QObject >* property, int index ) []( QQmlListProperty< QObject >* property, SizeType index )
{ {
auto main = static_cast< const QskMain* >( property->object ); auto main = static_cast< const QskMain* >( property->object );
return main->m_data.at( index ); return main->m_data.at( index );

View File

@ -163,7 +163,7 @@ QKeySequence QskShortcutQml::sequence() const
void QskShortcutQml::setSequenceVariant( const QVariant& sequence ) void QskShortcutQml::setSequenceVariant( const QVariant& sequence )
{ {
if ( sequence.type() == QVariant::Int ) if ( sequence.userType() == QVariant::Int )
setSequence( static_cast< QKeySequence::StandardKey >( sequence.toInt() ) ); setSequence( static_cast< QKeySequence::StandardKey >( sequence.toInt() ) );
else else
setSequence( QKeySequence::fromString( sequence.toString() ) ); setSequence( QKeySequence::fromString( sequence.toString() ) );

View File

@ -13,20 +13,40 @@ QSK_QT_PRIVATE_BEGIN
#include <private/qquickwindow_p.h> #include <private/qquickwindow_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END
static QMouseEvent* qskClonedMouseEventAt(
const QMouseEvent *event, QPointF *localPos )
{
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
auto clonedEvent = QQuickWindowPrivate::cloneMouseEvent(
const_cast< QMouseEvent* >( event ), localPos );
#else
auto clonedEvent = new QMouseEvent( *event );
auto& point = QMutableEventPoint::from( clonedEvent->point( 0 ) );
point.detach();
point.setTimestamp( event->timestamp() );
point.setPosition( localPos ? *localPos : event->position() );
#endif
return clonedEvent;
}
static inline QMouseEvent* qskClonedMouseEvent( static inline QMouseEvent* qskClonedMouseEvent(
const QMouseEvent* mouseEvent, const QQuickItem* item = nullptr ) const QMouseEvent* mouseEvent, const QQuickItem* item = nullptr )
{ {
QMouseEvent* clonedEvent; QMouseEvent* clonedEvent;
QMouseEvent* event = const_cast< QMouseEvent* >( mouseEvent ); auto event = const_cast< QMouseEvent* >( mouseEvent );
if ( item ) if ( item )
{ {
QPointF localPos = item->mapFromScene( qskMouseScenePosition( event ) ); auto localPos = item->mapFromScene( qskMouseScenePosition( event ) );
clonedEvent = QQuickWindowPrivate::cloneMouseEvent( event, &localPos ); clonedEvent = qskClonedMouseEventAt( event, &localPos );
} }
else else
{ {
clonedEvent = QQuickWindowPrivate::cloneMouseEvent( event, nullptr ); clonedEvent = qskClonedMouseEventAt( event, nullptr );
} }
clonedEvent->setAccepted( false ); clonedEvent->setAccepted( false );

View File

@ -473,7 +473,7 @@ QSGNode* QskListViewSkinlet::updateCellNode( const QskListView* listView,
} }
else else
{ {
qWarning() << "QskListViewSkinlet: got unsupported QVariant type" << value.type(); qWarning() << "QskListViewSkinlet: got unsupported QVariant type" << value.typeName();
} }
return newNode; return newNode;

View File

@ -21,7 +21,11 @@ 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 );
#else
geometry.setDrawingMode( GL_LINES ); geometry.setDrawingMode( GL_LINES );
#endif
geometry.setVertexDataPattern( QSGGeometry::StaticPattern ); geometry.setVertexDataPattern( QSGGeometry::StaticPattern );
} }