Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Flick Delay

Flick Delay

Scheduled Pinned Locked Moved QML and Qt Quick
19 Posts 4 Posters 8.6k 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.
  • B Offline
    B Offline
    bundickt
    wrote on last edited by
    #1

    The flickable has the property, pressDelay, but does not have a flickDelay property. Is there a way to ignore a flick if the user presses and release faster than some interval. On a PC this really isn't a problem, but with a resistive touch screen I get a flick event about 25% of the time I really meant to just do a press/release.

    Thanks,
    Tom

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      You can use
      @
      qApp->setStartDragDistance(25);
      @
      to remove false flickings (25 of course is a sample, choose number that will suit you)

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kyleplattner
        wrote on last edited by
        #3

        I have the same problem. What would the drag distance code be in qml?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          It will be distance that is needed for mouse cursor (or finger in case of touch) to be moved for flickable area moving start.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kyleplattner
            wrote on last edited by
            #5

            right but am I correct in assuming that "qApp->setStartDragDistance(25);" is for C++? Can I set the attribute in QML?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              kyleplattner, you should set it in c++ wrapper if you have qml-only app working inside qtcreator wrapper.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kyleplattner
                wrote on last edited by
                #7

                is there an article on that you could reference?

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on last edited by
                  #8

                  kyleplattner, article about what? If you mean using this method for qml flickable elements then I don't know if it is somewhere documented (I've found it in Qt sources).

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kyleplattner
                    wrote on last edited by
                    #9

                    Sorry, I meant an article about how to use C++ in a QML only app.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DenisKormalev
                      wrote on last edited by
                      #10

                      kyleplattner, you are using qml-only app inside wrapper generated for you by qt creator (this way I think is better for production using). Am I right? So you have some C++ code that loads your qml inside QDeclarativeView. In this code, in main.cpp after QApplication object creation you can put this string.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kyleplattner
                        wrote on last edited by
                        #11

                        Denis, I really need to get to that point but currently I only have .qml files with a .qmlproject file.

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DenisKormalev
                          wrote on last edited by
                          #12

                          So you are using qml inside qml viewer. In this way I think it is impossible to change this parameter.

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            kyleplattner
                            wrote on last edited by
                            #13

                            What is the easiest way to get my project over to using C++?

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              DenisKormalev
                              wrote on last edited by
                              #14

                              Create new project in QtCreator: Qt C++ Project->Qt Quick Application. It will ask you a few questions and then will create you some files, copy your qmls in qml folder and change in main.cpp path to your first qml file. After it in main.cpp after line
                              @
                              QApplication app(argc, argv);
                              @
                              add line
                              @
                              app.setStartDragDistance(25);
                              @
                              It should help you

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                bundickt
                                wrote on last edited by
                                #15

                                Using the QApplication class, it looks like I can set a time too:

                                qApp->setStartDragTime(100)

                                I don't like that this is a global function. I have some ListView's/GridView's that I want longer or shorter StartDragTime's for.

                                Thanks for the help

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  mbrasser
                                  wrote on last edited by
                                  #16

                                  [quote]right but am I correct in assuming that “qApp->setStartDragDistance(25);” is for C++? Can I set the attribute in QML? [/quote]

                                  It isn't possible to manipulate the value from QML, but for testing purposes qmlviewer has a command line option for changing this value; for example to set it to 25 when running main.qml you could do

                                  @qmlviewer -dragthreshold 25 main.qml@

                                  Regards,
                                  Michael

                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    DenisKormalev
                                    wrote on last edited by
                                    #17

                                    mbrasser, as I know this parameter influence on qml flickable element is not documented. Will this parameter have such side-effect in future or it can be changed?

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mbrasser
                                      wrote on last edited by
                                      #18

                                      [quote author="Denis Kormalev" date="1292541846"]mbrasser, as I know this parameter influence on qml flickable element is not documented. Will this parameter have such side-effect in future or it can be changed?[/quote]

                                      It's extremely unlikely that it will change (and, in fact, we should be documenting it).

                                      Regards,
                                      Michael

                                      1 Reply Last reply
                                      0
                                      • K Offline
                                        K Offline
                                        kyleplattner
                                        wrote on last edited by
                                        #19

                                        Good suggestion, that worked!

                                        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