Pavel K.
Pavel K.Sept. 13, 2019, 8:49 p.m.

Zoom для Image в QML

QML, С++

Есть код

import QtQuick 2.6
import Sailfish.Silica 1.0
import "../controls"

LttPage {
    id:previewPage
    property string filepath

    Connections {
        target: previewPage
        onStatusChanged: {
            if (previewPage.status == PageStatus.Deactivating && _navigation == PageNavigation.Back) {  
            }
        }
    }
    //    MultiPointTouchArea {
   //                 id: multiPoint
   //                 anchors.fill: parent
   //                 minimumTouchPoints: 2
   //                 maximumTouchPoints: 2
   //                 touchPoints: [
   //                     TouchPoint { id: point1 },
   //                     TouchPoint { id: point2 }
   //                 ]
   //                property real factor: 1
   //                 property bool isReleased: false // ignore the TouchUpdate after released
   //                 onTouchUpdated: {
   //                     if(isReleased){
   //                         isReleased = false
   //                         return
   //                     }
   //                     if(point1.x != 0 && point2.x != 0){
   //                         var s = Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2)) /
   //                                 Math.sqrt(Math.pow(point1.startX - point2.startX, 2) + Math.pow(point1.startY - point2.startY, 2))
   //                         image.scale = s * factor
   //                     }
   //                 }
   //                 onReleased: {
   //                     factor = image.scale
   //                     isReleased = true
   //                 } 
   //             }
    Image {
        id: image
        width: Screen.width
        height: Screen.height

        anchors.centerIn: parent
        fillMode: Image.PreserveAspectFit
        source: filepath
    }
}

может кто подскажет как сделать адекватный зум? Пробовал через MultiPointTouchArea{} , но зум только центра, как сделать , чтобы можно было листать зазумленное изображени???

We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Do you like it? Share on social networks!

1
Михаиллл
  • Sept. 14, 2019, 6:13 p.m.
  • (edited)

Можно использовать Flickable, растнянуть на него картинку и двигать

    Comments

    Only authorized users can post comments.
    Please, Log in or Sign up
    Ua

    Qt - Test 001. Signals and slots

    • Result:84points,
    • Rating points4
    Ua

    Qt - Test 001. Signals and slots

    • Result:42points,
    • Rating points-8
    ОК

    Qt - Test 001. Signals and slots

    • Result:47points,
    • Rating points-6
    Last comments
    ИМ
    Игорь МаксимовNov. 22, 2024, 9:51 p.m.
    Django - Tutorial 017. Customize the login page to Django Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
    Evgenii Legotckoi
    Evgenii LegotckoiOct. 31, 2024, 11:37 p.m.
    Django - Lesson 064. How to write a Python Markdown extension Добрый день. Да, можно. Либо через такие же плагины, либо с постобработкой через python библиотеку Beautiful Soup
    A
    ALO1ZEOct. 19, 2024, 5:19 p.m.
    Fb3 file reader on Qt Creator Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
    ИМ
    Игорь МаксимовOct. 5, 2024, 4:51 p.m.
    Django - Lesson 064. How to write a Python Markdown extension Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
    d
    dblas5July 5, 2024, 8:02 p.m.
    QML - Lesson 016. SQLite database and the working with it in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
    Now discuss on the forum
    AH
    Abdul HadiFeb. 13, 2025, 3:21 p.m.
    Are you Looking for best painter services in Qatar? Looking for top painter Services in Qatar? Get high-quality, affordable, and professional painting for homes & offices. Contact expert painters today!
    d
    dubaicushionsFeb. 13, 2025, 3:17 p.m.
    Are Looking for custom swing cushions in Dubai for home decor? Looking for Custom Swing Cushions in Dubai? Get high-quality, weather-resistant, and stylish cushions for your outdoor swing. Order now for comfort & elegance!
    d
    dubaicustomizedsofaFeb. 13, 2025, 3:11 p.m.
    Are you Looking for a custom sofa in Dubai? Looking for a Custom Sofa in Dubai ? Get high-quality, stylish, and tailor-made sofas to match your space. Order now for comfort, luxury, and perfect design!
    b
    blinds12Feb. 11, 2025, 4:08 p.m.
    Why Bamboo Blinds Are the Perfect Choice for Your Home When it comes to enhancing the aesthetics and functionality of your living space, choosing the right window treatment is crucial. Bamboo blinds have emerged as a popular choice for homeowners wh…
    i
    imperial3130Feb. 11, 2025, 3:40 p.m.
    How to Select the Right Carpet for Your Bedroom Aesthetic Choosing the perfect carpet for your bedroom involves more than just picking a color or pattern you like. Carpets can transform the ambiance of your space, adding warmth, comfort, and style. How…

    Follow us in social networks