QT implementation of the list of small functions infinite load (creative very good: listen to scroll bar events, to the bottom of the new Qlistwidgetitem)

Source: Internet
Author: User
Concept Introduction

The combination of infinite load and waterfall flow is very novel in the development of Web front-end, and it has good performance form for Web content. Infinite loading does not load all the content at once, but instead refreshes the content by listening to the ScrollBar event. When the user drags the scroll bar down or uses the mouse wheel, the page automatically loads the rest of the content. As follows:

Simplicity and not simple, it is this ingenuity, break through the conventional design to get the favor of users ... Implementation Ideas

In front-end development You can use some jquery plug-ins to achieve this effect, the background only need to prepare the data on the line. How to add this effect to the list component (Qlistwidget,qtreewidget, qtablewidget) or try (Qlistview, Qtreeview, Qtableview) in Qt. The core principle of infinite loading above is to use JavaScript to listen to the browser's scrollbar events. It's easy to do so in Qt. We know that there is a base class in Qt called Qabstractscrollarea, which is an abstract base class that represents a scrollable region. Therefore, there are many methods in this class that are related to scroll bar operations. Qabstractscrollarea happens to be the parent of Q*view, which gives us an opportunity to manipulate the scroll bar.

Create a new form-based QT application project and derive a subclass from Qlistwidget: Mlistwidget. Why is it. Because we are going to do a little bit of a different action on the mouse wheel event: When the scroll bar scrolls, the current position of the scrollbar is updated in the Lineedit of the main window, and when the scroll bar is scrolled to the bottom, a signal is sent to update the data contents in Listwidget.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.