KDE Frameworks/pt-br: Difference between revisions

    From KDE TechBase
    (Created page with "* Os Frameworks de nível 1 podem depender apenas das estruturas oficiais do Qt ou de outras bibliotecas do sistema;")
    (Created page with "* Os Frameworks da camada 2 podem depender apenas das estruturas da camada 1, estruturas oficiais do Qt ou outras bibliotecas do sistema;")
    Line 25: Line 25:
    * Os Frameworks de nível 1 podem depender apenas das estruturas oficiais do Qt ou de outras bibliotecas do sistema;
    * Os Frameworks de nível 1 podem depender apenas das estruturas oficiais do Qt ou de outras bibliotecas do sistema;


    * Tier 2 Frameworks can depend only on Tier 1 Frameworks, Qt official frameworks, or other system libraries;
    * Os Frameworks da camada 2 podem depender apenas das estruturas da camada 1, estruturas oficiais do Qt ou outras bibliotecas do sistema;


    * Tier 3 Frameworks can depend only on other Tier 3 Frameworks, Tier 2 Frameworks, Tier 1 Frameworks, Qt official frameworks, or other system libraries.
    * Tier 3 Frameworks can depend only on other Tier 3 Frameworks, Tier 2 Frameworks, Tier 1 Frameworks, Qt official frameworks, or other system libraries.

    Revision as of 19:13, 23 October 2019

    Other languages:

    O KDE Frameworks, atualmente versão 5 ou KF5, é uma coleção de 80 bibliotecas criadas sobre o Qt application framework e fornece tudo, desde classes de utilitário a E/S assíncronas e transparentes à rede, além de modelos e widgets de dados adicionais, até integração centralizada em desktop. Se o próprio Qt não fornecer uma certa funcionalidade ou recurso, é provável que exista um KDE framework para isso.

    Embora o KF5 sirva como os blocos de construção mais básicos do software KDE, eles podem ser usados por qualquer aplicativo Qtx, como qualquer biblioteca adicional do Qt de terceiros. Assim como qualquer outro software KDE, o KF5 usa e favorece o sistema de build do CMake, mas todos os frameworks também suportam o QMake. Muitas estruturas estão disponíveis em múltiplos sistemas operacionais desktop, como Linux e Windows, e estão disponíveis até no Android. Certifique-se de verificar a documentação de cada framework para suas plataformas suportadas.

    Garantias e Licença

    O KDE, é claro, leva a qualidade do software a sério, ainda mais quando se trata do KF5. Os Frameworks vêm com políticas de qualidade, e para garantir que você não precise esperar que seu bug favorito seja corrigido, uma nova versão é lançada mensalmente. E como é um software livre desenvolvido em um ambiente aberto, qualquer pessoa pode participar ou comentar sobre seu desenvolvimento.


    Informação
    A versão atual do KDE Frameworks é 5.63.0. Por favor, consulte o release announcement para obter mais informações.


    Os KDE Frameworks também são lançados sob as permissive LGPL ou BSD/MIT licenses, tornando-as ideais e utilizáveis para qualquer tipo de software.

    Organização

    Cada um dos KDE Frameworks possui um Nível e um Tipo, como você verá na documentação da API. Embora não seja essencial para o uso dos frameworks, essa organização pode ajudar os desenvolvedores a determinar as dependências dos frameworks.

    As camadas agrupam os frameworks de acordo com o que eles 'linkam' durante a compilação.

    • Os Frameworks de nível 1 podem depender apenas das estruturas oficiais do Qt ou de outras bibliotecas do sistema;
    • Os Frameworks da camada 2 podem depender apenas das estruturas da camada 1, estruturas oficiais do Qt ou outras bibliotecas do sistema;
    • Tier 3 Frameworks can depend only on other Tier 3 Frameworks, Tier 2 Frameworks, Tier 1 Frameworks, Qt official frameworks, or other system libraries.

    Types, on the other hand, refer to the framework's runtime dependencies:

    • Functional Frameworks cannot have runtime dependencies. KArchive, for example, can be used as-is as a drop-in library.
    • Integration Frameworks can have optional runtime dependencies and aim at integrating with the underlying OS/Platform. Solid needs other runtime components to deliver hardware information on different platforms.
    • Solutions have mandatory runtime dependencies to function. KIO, the KDE I/O framework, requires certain daemons to offer a network-transparent virtual filesystem.

    Quick Start Guide

    How easy is it to use KDE Frameworks 5? Just as easy as using any Qt widget or adding any C++ library to your project. You don't even have to switch away from QMake if that's your cup of tea. Here's one very quick and dirty example of how simple it is to use a framework.

    Note
    The example below is written just for demonstration purposes and does not reflect proper coding practices or conventions. For more in-depth examples, please check our Tutorials section.


    Step 1: Install the Framework you need

    For this example, we'll be using the KDatePicker widget from the KWidgetsAddons framework. On KDE Neon/Ubuntu/Debian, it's as simple as:

    sudo apt install libkf5widgetsaddons-dev
    

    Adjust according to your Linux distro's packaging system, of course. If you want the latest version of the framework and it isn't available from your distro, you will have to get it from the source (Git or tarball) and build it yourself. Check out the KDE Community's handy guide to building KDE software from source.

    Step 2: Add the Framework to your Project

    Add the Framework's name, properly capitalized, in your QMake project file just like you would any other Qt module.

    TEMPLATE = app
    TARGET = kdatepicker-example
    
    QT += core widgets KWidgetsAddons
    
    SOURCES += main.cpp
    

    If you're already using CMake as your build system of choice, you'll want to also grab the Extra CMake Modules made by the KDE community to provide modules and macros to make finding and linking to Frameworks so much easier.

    Step 3: Use the Framework

    KDatePicker, like many other widgets from KDE Frameworks, behave just like any Qt widget. As such, you can simply slot them in or use them in Qt projects with no problem at all. Here is a contrived example where selecting a date from the calendar widget displays its string representation on the label beside it.

    #include <KDatePicker>
    
    #include <QApplication>
    #include <QLabel>
    #include <QHBoxLayout>
    
    int main(int argc, char* argv[])
    {
        QApplication app(argc, argv);
        QWidget* window = new QWidget;
    
        QLabel* dateLabel = new QLabel(QDate::currentDate().toString());
        KDatePicker* datePicker = new KDatePicker;
    
        QObject::connect(datePicker, &KDatePicker::dateSelected, [=] (const QDate &dateSelected) { dateLabel->setText(dateSelected.toString()); });
    
        QHBoxLayout* layout = new QHBoxLayout;
        layout->addWidget(dateLabel);
        layout->addWidget(datePicker);
    
        window->setLayout(layout);
        window->show();
    
        return app.exec();
    }
    

    Just build the project as normal and that's it! Welcome to the wonderful world of KDE-powered software!

    Frameworks Sampler

    Now that you've seen how easy it is to add KDE Frameworks into your software, here's an appetizer of the various frameworks available and what they can do for you.

    • Like KDatePicker above, KWidgetsAddons offers a wide variety of add-on widgets that go beyond what Qt itself offers. On the other hand, KCoreAddons includes non-graphical utility classes that help manage children processes, create autosave files, and create factory-style plugins.
    • Sonnet adds multi-language spellchecking to any QTextEdit (really QTextDocument) object with support for different spelling backends while KSyntaxHighighting extends Qt's syntax highlighting support with a standardized and expandable syntax definition format.
    • ThreadWeaver takes the pain out of one of the most difficult aspects of modern application development: multi-threaded programming.
    • KConfig lets you have a configuration system that works across platforms, no matter the actual back-end file format. KPackage, on the other hand, can help you extend your programs with content that is installed like plugins.
    • If you need to embed an advanced text editor but don't want to go through the hassle of writing one yourself, KTextEditor offers all the functionality you need either as a library or an embeddable KPart.
    • Kirigami is like a framework inside a framework, providing a rich set of Qt Quick components for developing a new breed of applications that bridge the divide between screen sizes and form factors.
    • And, of course, there's the Plasma framework that serves as the foundation for KDE's Plasma workspaces, both for desktops as well as mobile, giving developers the building blocks for creating primary user interfaces as well as applets (widgets) to run on those workspaces.


    Be sure to check the full collection of 80 KDE Frameworks on the API documentation website along with other KDE libraries you can use to develop the next killer app, be it on Linux or Windows, desktop or mobile, and anything else in between.

    Links Importantes