Jesper K. Pedersen
269 results
Flipable is a convenience component in Qt Quick that shows two different arbitrary elements: one on its front, and one on its back. Like a postcard, we can rotate the Flipable and see the other element. Flipable does not come with a built-in animation; we have to create one ourselves to make it look nicer.
In this video we'll introduce states and transitions in QML. States are a very convenient way to centralize the property values of a set of items in a user interface built in QML. While states define the values themselves, transitions define how to animate the change of the values corresponding to a state change.
Designers sometimes want to move a graphic element alongside a custom path, specified via bezier curves or SVG paths. PathAnimation is the tool for this job in QML; this video teaches you how to use it.
Qt's model/view framework is one of Qt's most challenging aspects. While list models are relatively straightforward, tree models require handling custom indexes, causing developers frustration for over a decade. Adding proxy models for filtering/sorting and communication through proxy stacks to base models increases complexity. Custom delegates are needed for different painting and event handling per row, column, or cell.
Components handling keyboard input must manage focus properly. Focus propagation between components is tricky in QML since the "focus" property has global effects. When multiple components need keyboard focus simultaneously, we must limit the "focus" property's consequences. The FocusScope element handles this by containing focus within specific areas.
Never store business-related state in QML - all business logic belongs in C++. However, UI-related state (like list view scroll position) may be stored in components. This video shows introducing ad-hoc properties in component elements that act as local variables for UI state management while maintaining proper separation of concerns.
QML code typically creates all elements immediately, which works for simple examples but wastes resources in complex applications. Creating all screens, pages, and dialogs on startup would consume excessive resources and slow application launch. The Loader component solves this by creating elements on demand, improving performance and resource management.
In the fourth module of our "Introduction to Qt / QML" series we explore components: that is, how to reuse QML code by encapsulating it in a separate piece that we can then create as many times as needed. In this video, the basics of creating an "out-of-line" component is defined as well as how to define a proper API for our components.
To complete the discussion about defining the interface of a component, this session shows how to add functions to a component ("methods"), as well as signals. Declarative programming is also discussed and why certain designs match QML's spirit much better than others.
In this video we discuss how sizing works when creating a reusable component, including how to make components that have adequate width and height out of the box. We also showcase GammaRay, the free software introspection tool for Qt applications developed by KDAB.
This video discusses keyboard handling in Qt Quick. Whether you have a physical keyboard, a virtual one, or maybe some special hard keys, you may want to have the elements in your scene react to the keypresses. There are a few ways to manage keyboard input: from just using an element such as TextInput, that solves the whole problem for us, to actually having custom logic to handle keyboard events.
Touch input extends beyond simple tapping to include gestures like flick motions for scrolling and pinch-to-zoom with two fingers. This video explains Qt Quick's gesture handling basics using built-in elements, demonstrating how to create touch interfaces by composing gesture elements with familiar components like images, rectangles, and text.
Sometimes you need to explore Qt's source code to understand behavior, track bugs, or learn implementation details. Qt is open source with high-quality, readable code available through download or binary installers. This video demonstrates setting up Qt Creator to quickly navigate Qt's source code using Locator shortcuts for efficient exploration.
The third module of the "Introduction to Qt/QML" series covers user interaction methods in Qt Quick applications. Qt Quick provides elements for mouse, touch, gesture, and keyboard input. This video focuses on MouseArea, the element handling mouse input, demonstrating how to make applications react to mouse presses, clicks, and other mouse interactions.
This video shows how to recreate the famous "Hello World" example using Qt Quick and QML. You will learn how to actually go from a QML source file to having a standalone running executable, that indeed shows the "Hello World" text.
Introducing the most basic visual transformations that you can apply to items in a Qt Quick scene. Any visual item can be scaled, rotated, or made translucent by acting on certain properties. This video explains how these properties work, and how visual transformations are propagated to children elements.
The transformations introduced in the previous video are not everything that Qt Quick offers. Sometimes we may need to rotate an item around an arbitrary point, or shear it using a custom 4x4 matrix. This video will feature an example of a custom visual transformation: we will create a very simple analog clock by rotating two images around a custom point.
User interfaces are built by positioning controls on screen. While changing x/y coordinates works for individual items, it doesn't scale for entire interfaces. Layout managers automatically handle positioning and sizing. This video introduces Qt Quick's anchor layouts - the simplest yet most common system. Anchors "glue" element sides together, making it easy to place elements side-by-side or align within parents.
This video discusses the dreaded "binding loop detected" warning that comes from the QML engine. Sometimes, it's pretty clear that we have created a loop (property A depends on B, which depends on A) and we can easily fix our code. Some other times, especially when anchor layouts are involved, this is not so clear. Watch this video for an explanation of what is going wrong and how to fix it.
Qt Quick offers more than simple colored rectangles with "color: 'red'". This video demonstrates various color specification methods including HTML hex-strings and normalized RGB floating point values, plus creating gradients in Qt Quick for more sophisticated visual effects beyond basic solid colors.