Irc-Unix.net

Главная | Actual Topics | Обратная связь | В избранное | Сделать домашней | Антиспам ;)
Категории
 System & Utilities
 Unix News
 OS Emulator
 Developing
 Learning/Education
 Games
 Humour
Каталог статей
Все статьи

Antispam
Статьи
Биллу Гейтсу тоже предлагают избавиться ...
Вымогательство в борьбе со спамом
Календарь

November, 2018
ПнВтСрЧтПтСбВс
1234
567891011
12131415161718
19202122232425
2627282930
Опросы
Какой из этих ОС Вы отдаете большее предпочтение?

QNX
FreeBSD
Linux(any)
Solaris
Mac OS
Windows XP
Windows 2003
Что такое ОС? :)


Результаты
Другие опросы

Всего голосов: 327
Комментарии: 0
Ссылки

Архив Новостей
 November 2018 (3)
 October 2018 (13)
 September 2018 (8)
 August 2018 (8)
 July 2018 (11)
 June 2018 (13)
 May 2018 (10)
 April 2018 (14)
 March 2018 (11)
 February 2018 (13)
 January 2018 (13)
 December 2017 (14)
 November 2017 (15)
 October 2017 (19)
 September 2017 (18)
 August 2017 (13)
 February 2017 (14)
 January 2017 (19)
 December 2016 (16)
 November 2016 (16)
 October 2016 (21)
 September 2016 (18)
 August 2016 (16)
 July 2016 (16)
 June 2016 (20)
 May 2016 (18)
 April 2016 (15)
 March 2016 (22)
 February 2016 (17)
 January 2016 (15)
 December 2015 (15)
 November 2015 (22)
 October 2015 (20)
 September 2015 (17)
 August 2015 (25)
 July 2015 (20)
 June 2015 (23)
 May 2015 (21)
 April 2015 (17)
 March 2015 (19)
 February 2015 (9)
 January 2015 (23)
 December 2014 (9)
 November 2014 (13)
 October 2014 (12)
 September 2014 (18)
 August 2014 (20)
 July 2014 (10)
 June 2014 (12)
 May 2014 (12)
 April 2014 (10)
 March 2014 (22)
 February 2014 (10)
 January 2014 (8)
 December 2013 (26)
 November 2013 (53)
 October 2013 (40)
 September 2013 (48)
 August 2013 (63)
 July 2013 (56)
 June 2013 (52)
 May 2013 (49)
 April 2013 (67)
 March 2013 (74)
 February 2013 (63)
 January 2013 (62)
 December 2012 (62)
 November 2012 (66)
 October 2012 (68)
 September 2012 (48)
 August 2012 (75)
 July 2012 (60)
 June 2012 (71)
 May 2012 (69)
 April 2012 (85)
 March 2012 (86)
 February 2012 (90)
 January 2012 (81)
 December 2011 (103)
 November 2011 (118)
 October 2011 (74)
 September 2011 (2)
 June 2011 (110)
 May 2011 (118)
 April 2011 (111)
 March 2011 (112)
 February 2011 (101)
 January 2011 (119)
 December 2010 (117)
 November 2010 (118)
 October 2010 (131)
 September 2010 (117)
 August 2010 (226)
 July 2010 (351)
 June 2010 (305)
 May 2010 (319)
 April 2010 (343)
 March 2010 (329)
 February 2010 (311)
 January 2010 (312)
 December 2009 (266)
 November 2009 (156)
 July 2009 (101)
 June 2009 (279)
 May 2009 (365)
 April 2009 (348)
 March 2009 (347)
 February 2009 (323)
 January 2009 (318)
 December 2008 (237)
 November 2008 (155)
 October 2008 (334)
 September 2008 (310)
 August 2008 (343)
 July 2008 (362)
 June 2008 (322)
 May 2008 (464)
 April 2008 (1276)
 March 2008 (1658)
 February 2008 (250)
 January 2008 (6)
 November 2007 (1)
 September 2007 (1)
 June 2007 (1)
 May 2007 (1)
 March 2007 (1)
 January 2007 (2)
 December 2006 (1)
 October 2006 (2)
 September 2006 (1)
 August 2006 (2)

Qt applications with Cargo

System & Utilities

This blog shows how Qt applications can be built with Cargo. The goal is to make compiling them as simple as installing Qt and running

