A set of useful QML components based on QtQuick Controls 2
- Qt 5.15 or higher
Include the QtQuickUtils.pri
file in your qmake project:
include(QtQuickUtils/QtQuickUtils.pri)
set Qt Quick style to Material
in main.cpp
of your app before loading qml engine:
QQuickStyle::setStyle("Material");
add qrc path to qml import pathes in your main.cpp
:
QQmlApplicationEngine engine;
engine.addImportPath("qrc:///");
then you can include QtQuickUtils module in any qml file:
import QtQuickUtils 1.0
and define any of the components:
SwipeArea {
onSwipeRight: {
...
}
}
to enable using virtual keyboard, set the relevant environment variable before loading qml engine:
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
and set this context property:
engine.rootContext()->setContextProperty(
"HASVIRTUALKEYBOARD",
QProcessEnvironment::systemEnvironment().value("QT_IM_MODULE") ==
"qtvirtualkeyboard");
Check the provided example in the source code if you have any confusion.
In case you want to use individual components in your source code without using ExtendedApplicationWindow
as the main type in main.qml
,
you should define a font loader for Font Awesome in your main.qml
as it's the font for icons of components:
FontLoader {
id: fontAwesome
source: "qrc:/path/to/Font Awesome 6 Free-Solid-900.otf"
}
Extends ApplicationWindow
with the following features:
- Dark and light themes with Roboto font and Font Awesome for icons
- Login dialog, splash screen and about dialog
- UI scaling
- Virtual keyboard
Extends Dialog
and adds icon, close button, ability to move and common YES/NO/OK/CANCEL buttons in footer
A Dialog
to ask username and password
Control that shows user profile image or an abbreviation of user name and surname
Another busyindicator with a different look
A control to select color from predefined ones or custom color
A spinbox for double values with specified decimals
Component to define and select time duration in hours, minutes and seconds
Combobox
, Spinbox
and Textfield
respectively with titles flowing based on width. If the width is not sufficient to display title and content,
component content is flowed to buttom:
Button
, RoundButton
and TabButton
with ability to define Font Awesome icon
Menu
and MenuItem
with a Font Awesome icon
A dialog to preview images with ability to zoom and pan
A login dialog with utiltiy components suitable for start of application
An auto opening/closing panel to show appilcation messages with icons
A popup to show a specific message or alarm to user
Textfield
suitable for passwords and option to view entered value
An auto-hiding splashscreen window
A MouseArea
that detects swipe left/right/up/down gestures
A component that defines and handles a virtual keyboard for application
Copyright (C) 2022-present Nejat Afshar nejatafshar@gmail.com
Distributed under the MIT License (http://opensource.org/licenses/MIT)