diff options
Diffstat (limited to 'src/imports/controls')
-rw-r--r-- | src/imports/controls/material/BusyIndicator.qml | 1 | ||||
-rw-r--r-- | src/imports/controls/material/ProgressBar.qml | 4 | ||||
-rw-r--r-- | src/imports/controls/material/material.pro | 2 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialprogressring.cpp | 11 | ||||
-rw-r--r-- | src/imports/controls/material/qtlabsmaterialstyleplugin.cpp | 6 | ||||
-rw-r--r-- | src/imports/controls/plugins.qmltypes | 154 | ||||
-rw-r--r-- | src/imports/controls/universal/universal.pro | 2 |
7 files changed, 16 insertions, 164 deletions
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml index 6d5e4e8d..9eb48613 100644 --- a/src/imports/controls/material/BusyIndicator.qml +++ b/src/imports/controls/material/BusyIndicator.qml @@ -37,6 +37,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T import Qt.labs.controls.material 1.0 +import Qt.labs.controls.material.impl 1.0 T.BusyIndicator { id: control diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml index 34e1aaea..709ac28d 100644 --- a/src/imports/controls/material/ProgressBar.qml +++ b/src/imports/controls/material/ProgressBar.qml @@ -66,7 +66,7 @@ T.ProgressBar { x: (indeterminate ? offset * parent.width : 0) y: (parent.height - height) / 2 width: offset * (parent.width - x) - height: 6 + height: 4 color: control.Material.accentColor @@ -94,7 +94,7 @@ T.ProgressBar { x: control.leftPadding y: control.topPadding + (control.availableHeight - height) / 2 width: control.availableWidth - height: 6 + height: 4 color: Qt.rgba(control.Material.accentColor.r, control.Material.accentColor.g, control.Material.accentColor.b, 0.25) } diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro index 06b9ed7d..63450289 100644 --- a/src/imports/controls/material/material.pro +++ b/src/imports/controls/material/material.pro @@ -3,7 +3,7 @@ TARGETPATH = Qt/labs/controls/material IMPORT_VERSION = 1.0 QT += qml quick -QT_PRIVATE += core-private gui-private qml-private quick-private labscontrols-private +QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index 54728686..c11a347f 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -74,6 +74,7 @@ public: void afterNodeSync() Q_DECL_OVERRIDE; private: + qreal m_devicePixelRatio; QSGNode *m_containerNode; QQuickWindow *m_window; }; @@ -165,6 +166,7 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const } QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() : + m_devicePixelRatio(1.0), m_containerNode(Q_NULLPTR), m_window(Q_NULLPTR) { @@ -179,6 +181,7 @@ void QQuickMaterialRingAnimatorJob::initialize(QQuickAnimatorController *control QQuickAnimatorJob::initialize(controller); m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); m_window = m_target->window(); + m_devicePixelRatio = m_window->effectiveDevicePixelRatio(); } void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) @@ -192,8 +195,8 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - const qreal width = rectNode->rect().width(); - const qreal height = rectNode->rect().height(); + const qreal width = rectNode->rect().width() * m_devicePixelRatio; + const qreal height = rectNode->rect().height() * m_devicePixelRatio; QImage image(width, height, QImage::Format_ARGB32_Premultiplied); image.fill(Qt::transparent); @@ -203,7 +206,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) QPen pen; QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(rectNode->firstChild()); pen.setColor(textureNode->color()); - pen.setWidth(4); + pen.setWidth(4 * m_devicePixelRatio); painter.setPen(pen); const qreal percentageComplete = time / qreal(rotationAnimationDuration); @@ -237,7 +240,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) } const int halfPen = pen.width() / 2; - const QRectF arcBounds = QRectF(rectNode->rect().adjusted(halfPen, halfPen, -halfPen, -halfPen)); + const QRectF arcBounds = QRectF(halfPen, halfPen, width - pen.width(), height - pen.width()); // The current angle of the rotation animation. const qreal rotation = oneDegree * percentageComplete * -targetRotation; startAngle -= rotation; diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp index db8b47ee..975e5db6 100644 --- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp +++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp @@ -76,8 +76,6 @@ QtLabsMaterialStylePlugin::~QtLabsMaterialStylePlugin() void QtLabsMaterialStylePlugin::registerTypes(const char *uri) { qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 1, 0, "Material", tr("Material is an attached property")); - qmlRegisterType<QQuickMaterialProgressRing>(uri, 1, 0, "ProgressRing"); - qmlRegisterType<QQuickMaterialRingAnimator>(uri, 1, 0, "RingAnimator"); } void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -97,6 +95,10 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char } initResources(); + + QByteArray import = QByteArray(uri) + ".impl"; + qmlRegisterType<QQuickMaterialProgressRing>(import, 1, 0, "ProgressRing"); + qmlRegisterType<QQuickMaterialRingAnimator>(import, 1, 0, "RingAnimator"); } QT_END_NAMESPACE diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 518a9b6c..7ffa52be 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -267,160 +267,6 @@ Module { Signal { name: "implicitHeightChanged2"; revision: 1 } } Component { - name: "QQuickItem" - defaultProperty: "data" - prototype: "QObject" - Enum { - name: "TransformOrigin" - values: { - "TopLeft": 0, - "Top": 1, - "TopRight": 2, - "Left": 3, - "Center": 4, - "Right": 5, - "BottomLeft": 6, - "Bottom": 7, - "BottomRight": 8 - } - } - Property { name: "parent"; type: "QQuickItem"; isPointer: true } - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } - Property { name: "x"; type: "double" } - Property { name: "y"; type: "double" } - Property { name: "z"; type: "double" } - Property { name: "width"; type: "double" } - Property { name: "height"; type: "double" } - Property { name: "opacity"; type: "double" } - Property { name: "enabled"; type: "bool" } - Property { name: "visible"; type: "bool" } - Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } - Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } - Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } - Property { name: "state"; type: "string" } - Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } - Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } - Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } - Property { name: "baselineOffset"; type: "double" } - Property { name: "clip"; type: "bool" } - Property { name: "focus"; type: "bool" } - Property { name: "activeFocus"; type: "bool"; isReadonly: true } - Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } - Property { name: "rotation"; type: "double" } - Property { name: "scale"; type: "double" } - Property { name: "transformOrigin"; type: "TransformOrigin" } - Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } - Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } - Property { name: "smooth"; type: "bool" } - Property { name: "antialiasing"; type: "bool" } - Property { name: "implicitWidth"; type: "double" } - Property { name: "implicitHeight"; type: "double" } - Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } - Signal { - name: "childrenRectChanged" - Parameter { type: "QRectF" } - } - Signal { - name: "baselineOffsetChanged" - Parameter { type: "double" } - } - Signal { - name: "stateChanged" - Parameter { type: "string" } - } - Signal { - name: "focusChanged" - Parameter { type: "bool" } - } - Signal { - name: "activeFocusChanged" - Parameter { type: "bool" } - } - Signal { - name: "activeFocusOnTabChanged" - revision: 1 - Parameter { type: "bool" } - } - Signal { - name: "parentChanged" - Parameter { type: "QQuickItem"; isPointer: true } - } - Signal { - name: "transformOriginChanged" - Parameter { type: "TransformOrigin" } - } - Signal { - name: "smoothChanged" - Parameter { type: "bool" } - } - Signal { - name: "antialiasingChanged" - Parameter { type: "bool" } - } - Signal { - name: "clipChanged" - Parameter { type: "bool" } - } - Signal { - name: "windowChanged" - revision: 1 - Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } - } - Method { name: "update" } - Method { - name: "grabToImage" - revision: 2 - type: "bool" - Parameter { name: "callback"; type: "QJSValue" } - Parameter { name: "targetSize"; type: "QSize" } - } - Method { - name: "grabToImage" - revision: 2 - type: "bool" - Parameter { name: "callback"; type: "QJSValue" } - } - Method { - name: "contains" - type: "bool" - Parameter { name: "point"; type: "QPointF" } - } - Method { - name: "mapFromItem" - Parameter { type: "QQmlV4Function"; isPointer: true } - } - Method { - name: "mapToItem" - Parameter { type: "QQmlV4Function"; isPointer: true } - } - Method { name: "forceActiveFocus" } - Method { - name: "forceActiveFocus" - Parameter { name: "reason"; type: "Qt::FocusReason" } - } - Method { - name: "nextItemInFocusChain" - revision: 1 - type: "QQuickItem*" - Parameter { name: "forward"; type: "bool" } - } - Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } - Method { - name: "childAt" - type: "QQuickItem*" - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } - } - } - Component { name: "QQuickItemDelegate" defaultProperty: "data" prototype: "QQuickAbstractButton" diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro index 41cef97d..88bad8f7 100644 --- a/src/imports/controls/universal/universal.pro +++ b/src/imports/controls/universal/universal.pro @@ -3,7 +3,7 @@ TARGETPATH = Qt/labs/controls/universal IMPORT_VERSION = 1.0 QT += qml quick -QT_PRIVATE += core-private gui-private qml-private quick-private labscontrols-private +QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII |