๐Ÿ“œ โฌ†๏ธ โฌ‡๏ธ

Why I love Qt and you all should love him too


After a day of fasting, I began to notice the leakage of karma, so I apologize in advance for the possibly unacceptable writing style in the article and subjectivity

Hi, Habrahabr!

Recently, I could not help but notice the popularity of the Qt topic in the factory, but nevertheless, people who say frankly deceitful and incomprehensible things continue to appear in the comments. With this post I wanted to dispel a bit of misconceptions about Qt and tell you why you should switch from your Java / Obj-C / .NET to soft and fluffy Qt .
')
Under the cut there will be a lot of impressions, subjectivity and my humble opinions on the account of the most wonderful application development framework. However, I will try to add interesting things so that my article has acquired at least some technical useful sense. I hope you get an interesting reading and you will like it.

Here we go?

Veshch number 1. C ++ API


It's no secret that Qt has a very convenient API, and more specifically, the qtbase module contains a sufficient number of classes for most everyday tasks ( Qt is more than a GUI framework, lol ). I have already spoken about the wrappers of STL containers in my article three years ago - tyts . Classes for working with strings, debugging output, and many, many things, also included.

QString fruits = "apple, banana, orange, banana";
QStringList fruitsList = fruits.split(", ");
qDebug() << fruitsList; //    [ "apple", "banana", "orange", "banana" ]
fruitsList.removeDuplicates();
fruits = fruitsList.join(", ");
qDebug() << fruits; //    "apple, banana, orange"

, Qt XML, ( - MVC), OpenGL, /- (Phonon), , WebKit2. , โ€” 90% , *.

C++, , Qt - . , .

โ„–2. Qt Quick


Qt Quick โ€” . QML (, , ), JavaScript, . , , , JavaScript. , ( Qt Project โ€” ).

image

import QtQuick 2.0

Rectangle {
    id: page
    width: 320; height: 480
    color: "lightgray"

    Text {
        id: helloText
        text: "Hello world!"
        y: 30
        anchors.horizontalCenter: page.horizontalCenter
        font.pointSize: 24; font.bold: true
    }

    Grid {
        id: colorPicker
        x: 4; anchors.bottom: page.bottom; anchors.bottomMargin: 4
        rows: 2; columns: 3; spacing: 3

        Cell { cellColor: "red"; onClicked: helloText.color = cellColor }
        Cell { cellColor: "green"; onClicked: helloText.color = cellColor }
        Cell { cellColor: "blue"; onClicked: helloText.color = cellColor }
        Cell { cellColor: "yellow"; onClicked: helloText.color = cellColor }
        Cell { cellColor: "steelblue"; onClicked: helloText.color = cellColor }
        Cell { cellColor: "black"; onClicked: helloText.color = cellColor }
    }
}

Cell
import QtQuick 2.0

Item {
    id: container
    property alias cellColor: rectangle.color
    signal clicked(color cellColor)

    width: 40; height: 25

    Rectangle {
        id: rectangle
        border.color: "white"
        anchors.fill: parent
    }

    MouseArea {
        anchors.fill: parent
        onClicked: container.clicked(container.cellColor)
    }
}



++ . , ? โ€” , . , QML ++. Qt Software โ€” , .

โ„–3.


. , Qt โ€” 5 . Qt โ€” Qt Developer Days Qt Contributors' Summit. , , โ€” , . ยซยป Qt โ€” , 10 . , โ€” .



, . Qt Project , . , , , Qt.

โ„–4. code review


, Digia (. +), KDAB, ICS -. Gitorious โ€” . , โ€” ( , โ€” ) โ€” , . ( Git / Review Board) .



, , qtbase, โ€” .

โ„–5.


Qt , 90-. , Trolltech Nokia, Digia. , . (++ , QWidget), . , , โ€” Qt Creator, Qt !



^ Qt Creator, .

, , , , codebase โ€” ( ). .

, iOS, Android, Windows Phone, !


, Qt โ€” , .
!
, namespace.

Source: https://habr.com/ru/post/221523/


All Articles