RoomPage.qml Example File

appdemos/qtws/qml/pages/RoomPage.qml
 import Felgo 3.0
 import QtQuick 2.7

 FlickablePage {
   id: roomPage
   title: room
   property string room

   onPushed: amplitude.logEvent("Show Room",{"title" : title})

   flickable.flickableDirection: Flickable.AutoFlickIfNeeded
   flickable.contentWidth: roomPage.width
   flickable.contentHeight: roomPage.height

   scrollIndicator.visible: false

   PinchArea {
     width: Math.max(flickable.contentWidth, flickable.width)
     height: Math.max(flickable.contentHeight, flickable.height)

     property real initialWidth
     property real initialHeight
     onPinchStarted: {
       initialWidth = flickable.contentWidth
       initialHeight = flickable.contentHeight
     }

     onPinchUpdated: {
       // adjust content pos due to drag
       flickable.contentX += pinch.previousCenter.x - pinch.center.x
       flickable.contentY += pinch.previousCenter.y - pinch.center.y

       // resize content
       flickable.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
     }

     onPinchFinished: {
       // Move its content within bounds.
       flickable.returnToBounds()
     }

     Rectangle {
       width: flickable.contentWidth
       height: flickable.contentHeight
       color: "white"
       AppImage {
         width: parent.width
         fillMode: AppImage.PreserveAspectFit
         property string fileName: room !== "Agenda" ? "Room " + room + ".png" : "Agenda.jpg"
         source: "../../assets/rooms/" + fileName

         MouseArea {
           anchors.fill: parent
           onDoubleClicked: {
             flickable.contentWidth = roomPage.width
             flickable.contentHeight = roomPage.height
           }
         }
       }
     }
   }
 }

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support