Flickable.js
Flickable: A Zepto Plugin to Enable Touch Gestures on Any HTML Element
The problem is once I set this function:
$('#survey').flickable({segments:num_segments});
I can't find the way to reset, destroy it or override it. So if the user flips the tablet or resizes the window of his browser the segment flicks with the wrong width (set on page load).
Thanks in advance.
Source: (StackOverflow)
I am using a Flickable
which is embedded in a Rectangle.
There is a button in the bottom of the rectangle.
My requirement is when I press the button my Flickable will move to top.
Its almost like #TOP in HTML.
Is anybody have an idea how to achieve this?
Source: (StackOverflow)
What is the correct way of asking the bounds of Flickable.contentY? I need that for a scrollbar.
Experimentally I have discovered that
offsetY <= contentY <= offsetY + contentHeight - height
where offsetY can be calculated as
var offsetY = contentY-Math.round(visibleArea.yPosition*contentHeight)
offsetY is zero at the start of the application and seems to be constant unless Flickable is resized.
This formula works in general, but there probably should be a dedicated function for it.
Source: (StackOverflow)
I want to display a big list on a small display. The problem with the ListView is, that I have to setup a orientation, whether it is flickable horizontal or vertical.
What I tried is:
- I inserted the ListView in a Flickable, and setup the Flickable for horizontal scroll and the view for vertical scroll, but then I can't flick to both sides at the same time
- I tried to set the flickableDirection property of the ListView to Flickable.HorizontalAndVerticalFlick, but this didn't work.
Heres a simple example:
import QtQuick 2.2
import QtQuick.Window 2.1
Window {
visible: true
width: 360
height: 360
ListModel {
id: fruitModel
ListElement {
name: "Apple"
cost: 2.45
}
ListElement {
name: "Orange"
cost: 3.25
}
ListElement {
name: "Banana"
cost: 1.95
}
}
ListView {
anchors.fill: parent
model: fruitModel
delegate: Rectangle {
id: delegateRect
height: 150
width: 545
border.color: "steelblue"
border.width: 1
Row {
Text {
id: nameLabel
width: 345
text: name
}
Text {
id: costLabel
width: 200
text: cost
}
}
}
}
}
Source: (StackOverflow)
I'm trying to make a simple web-browser for desktop with Ubuntu 14.04 using QML and WebEngineView component. The application will be working on devices with touchpad so it would be nice to make the content displayed inside WebEngineView flickable.
I tried to do it this way, but it does not work:
...
WebEngineView {
id: webView
url: "http://google.com"
width: parent.width
height: winternet.height-navigationBar.height-iStatusBar.height-iBackButton.height
anchors.top: navigationBar.bottom
MouseArea {
anchors.fill: parent
drag.target: parent.data
}
onLinkHovered: {
webView.url = hoveredUrl
}
}
...
If you have any idea's or experience with this, please help!
Source: (StackOverflow)
Im trying to use a webview in my qml code, but the scrolling is not wrking with those two versions of QtQuick and QtWebKit.
Also I tried the Flickable Web View, the scroll works fine but fixed position content is not properly repositionned.
What I have to do to fix those problems?
P.S: When I use QtQuick 2.0 and QtWebKit 3.0, there is no problem, and for materials constraints I have to use the version 1.0 for both. And Im using the version 5.3 of QT.
This is my qml class:
import QtQuick 1.0
import QtWebKit 1.0
Rectangle {
id: container
width: 700
height: 300
property string initialUrl: "http://bootstrap2modaldemo.scripting.com/"
Rectangle {
id: thumbnailContainer
color: "black"
anchors.bottom: container.bottom
width: container.width
}
Rectangle {
id: content
width: container.width
color: "black"
anchors {
top: container.top
bottom: thumbnailContainer.top
}
WebView {
id: webView
anchors.fill: parent
width: container.width
opacity: 1
url: container.initialUrl
}
}
}
Source: (StackOverflow)
I've noticed a strange behavior which prevent me from doing what I want.
If I have
Comp.qml :
Rectangle {
id: comp;
anchors.fill: parent
default property alias contents: flickable.children;
property int contentHeight: comp.height;
Flickable {
id: flickable;
anchors.fill: parent;
contentHeight: comp.contentHeight;
}
}
and
main.qml :
Rectangle {
id: root;
width: 400;
height: 400;
Comp {
contentHeight: 800;
Rectangle {
width: 800;
height: 800;
border.color: "black";
border.width: 5;
Component.onCompleted: console.debug(parent)
}
}
}
The flickable doesn't work.
If I try to put it all in one file, it work as expected :
main.qml :
Rectangle {
id: root;
width: 400;
height: 400;
Rectangle {
id: comp;
anchors.fill: parent
Flickable {
id: flickable;
anchors.fill: parent;
contentHeight: 800;
Rectangle {
width: 800;
height: 800;
border.color: "black";
border.width: 5;
}
}
}
}
Am i missing something ?
How to do an external component which content is in a flickable ?
Source: (StackOverflow)
I'm trying to call a function which is defined inside a Flickable element, but it seems impossible to access it by id. The following code produces ReferenceError: flickable is not defined
when tab.getValues()
is called:
import QtQuick 2.4
Tab {
id: tab
function getValues() {
flickable.getValues()
}
Flickable {
id: flickable
clip: true
flickableDirection: Flickable.VerticalFlick
contentHeight: column.height
topMargin: 2 * pxPermm
function getValues() {
console.log("flickable.getValues() called")
}
Column {
id: column
// some content
}
}
}
How else am I supposed to access the Flickable element? The function getValues() must be placed inside the Flickable because it needs to access elements placed inside the column.
Source: (StackOverflow)
To make a Android ViewPager-like for Qt, I use a listview like this:
ListView {
id: myListViewArticle
anchors.fill: parent
focus: true
highlightRangeMode: ListView.StrictlyEnforceRange
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
model: modelArticles
delegate: articleDelegate
}
And a Flickable as its delegate:
Component {
id: articleDelegate
Item {
id: item
width: 480; height: 800
Flickable {
id: mainScrollView
contentHeight: 1500
contentWidth: parent.width
anchors.fill: parent
clip: true
Text {
id: idArticleContent
text: articleContent
width: parent.width
font.pixelSize: 20
font.bold: true; color: "black"
wrapMode: Text.Wrap
}
}
ScrollDecorator {
flickableItem: mainScrollView
}
}
}
But after populate data for listview, I see the Flickable cannot be scrollable (in verticle).
Can anyone tell me how to make Flickable item scrollable inside a listview. Thanks so much for your help.
Source: (StackOverflow)