code fixed for later Qt versions

This commit is contained in:
Uwe Rathmann 2021-04-21 08:24:17 +02:00
parent 90200ed95f
commit 0461029ea9
1 changed files with 7 additions and 43 deletions

View File

@ -26,18 +26,10 @@ QSK_QT_PRIVATE_END
#ifdef QSK_DEBUG_RENDER_TIMING #ifdef QSK_DEBUG_RENDER_TIMING
// does not work with Qt >= 5.12 TODO ...
#include <qelapsedtimer.h> #include <qelapsedtimer.h>
#include <qloggingcategory.h> #include <qloggingcategory.h>
Q_LOGGING_CATEGORY( logTiming, "qsk.window.timing", QtCriticalMsg ) Q_LOGGING_CATEGORY( logTiming, "qsk.window.timing", QtCriticalMsg )
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
QSK_QT_PRIVATE_BEGIN
#include <qpa/qplatformwindow_p.h>
QSK_QT_PRIVATE_END
#endif
#endif #endif
static void qskResolveLocale( QskWindow* ); static void qskResolveLocale( QskWindow* );
@ -66,28 +58,6 @@ static QQuickItem* qskDefaultFocusItem( QQuickWindow* window )
return window->contentItem()->nextItemInFocusChain( true ); return window->contentItem()->nextItemInFocusChain( true );
} }
#ifdef QSK_DEBUG_RENDER_TIMING
static inline int qskUpdateTimerId( const QWindow* window )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
class PlatformWindow : public QPlatformWindow
{
public:
int updateTimerId() const
{
return d_ptr->updateTimer.timerId();
}
};
auto platformWindow = static_cast< const PlatformWindow* >( window->handle() );
return platformWindow->updateTimerId();
#else
auto w = const_cast< QWindow* >( window );
return QWindowPrivate::get( w )->updateTimer;
#endif
}
#endif
namespace namespace
{ {
class ChildListener final : public QQuickItemChangeListener class ChildListener final : public QQuickItemChangeListener
@ -375,26 +345,20 @@ bool QskWindow::event( QEvent* event )
} }
break; break;
} }
case QEvent::UpdateRequest:
{
#ifdef QSK_DEBUG_RENDER_TIMING #ifdef QSK_DEBUG_RENDER_TIMING
case QEvent::Timer:
{
if ( logTiming().isDebugEnabled() ) if ( logTiming().isDebugEnabled() )
{
const int updateTimerId = qskUpdateTimerId( this );
if ( static_cast< QTimerEvent* >( event )->timerId() == updateTimerId )
{ {
if ( !d->renderInterval.isValid() ) if ( !d->renderInterval.isValid() )
d->renderInterval.start(); d->renderInterval.start();
qCDebug( logTiming() ) << "update timer - elapsed" qCDebug( logTiming() ) << "update timer - elapsed"
<< d->renderInterval.restart() << this; << d->renderInterval.restart() << objectName();
}
}
break;
} }
#endif #endif
break;
}
default: default:
break; break;