Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › MouseArea and SwipeView :: they are not compatible ??

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16649

    Waeil
    Item
    {
      id:idItem
      width: parent.width
      height: imgSwipeView.height + pageControl.height
      PageControl
      {
        id: pageControl
        height: implicitHeight + dp(5)
        pages: 4
        indicatorSize: dp(32)
        pageIcons: ({
                      0: IconType.search,
                      2: IconType.home
                    })
        currentPage: imgSwipeView.currentIndex
        clickableIndicator: true
        spacing: dp(10)
        onPageSelected: imgSwipeView.currentIndex = index
      }
      
      SwipeView
      {
        id: imgSwipeView
        width: parent.width
        height: width / 1.5
        anchors.top: pageControl.bottom
        
        Item { AppImage { source: "../../../assets/images/Vue1.png"; anchors.fill: parent; fillMode: Image.PreserveAspectFit; } }
        Item { AppImage { source: "../../../assets/images/Vue2.png"; anchors.fill: parent; fillMode: Image.PreserveAspectFit } }
        Item { AppImage { source: "../../../assets/images/Vue3.png"; anchors.fill: parent; fillMode: Image.PreserveAspectFit}}
        Item
        {
          AppImage
          {
            id: idGirl
            source: "../../../assets/images/Vue4.png"
            anchors.centerIn: parent
          }
          DropShadow
          {
            anchors.fill: idGirl
            horizontalOffset: 3
            verticalOffset: 3
            radius: 8.0
            samples: 17
            color: "#80000000"
            source: idGirl
          }
        }
      }
      
      Rectangle
      {
        color: "#12ab36"
        anchors.top: pageControl.bottom
        width: parent.width
        height: width / 1.5
        opacity: 0.5
        MouseArea
        {
          id:idMouse
          anchors.top: parent.bottom
          width: parent.width
          onClicked: doAction()
        }
        
        function doAction()
        {
          PictureViewer.show(getApplication(), imgSwipeView.currentItem.data[0].source, false)
          console.log("------>"+imgSwipeView.currentItem.data[0].source);
        }
      }
    }
    #16650

    Günther
    Felgo Team

    Hi!

    If the MouseArea is placed on top of the SwipeView, it consumes the touch events, which in turn do not reach the SwipeView then.

    You can add a MouseArea to handle clicks to the content within the SwipeView though, as e.g. click events are not consumed by the view and thus passed to the MouseArea within.

    For example:

        SwipeView
        {
          id: imgSwipeView
          width: parent.width
          height: width / 1.5
          anchors.top: pageControl.bottom
    
          Item {
            AppImage {
              id: image
              source: "<your-image>";
              anchors.fill: parent;
              fillMode: Image.PreserveAspectFit;
            }
            MouseArea {
              anchors.fill: parent
              onClicked: { /* do something */ }
            }
          }
        }

    Best,
    Günther

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded