string based setScreen method added
This commit is contained in:
parent
d92c20e924
commit
3f70ff764f
@ -19,6 +19,19 @@ QSK_QT_PRIVATE_BEGIN
|
|||||||
#include <private/qsgrenderer_p.h>
|
#include <private/qsgrenderer_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
|
#define QSK_DEBUG_RENDER_TIMING
|
||||||
|
|
||||||
|
#ifdef QSK_DEBUG_RENDER_TIMING
|
||||||
|
|
||||||
|
#include <qelapsedtimer.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
|
Q_LOGGING_CATEGORY( logTiming, "qsk.window.timing", QtCriticalMsg )
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void qskResolveLocale( QskWindow* );
|
static void qskResolveLocale( QskWindow* );
|
||||||
static bool qskEnforcedSkin = false;
|
static bool qskEnforcedSkin = false;
|
||||||
|
|
||||||
@ -107,6 +120,10 @@ class QskWindowPrivate : public QQuickWindowPrivate
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QSK_DEBUG_RENDER_TIMING
|
||||||
|
QElapsedTimer renderInterval;
|
||||||
|
#endif
|
||||||
|
|
||||||
ChildListener contentItemListener;
|
ChildListener contentItemListener;
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
|
|
||||||
@ -145,6 +162,14 @@ QskWindow::QskWindow( QWindow* parent )
|
|||||||
connect( this, &QQuickWindow::afterAnimating, this, &QskWindow::enforceSkin );
|
connect( this, &QQuickWindow::afterAnimating, this, &QskWindow::enforceSkin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskWindow::QskWindow(QQuickRenderControl *renderControl , QWindow *parent)
|
||||||
|
: QskWindow( parent )
|
||||||
|
{
|
||||||
|
auto* d = static_cast< QskWindowPrivate* >( QQuickWindowPrivate::get( this ) );
|
||||||
|
d->renderControl = renderControl;
|
||||||
|
d->init( this, renderControl );
|
||||||
|
}
|
||||||
|
|
||||||
QskWindow::~QskWindow()
|
QskWindow::~QskWindow()
|
||||||
{
|
{
|
||||||
// When being used from Qml the item destruction would run in the most
|
// When being used from Qml the item destruction would run in the most
|
||||||
@ -164,6 +189,23 @@ QskWindow::~QskWindow()
|
|||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskWindow::setScreen( const QString& name )
|
||||||
|
{
|
||||||
|
if ( !name.isEmpty() )
|
||||||
|
{
|
||||||
|
for ( auto screen : QGuiApplication::screens() )
|
||||||
|
{
|
||||||
|
if ( screen->name() == name )
|
||||||
|
{
|
||||||
|
setScreen( screen );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setScreen( QGuiApplication::primaryScreen() );
|
||||||
|
}
|
||||||
|
|
||||||
void QskWindow::resizeF( const QSizeF& size )
|
void QskWindow::resizeF( const QSizeF& size )
|
||||||
{
|
{
|
||||||
const int w = static_cast< int >( qCeil( size.width() ) );
|
const int w = static_cast< int >( qCeil( size.width() ) );
|
||||||
@ -271,12 +313,30 @@ bool QskWindow::event( QEvent* event )
|
|||||||
{
|
{
|
||||||
if ( event->isAccepted() )
|
if ( event->isAccepted() )
|
||||||
{
|
{
|
||||||
Q_D( const QskWindow );
|
|
||||||
if ( d->deleteOnClose )
|
if ( d->deleteOnClose )
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef QSK_DEBUG_RENDER_TIMING
|
||||||
|
case QEvent::Timer:
|
||||||
|
{
|
||||||
|
if ( logTiming().isDebugEnabled() )
|
||||||
|
{
|
||||||
|
if ( static_cast<QTimerEvent *>( event )->timerId() == d->updateTimer )
|
||||||
|
{
|
||||||
|
if ( !d->renderInterval.isValid() )
|
||||||
|
d->renderInterval.start();
|
||||||
|
|
||||||
|
qCDebug( logTiming() ) << "update timer - elapsed"
|
||||||
|
<< d->renderInterval.restart() << this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -522,7 +582,7 @@ void QskWindow::setCustomRenderMode( const char* mode )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( m.isEmpty() != d->customRenderMode.isEmpty() )
|
if ( m.isEmpty() != d->customRenderMode.isEmpty() )
|
||||||
scheduleRenderJob( new RenderJob( this, m ), AfterSwapStage );
|
scheduleRenderJob( new RenderJob( this, m ), AfterRenderingStage );
|
||||||
else
|
else
|
||||||
d->customRenderMode = m;
|
d->customRenderMode = m;
|
||||||
|
|
||||||
|
@ -35,8 +35,13 @@ class QSK_EXPORT QskWindow : public QQuickWindow
|
|||||||
};
|
};
|
||||||
|
|
||||||
QskWindow( QWindow* parent = nullptr );
|
QskWindow( QWindow* parent = nullptr );
|
||||||
|
QskWindow( QQuickRenderControl* renderControl, QWindow* parent = nullptr );
|
||||||
|
|
||||||
~QskWindow() override;
|
~QskWindow() override;
|
||||||
|
|
||||||
|
using Inherited::setScreen;
|
||||||
|
void setScreen( const QString& );
|
||||||
|
|
||||||
bool deleteOnClose() const;
|
bool deleteOnClose() const;
|
||||||
void setDeleteOnClose( bool );
|
void setDeleteOnClose( bool );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user