How can i change the speed of listview scrolling in QML? - qt

I have created a list by using listview in QML. In my case, i want to change the speed of the list scrolling, scrollBar and the highlight to different value. For example,
Here is a list. While i move the highlight to the next element, three types of animation will be happened.
scrollBar will scroll to bottom
list will scroll to the top
highlight will scroll to the next element
As i known, i can change the the highlight by
ListView {
highlightMoveDuration : 200
}
I found that three types animations will start at the same time and last for the same time.
But in my case, i want to set three animations to stop at different time.
For example:
ScrollBar: start:0, End:300
List: start:0, End:400
highlight: start:0, End:200
How can i do that. Also, if they start at the different time, how can i do that?

Related

How to easily recognize searched item in a dense QGraphicsScene?

I have a QGraphicsScene with many QGraphicsItem like circle, rectangle, polylines, arc etc.
Every QGraphicsItem has a name. And I have a Search feature which highlights searched items using that name. When scene contains fewer items, highlighted items are seen properly. But when scene contains many items ( 100 + ) then identifying the highlighted item becomes difficult. For that I need to scroll up - down or left - right to check where is that highlighted item is.
So I want my highlighted item to be easily recognizable.
For that I was suggested, some approach like
Take searched item in front
Or
Add some marker
But I do not know, how to implement it , which Qt class should I use etc.
QGraphicsScene displays items depending on their stacking, i.e., when you call .items(), the first item in the QList is the topmost item on the scene.
The ordering of the items is depending on their respective Z-values which you can set for the QGraphicsItem by calling .setZValue()
You can read more about this on the following link: https://doc.qt.io/qt-5/qgraphicsitem.html#sorting
As for your question on how to put them in front. If you implemented your own children classes of QGraphicsItem, you can add a method or a slot to toggle them "on-top". E.g., all of the items usually have a Z-order of 0, so your method could just set it to 1 when the item is highlighted and revert it to 0 when it's not.

xamarin.forms scrollView with image is slow in android

I have dynamic list with 20~ cells.
I have 3 types of cells so i can't use Listview.
I am using ScrollView that contains StackLayout with the cell elements.
each cell element is also a StackLayout that contains some labels and buttons
the scrolling is smooth.
I have option in each cell to add image by a pressing a button inside the cell.
After the image is added, the scroll is getting very slow when arriving to the cell with the image.
when scrolling beyond the image, the scroll become smooth again
I have also tried TableView but the scrolling is not smooth when presenting the Cells (without adding the image)
How can i improve the rendering of the image ?
I have 3 types of cells so i can't use Listview.
Actually you can use a ListView, by using a DataTemplateSelector. As long as you have a collection containing all of the objects to be displayed, and each object in the collection indicates the cell type (usually because of it model's type), ListView with DataTemplateSelector will work great.
Whether you stick with ScrollView or move to ListView, look into FFImageLoading for displaying images if possible. While it doesn't solve all image display problems, it often does help with responsiveness and image size issues.

QML: GridView/SwipeView with drag and drop

I have a list of lets say 20 buttons (this number can change dynamically) in a listView which I want to display using a grid on a swipeView or gridView. Only 6 buttons should be visible at once. In addition, it should be possible to exchange the position of buttons via drag and drop (see http://doc.qt.io/qt-5/qtquick-draganddrop-example.html). In case gridView is the way to go, is it possible to have it behave like swipeView, so that the buttons can not be moved to an arbitrary position but lock onto their column?
You might want to give snapMode a try.
You have the choice of:
GridView.NoSnap (default) - the view stops anywhere within the visible area.
GridView.SnapToRow - the view settles with a row (or column for GridView.FlowTopToBottom flow) aligned with the start of the view.
GridView.SnapOneRow - the view will settle no more than one row (or column for GridView.FlowTopToBottom flow) away from the first visible row at the time the mouse button is released. This mode is particularly useful for moving one page at a time.
You need to make sure, that the size of the GridView really fits your desired amount of delegates, for it will only make sure, that the first element is aligned, not that there is no element paritally protruding the view.

Qt overlay(drop-up) box

I am creating a Qt application where I need to display contents in an overlay box(Please refer to the attached image). The box needs to slide up from behind the bottom dock when a button is pressed and slide down by toggling the button. I tried with a QWidget but couldn't achieve what I wanted. Also I don't know how to list the elements in the overlay box. The elements are dynamic or changing.
The widgets stacking order is defined by their order in the QObject hierarchy tree. The first element is the bottom, and every next is on top of the previous. Children are on top of their parents, in widgets confined within their bounds, in QML free.
If you want that sliding element to appear on top of everything else, just put its parent on top of everything else.
After all it is on top of the bottom control bar, which is on top of the playlist, so you have it all worked out for you.
The same applies if you decide to do the wiser thing and use QML instead of QWidget. Animation and states are much easier there. Not to mention more specific designs.

Flex horizontal tile list

I am using a horizontal tilelist in flex to display an image gallery with only one item in horiz. tilelist being shown at a time. I have next and previous buttons on both sides.
The problem is I want to display a particular item/image in that list when user clicks on a thumb image from another thumbimages tilelist at bottom.
I used someTilelist.selectedIndex property but it just selects that particular index in list, it does not show that particular item/image. I want the list to show that particular image, not just select it. Please take note that the horiz. tilelist shows only one image at time.
tilelist.scrollToIndex(index);

Resources