Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set finger scrolling in Qt 5.7
Forum Updated to NodeBB v4.3 + New Features

How to set finger scrolling in Qt 5.7

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
10 Posts 2 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jigarp
    wrote on last edited by
    #1

    Hello,

    I'm trying to scroll screen using finger in Qt Creator 4.0.2 but unfortunately unable to succeed.
    Here is my code

    QScrollArea *scrollArea;
    QWidget *scrollAreaWidgetContents;
        scrollArea = new QScrollArea(settingsWindowBk);
        scrollArea->setObjectName(QStringLiteral("scrollArea"));
        scrollArea->setGeometry(QRect(70, 70, 341, 200));
        scrollArea->setWidgetResizable(true);
        scrollAreaWidgetContents = new QWidget();
        scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
        scrollAreaWidgetContents->setGeometry(QRect(0, 0, 339, 198)); 
        scrollArea->setWidget(scrollAreaWidgetContents);
    

    ui->scrollArea->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    QScroller::grabGesture(ui->scrollArea->viewport(),QScroller::TouchGesture);

    Still not able to scroll using gesture.

    Any Advice.

    Thank you

    jsulmJ 1 Reply Last reply
    0
    • J jigarp

      Hello,

      I'm trying to scroll screen using finger in Qt Creator 4.0.2 but unfortunately unable to succeed.
      Here is my code

      QScrollArea *scrollArea;
      QWidget *scrollAreaWidgetContents;
          scrollArea = new QScrollArea(settingsWindowBk);
          scrollArea->setObjectName(QStringLiteral("scrollArea"));
          scrollArea->setGeometry(QRect(70, 70, 341, 200));
          scrollArea->setWidgetResizable(true);
          scrollAreaWidgetContents = new QWidget();
          scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
          scrollAreaWidgetContents->setGeometry(QRect(0, 0, 339, 198)); 
          scrollArea->setWidget(scrollAreaWidgetContents);
      

      ui->scrollArea->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
      QScroller::grabGesture(ui->scrollArea->viewport(),QScroller::TouchGesture);

      Still not able to scroll using gesture.

      Any Advice.

      Thank you

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @jigarp What is your device and OS?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jigarp
        wrote on last edited by
        #3

        Hello,
        I'm using Qt 5.7 cross compiling for am335x based board which contains arago linux 4.9.28 based kernel

        jsulmJ 1 Reply Last reply
        0
        • J jigarp

          Hello,
          I'm using Qt 5.7 cross compiling for am335x based board which contains arago linux 4.9.28 based kernel

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @jigarp And touch screen is working?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • jsulmJ jsulm

            @jigarp And touch screen is working?

            J Offline
            J Offline
            jigarp
            wrote on last edited by
            #5

            @jsulm
            Everything is working fine.
            like Touch,display,motion etc
            Can you provide me procedure for enabling finger scrolling/kinetic scrolling in Qt creator

            I've many doubts like scrollArea ,scrollAreaWidgetContents size etc.

            Thank you,

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jigarp
              wrote on last edited by
              #6

              Does gesture requires multi touch functionality???

              jsulmJ 1 Reply Last reply
              0
              • J jigarp

                Does gesture requires multi touch functionality???

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @jigarp Depends on the gesture: for scrolling you only need one finger.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @jigarp Depends on the gesture: for scrolling you only need one finger.

                  J Offline
                  J Offline
                  jigarp
                  wrote on last edited by
                  #8

                  @jsulm
                  So can you provide any sample for scroll area to scroll with finger scrolling in Qt creator

                  jsulmJ 1 Reply Last reply
                  0
                  • J jigarp

                    @jsulm
                    So can you provide any sample for scroll area to scroll with finger scrolling in Qt creator

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @jigarp I don't know whether there are any examples for this. You can check Qt examples by yourself. Actually it should work out of the box if the touch screen is working on your device.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    J 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @jigarp I don't know whether there are any examples for this. You can check Qt examples by yourself. Actually it should work out of the box if the touch screen is working on your device.

                      J Offline
                      J Offline
                      jigarp
                      wrote on last edited by
                      #10

                      @jsulm
                      What will be the size/geometry for scrollArea and scrollAreaWidgetContents for scrolling that widget.
                      Because scrollAreaWidgetContents must be larger than scrollArea for scrolling mechanism.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved