Introduction to Qt / QML (Part 21) - The Loader Element

preview_player
Показать описание
The QML code that we've explored so far immediately creates all the elements that we've specified (images, text, etc.). This is fine for simple examples, but what about a complex, real-world application?

Would it make sense for it to create all the screens, the pages, the dialogs on startup? Probably not – it would consume tons of resources, and slow down the application startup considerably. To tackle this problem, we need a way to create elements on demand. That's precisely what the Loader component does, which we will discuss in this video.

About the host:
This video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.

Рекомендации по теме
Комментарии
Автор

I tried to start a couple of Qt 6 books before finding this channel. This series is great in every aspect, probably the best intro material around. Subscribed and liking every single video as I'm going through the series!

Dimitris-Triantafyllidis
Автор

Thank you so much! This is the kind of video that we need. It is an example of, back in the day, when the internet was forming and people thought that a wonderful world of information sharing and learning was arising.

gustavosserra
Автор

Thank you for the great video, Jesper!

elpidamachairidou
Автор

Amazing you are sir, wish you the best dear teacher. :]

azeddinfaouzi
Автор

In other words, Loader allows you to make your elements loaded lazily.

whitestork
Автор

@KDAB is there a way to clear the cache of loader source ? Could you please tell me

senthilandavanp
Автор

loader.item gives the root element how can we access the item child ?

pulkitpunea
Автор

Hi jesper, i have a doubt regarding loading another page from mousearea on clicked event. if i want to show a page from another page's mousearea onclicked . how can i do this in qml?? any other method(rather than loader) available?

anjus
Автор

Is it possible for a loader fits to its own source? (e.g height)

CANDEEIRO
Автор

@KDAB: i am using source in the loader and I am using states to change the source . I am having the problem that previously loaded sources is coming for a moment and finally shows the correct source data. Kind of cache memory issue. Could you help me

senthilandavanp
Автор

Great video. I'm curious, though -- you caution against the use of imperative statements in QML (which I understand) but later you seem to use one in the Component you're creating. Am I missing something?

TheSilverbar
Автор

Qt 5.15 introduced null coalescing so at 1.25 I guess should be enough to do text: "Binding: " + loader.item.text ?? ""

mytffwwxg