Rust Qt Binding Generator (Logo by Alessandro Longo)Rust Qt Binding Generator (Logo by Alessandro Longo)

The crates qrep and mailmodel are examples. You can try qrep with

qrep is a minimal GUI for ripgrep.

qrepqrep

You can get started quickly with your own Rust Qt application by copying the folder templates/qt_quick_cargo from the Rust Qt Binding Generator repository.

Why Cargo?

In previous blogs we built applications with CMake. CMake is probably the most widely used tool to compile Qt software. CMake uses Cargo to build the Rust parts.

CMake is a familiar tool for Qt developers, but not for Rust developers. For them, CMake is a unneeded hurdle. Rust Qt Binding Generator can be used with only Cargo. To do so you use the Rust way of building C++ code: build.rs.

build.rs

build.rs contains Rust code that is compiled and run by Cargo to build an application. Here is a simple build.rs file:

This file is placed directly in your project folder. The last command, compile("my_project"), compiles a library called my_project.

Cargo.toml

build.rs and the name of the library should be added to Cargo.toml:

[package]
name = \"my_project\"
version = \"0.1.0\"
build = \"build.rs\" # use build.rs for custom build steps
links = \"my_project\" # and link to the resulting library

[dependencies]
libc = \"0.2\"

[build-dependencies]
rust_qt_binding_generator = \"0.2\"

src/main.rs

main.rs is the entry point for Rust applications. In these applications, two things should happen:

  • include the generated Rust code interface.rs.

  • call into the C++ code.

Qt applications have an event loop. Starting this loop requires some C++ code. We start the event loop in a C++ function. The name of the application is passed to this function.

src/main.cpp

The template contains one C++ file. That is usually all you need. But it’s possible to add more C++ files by adding more calls to Build::cpp.

This file loads the GUI from a QML file and starts the event loop.

qml.qrc

Qt applications can contain resources. These are embedded files that are accessible via qrc: URLs. The template application contains two resources: main.qml and MainForm.qml. Other resources such as translations or application icons can be added as well.

Concluding

The option to build Qt applications with Cargo should please Rust programmers. I’ve ported my personal projects to build this way. Using CMake is also still supported and is recommended for C++ projects that currently use CMake and would to introduce Rust.

This feature is new and not widely tested. Bugs can be filed here.





  


Разместил: Planet KDE | Дата: 30.10.2018 | Прочитано: 22 | Раздел: System & Utilities   

Рейтинг статьи

Средняя оценка: 0.00/0Средняя оценка: 0Всего голосов:0

Отлично
Хорошо Нормально Пойдёт Плохо


Смотрите также связанные темы

