QtWidgets and QtQuick.Controls - A Comparison Qt Developer Days - - PowerPoint PPT Presentation

qtwidgets and qtquick controls a comparison
SMART_READER_LITE
LIVE PREVIEW

QtWidgets and QtQuick.Controls - A Comparison Qt Developer Days - - PowerPoint PPT Presentation

QtWidgets and QtQuick.Controls - A Comparison Qt Developer Days Europe 2014 Presented by Kevin Krammer kevin.krammer@kdab.com p.1 The Question The Queson Side-by-Side Comparison Conclusions The Question p.2 Common Question What should


slide-1
SLIDE 1

p.1

QtWidgets and QtQuick.Controls - A Comparison

Qt Developer Days Europe 2014 Presented by Kevin Krammer kevin.krammer@kdab.com

slide-2
SLIDE 2

p.2

The Question

The Queson Side-by-Side Comparison Conclusions The Question

slide-3
SLIDE 3

p.3

Common Question

What should I use for a new project: QtWidgets or QtQuick.Controls?

The Question

slide-4
SLIDE 4

p.4

Good Answer?

It depends!

The Question

slide-5
SLIDE 5

p.5

Side-by-Side Comparison

The Question Side-by-Side Comparison Conclusions Side-by-Side Comparison

slide-6
SLIDE 6

p.6

Base Line

Set of standard interface elements e.g. Button, CheckBox, Slider Layouting Styling Platform Look&Feel Custom Application Window Menu Bar, Tool Bar, Status Bar, etc Dialogs Standard Dialogs Base for Custom Dialogs Side-by-Side Comparison

slide-7
SLIDE 7

p.7

Requirements

QtWidgets System Graphics Buffers Qt Version basically any Programming Languages For Use C++ (QML + JavaScript with QML registered widgets) For Extending C++ QtQuick.Controls System OpenGL Qt Version > 5.1 Programming Languages For Use QML + JavaScript For Extending QML + JavaScript (composition) C++ (custom rendering) Side-by-Side Comparison

slide-8
SLIDE 8

p.8

Layouting

QtWidgets Horizontal/Vertical Box Layout, Grid Layout, Form Layout Layouts "fill" parent widget Widgets provide: Size Hints Size Policies Developer can override size hint, set policy QtQuick.Controls RowLayout, ColumnLayout, GridLayout, Anchors (relative positioning) Layouts need to be explicitly sized

  • r anchored

Controls provide: Implicit Size Developer can attach resize hints Side-by-Side Comparison

slide-9
SLIDE 9

p.9

Layouting - Example

QtWidgets

1 QVBoxLayout *layout = new QVBoxLayout(this); 2 3 QPushButton *one = new QPushButton("One"); 4

layout->addWidget(one);

5 6 QPushButton *two = new QPushButton("Two"); 7 layout->addWidget(two); 8 9 QPushButton *three = new QPushButton("Three"); 10 layout->addWidget(three);

QtQuick.Controls

1 ColumnLayout { 2 anchors.fill: parent 3 4

Button { text: "One" }

5 Button { text: "Two" } 6 Button { text: "Three" } 7 }

Side-by-Side Comparison

slide-10
SLIDE 10

p.10

Styling

QtWidgets Platform Native Styling Qt Style Sheets (QSS) QStyle Plugins QtQuick.Controls Platform Native Styling Style Component Replace parts of the control Side-by-Side Comparison

slide-11
SLIDE 11

p.11

Styling - Example

QtWidgets

QPushButton *button = new QPushButton("Click Me!", window); button->setStyleSheet("QPushButton {background-color: white}");

QtQuick.Controls

1 Button { 2 x: 50; y: 50 3 text: "Click Me!" 4 5 style: ButtonStyle { 6 background: Rectangle { 7 color: "white" 8 border.color: "#ABABAB" 9 } 10 } 11 }

Side-by-Side Comparison

slide-12
SLIDE 12

p.12

Application Window

QtWidgets QMainWindow Menu Bar Status Bar Any number of Tool Bars Adding actions results in Tool Buttons Dock Widgets Central Widget resized with window QtQuick.Controls ApplicationWindow Menu Bar Status Bar One Tool Bar Create Tool Buttons, then associate action Content item needs explicit resize handling Side-by-Side Comparison

slide-13
SLIDE 13

p.13

Dialogs

QtWidgets Standard Dialogs Color, File, Font, MessagBox, Print, Progress, Wizard Custom Dialogs Base type QDialog Modal and Non-modal QDialogButtonBox for platform correct button handling access to individual buttons possible accept/reject can be intercepted QtQuick.Controls Standard Dialogs Color, File, Font, Message Custom Dialogs Base type Dialog Modal and Non-modal standardButtons for platform correct button handling currently not access to buttons All actions close the dialog Side-by-Side Comparison

slide-14
SLIDE 14

p.14

Tooling

QtWidgets Qt Designer in QtCreator and stand- alone Code generated by UIC Used by delegation in custom classes Testing QtTest for unit testing Squish for UI testing Gammaray for runtime inspection C++ tools for debugging/analysis of custom code QtQuick.Controls QtQuick Designer in QtCreator Manipulates QML code directly Use by manual editing of the same files Testing QtTest for unit testing Squish for UI testing Gammaray for runtime inspection QtCreator JS debugger/profiler Side-by-Side Comparison

slide-15
SLIDE 15

p.15

Conclusions

The Question Side-by-Side Comparison Conclusions Conclusions

slide-16
SLIDE 16

p.16

Conclusions

Both technologies viable for wide range of projects QtQuick.Controls not as complete yet but rapidly evolving Knowledge of types easily transferable Knowledge of behavior not always applicable Conclusions