using mm instead of dp
This commit is contained in:
parent
93983e23c5
commit
e46fa8bc72
@ -6,6 +6,7 @@
|
|||||||
#include "QskPlatform.h"
|
#include "QskPlatform.h"
|
||||||
|
|
||||||
#include <qguiapplication.h>
|
#include <qguiapplication.h>
|
||||||
|
#include <qquickwindow.h>
|
||||||
#include <qscreen.h>
|
#include <qscreen.h>
|
||||||
|
|
||||||
QSK_QT_PRIVATE_BEGIN
|
QSK_QT_PRIVATE_BEGIN
|
||||||
@ -88,3 +89,25 @@ qreal qskPxToPixelsFactor()
|
|||||||
|
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline qreal qskWindowDpi( const QWindow* window )
|
||||||
|
{
|
||||||
|
QScreen* screen = nullptr;
|
||||||
|
if ( window )
|
||||||
|
screen = window->screen();
|
||||||
|
|
||||||
|
if ( screen == nullptr )
|
||||||
|
screen = QGuiApplication::primaryScreen();
|
||||||
|
|
||||||
|
return QHighDpiScaling::logicalDpi( screen ).first;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal qskInchesToPixels( const QQuickWindow* window, qreal inches )
|
||||||
|
{
|
||||||
|
return qskWindowDpi( window ) * inches;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal qskMMToPixels( const QQuickWindow* window, qreal mm )
|
||||||
|
{
|
||||||
|
return qskWindowDpi( window ) * mm / 25.4;
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@ class QScreen;
|
|||||||
class QPlatformIntegration;
|
class QPlatformIntegration;
|
||||||
class QPlatformTheme;
|
class QPlatformTheme;
|
||||||
class QRect;
|
class QRect;
|
||||||
|
class QQuickWindow;
|
||||||
|
|
||||||
QSK_EXPORT qreal qskGlobalScaleFactor();
|
QSK_EXPORT qreal qskGlobalScaleFactor();
|
||||||
|
|
||||||
@ -33,6 +34,9 @@ QSK_EXPORT const QPlatformTheme* qskPlatformTheme();
|
|||||||
QSK_EXPORT qreal qskDpToPixelsFactor();
|
QSK_EXPORT qreal qskDpToPixelsFactor();
|
||||||
QSK_EXPORT qreal qskPxToPixelsFactor();
|
QSK_EXPORT qreal qskPxToPixelsFactor();
|
||||||
|
|
||||||
|
QSK_EXPORT qreal qskInchesToPixels( const QQuickWindow*, qreal mm );
|
||||||
|
QSK_EXPORT qreal qskMMToPixels( const QQuickWindow*, qreal mm );
|
||||||
|
|
||||||
inline qreal qskDpToPixels( qreal value )
|
inline qreal qskDpToPixels( qreal value )
|
||||||
{
|
{
|
||||||
static qreal factor = -1.0;
|
static qreal factor = -1.0;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "QskSubWindow.h"
|
#include "QskSubWindow.h"
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
#include "QskPlatform.h"
|
|
||||||
#include "QskGraphic.h"
|
#include "QskGraphic.h"
|
||||||
#include "QskGraphicProvider.h"
|
#include "QskGraphicProvider.h"
|
||||||
#include "QskTextOptions.h"
|
#include "QskTextOptions.h"
|
||||||
@ -222,10 +221,10 @@ QSizeF QskSubWindow::layoutSizeHint(
|
|||||||
{
|
{
|
||||||
// should be Minimum Width/Height from the skin hints
|
// should be Minimum Width/Height from the skin hints
|
||||||
if ( hint.width() < 0.0 )
|
if ( hint.width() < 0.0 )
|
||||||
hint.setWidth( qskDpToPixels( 100 ) );
|
hint.setWidth( 100 );
|
||||||
|
|
||||||
if ( hint.height() < 0.0 )
|
if ( hint.height() < 0.0 )
|
||||||
hint.setHeight( qskDpToPixels( 80 ) );
|
hint.setHeight( 80 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return hint;
|
return hint;
|
||||||
|
@ -24,9 +24,10 @@ static void qskUpdateEventFilter( QskSubWindowArea* area )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Qt::Edges qskSelectedEdges( const QRectF& rect, const QPointF& pos )
|
static Qt::Edges qskSelectedEdges( const QskSubWindowArea* area,
|
||||||
|
const QRectF& rect, const QPointF& pos )
|
||||||
{
|
{
|
||||||
const qreal tolerance = qskDpToPixels( 10.0 );
|
const qreal tolerance = qskMMToPixels( area->window(), 3 );
|
||||||
|
|
||||||
Qt::Edges edges;
|
Qt::Edges edges;
|
||||||
if ( pos.x() <= rect.left() + tolerance )
|
if ( pos.x() <= rect.left() + tolerance )
|
||||||
@ -222,7 +223,7 @@ bool QskSubWindowArea::mouseEventFilter( QskSubWindow* window, const QMouseEvent
|
|||||||
if ( doDrag )
|
if ( doDrag )
|
||||||
{
|
{
|
||||||
m_data->isDragging = true;
|
m_data->isDragging = true;
|
||||||
m_data->draggedEdges = qskSelectedEdges( cr, mousePos );
|
m_data->draggedEdges = qskSelectedEdges( this, cr, mousePos );
|
||||||
m_data->mousePos = qskMouseScenePosition( event );
|
m_data->mousePos = qskMouseScenePosition( event );
|
||||||
|
|
||||||
setDragging( window, true );
|
setDragging( window, true );
|
||||||
|
@ -74,7 +74,7 @@ void QskSwipeView::setSwipeDistance( int distance )
|
|||||||
|
|
||||||
void QskSwipeView::resetSwipeDistance()
|
void QskSwipeView::resetSwipeDistance()
|
||||||
{
|
{
|
||||||
setSwipeDistance( qRound( qskDpToPixels( 40 ) ) );
|
setSwipeDistance( qRound( qskMMToPixels( window(), 8 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskSwipeView::duration() const
|
int QskSwipeView::duration() const
|
||||||
|
@ -10,10 +10,6 @@
|
|||||||
#include "QskLinearBox.h"
|
#include "QskLinearBox.h"
|
||||||
#include "QskQuick.h"
|
#include "QskQuick.h"
|
||||||
#include "QskEvent.h"
|
#include "QskEvent.h"
|
||||||
#if 1
|
|
||||||
#include "QskSkin.h"
|
|
||||||
#include <QskPlatform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
#include <qpointer.h>
|
#include <qpointer.h>
|
||||||
@ -394,7 +390,7 @@ QSizeF QskDialogSubWindow::layoutSizeHint(
|
|||||||
|
|
||||||
if ( which == Qt::MinimumSize )
|
if ( which == Qt::MinimumSize )
|
||||||
{
|
{
|
||||||
const auto w = qMax( qskDpToPixels( 300.0 ), size.width() );
|
const auto w = qMax( 300.0, size.width() );
|
||||||
size.setWidth( w );
|
size.setWidth( w );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user