15.12.2015 QNX and AdasWorks Collaborate on Automated Driving Technology
"Companies integrating software technologies to enable intelligent, multi-camera surround-view systems. Ottawa, Ontario and Budapest, Hungary December 10, 2015 QNX Software Systems Limited, a subsidiary of BlackBerry Limited, and AdasWorks, an innovative startup developing artificial intelligence-based software for automated driving, today announced a technology partnership focused on advanced driver assistance systems ADAS and autonomous vehicles. As part of the new initiative, the companies are porting several AdasWorks functions, including lane detection, moving-object detection, and objec...
29.12.2015 Luxoft Teams Up with QNX on Automotive ADAS Technologies
"Collaboration focused on advanced technologies, including road scene reconstruction and augmented navigation, which can enable semiautonomous driving.December 15, 2015 Luxoft Holding, Inc. NYSE:LXFT, a leading provider of software development services and innovative IT solutions to a global client base, and QNX Software Systems Limited, a subsidiary of BlackBerry Limited, today announced a new technology partnership focused on ADAS systems used by automotive original equipment manufacturers OEMs and Tier 1 suppliers. As part of the initiative, Luxoft will leverage its expertise in road-model...
12.01.2016 QNX INTRODUCES HOLISTIC APPROACH TO MANAGING IN-CAR ACOUSTICS
"New platform offers unified management of all acoustics in the car, enabling customers to reduce the cost, complexity, and time-to-production of audio signal-processing systems. Las Vegas, International CES 2016, LVCC North Hall, Booth 325 - January 6 - QNX Software Systems Limited, a subsidiary of BlackBerry Limited, today announced the new QNXreg; Acoustics Management Platform AMP, a comprehensive solution that allows automakers to enhance the audio and acoustic experience for drivers and passengers, while reducing system costs and complexity.Modern vehicles contain multiple acoustic and au...
19.02.2016 Linux distros aren't updating WebKit, making web browsers and email clients vulnerable
The WebKit rendering engine used in many Linux applications is a complete security mess. That's the takeaway from a blog post by Michael Catanzaro, who works on GNOME's WebKitGTK+ project.
31.03.2016 KDE Announces Kirigami UI, a Framework to Build Cross-Platform Qt-based Apps
KDE proudly announced the release and immediate availability of a new framework for developers who want to build cross-platform Qt-based applications.
20.11.2016 When Trying Out Tumbleweed, It's Easy To See Why OpenSUSE Leap Disabled Nouveau
Earlier this month with openSUSE 42.2 RC2 they made the decision to disable Nouveau 3D support by default . They decided to disable this open-source NVIDIA Gallium3D support due to bugs with KDE like KDE crashing on some cards, some Qt applications not working, etc.
13.01.2017 KDE Applications 16.12 Gets Its First Point Release, Over 40 Recorded Bugs Fixed
KDE Applications 16.12 was released a month ago, and, since then, users have submitted bugs and feature requests through the usual channels, and KDE Applications 16.12.1 is here to fix over 40 of them, in particular a data loss bug in the iCal resource. Several of the bundled KDE applications shipped with the KDE Applications software suite received new versions as well, with bugfixes or various improvements.
15.08.2017 Running applications and unittests without 'make install'
In our Akademy presentation, Kevin and I showed the importance for a better developer story to be able to work on a KDE module without having to install it. Running unittests and running applications without installing the module at all is possible, it turns out, it just needs a bit of effort to set things up correctly.
30.03.2018 Konstruct
'Konstruct' is a build system for installing KDE releases and applications on your system. It downloads defined source tarballs, checks their integrity, decompresses, patches, configures, builds, and installs them.
12.05.2008 Sun продемонстрировал RIA-инструменты на Google Android
На ежегодной конференции JavaOne, Sun Microsystems продемонстрировала технологию JavaFX для создания Rich Internet Applications (RIA). Sun заявила, что технология будет доступна для GNU/Linux под лицензией GPL осенью этого года; JavaFX Mobile и JavaFX TV будут доступны весной следующего года. Sun анонсировала JavaFX на прошлой конференции JavaOne. Изначально планировалось первой выпустить мобильную версию, но на данный момент приоритет отдан десктопной версии. JavaFX - прямой конкурент таких RIA-технологий, как Adobe AIR (основанный на WebKit) и Microsoft Silverlight (кросс-платформенный плаги...
Нет комментариев. Почему бы Вам не оставить свой?
Вы не можете отправить комментарий анонимно, пожалуйста зарегистрируйтесь.
Google Search
Google

Web irc-unix.net

Топ Новостей
1: Fedora and KDE/spin\'s treatment - Discussion
Hot NEWS!
Просмотров - 2984


2: Offline Vaults for an extra layer of protection
Просмотров - 758

3: KDE\'s Kirigami 2.0 Framework for Convergent UIs Enters Beta with New Features
Просмотров - 739

4: Akonadi/KMail issues on Tumbleweed?
Просмотров - 672

5: Netrunner Desktop 16.09 "Avalon" Linux OS Is Out with Kernel 4.7, KDE Plasma 5.7
Просмотров - 645

6: KDevelop 5.0.2 released for Windows and Linux
Просмотров - 637

7: Debugging issues booting a PC in 2018
Просмотров - 636

8: plib3.gui 0.9.9
Просмотров - 602

9: Konstruct
Просмотров - 596

10: Best Desktop Environment
Просмотров - 580

11: KDE Connect – State of the union
Просмотров - 572

12: KDE Connect Sprint
Просмотров - 571

13: Multi-screen woes in Plasma 5.7
Просмотров - 571

14: Come dine with the KDE e.V. board in Berlin in October
Просмотров - 569

15: Help Canonical Test GNOME Patches, Android Apps Illegally Tracking Kids, MySQL 8.0 Released and More
Просмотров - 559

Google 120X240
Ссылки

Главная | Actual Topics | Статьи | Обратная связь | Guest Book
Генерация: 1.394 сек. и 13 запросов к базе данных за 1.325 сек.
Powered by SLAED CMS © 2005-2007 SLAED. All rights reserved.