All Projects → tetsurom → Rxqt

tetsurom / Rxqt

Licence: mit
The Reactive Extensions for Qt.

Labels

Projects that are alternatives of or similar to Rxqt

Toggldesktop
Toggl Desktop app for Windows, Mac and Linux
Stars: ✭ 1,663 (+1141.04%)
Mutual labels:  qt
Tabtoolbar
A small library for creating tabbed toolbars
Stars: ✭ 129 (-3.73%)
Mutual labels:  qt
Versatile
A simple 3D model editor based on simple quads and a sprite set.
Stars: ✭ 132 (-1.49%)
Mutual labels:  qt
Qtnetworkng
QtNetwork Next Generation. A coroutine based network framework for Qt/C++, with more simpler API than boost::asio.
Stars: ✭ 125 (-6.72%)
Mutual labels:  qt
Embedded Ide
IDE for C embedded development centered on bare-metal ARM systems
Stars: ✭ 127 (-5.22%)
Mutual labels:  qt
Frequest
FRequest - A fast, lightweight and opensource desktop application to make HTTP(s) requests
Stars: ✭ 130 (-2.99%)
Mutual labels:  qt
Depthmapx
depthmapX is a multi-platform Spatial Network Analysis Software
Stars: ✭ 120 (-10.45%)
Mutual labels:  qt
Dart redux epics
Redux.dart middleware for handling actions using Dart Streams
Stars: ✭ 133 (-0.75%)
Mutual labels:  rx
Pref
Portable Reverse Engineering Framework
Stars: ✭ 127 (-5.22%)
Mutual labels:  qt
Remote Software
💎 YIO Remote Software repository
Stars: ✭ 132 (-1.49%)
Mutual labels:  qt
Openage
Free (as in freedom) open source clone of the Age of Empires II engine 🚀
Stars: ✭ 10,712 (+7894.03%)
Mutual labels:  qt
Qgnomeplatform
QPlatformTheme for a better Qt application inclusion in GNOME
Stars: ✭ 126 (-5.97%)
Mutual labels:  qt
Ttkdownloader
TTKDownloader that imitation xunlei downloader, based on Qt for windows and linux.
Stars: ✭ 131 (-2.24%)
Mutual labels:  qt
Kdstatemachineeditor
A framework for creating Qt State Machine metacode using a graphical user interface
Stars: ✭ 121 (-9.7%)
Mutual labels:  qt
React Nodegui Starter
Starter repository for react based native desktop apps using react-nodegui
Stars: ✭ 132 (-1.49%)
Mutual labels:  qt
Mindforger
Thinking notebook and Markdown editor.
Stars: ✭ 1,695 (+1164.93%)
Mutual labels:  qt
Onvif Qt Server Client
Onvif QT Server Client is a sample for creating Onvif Server and Onvif Client with QT C++
Stars: ✭ 130 (-2.99%)
Mutual labels:  qt
Qtandroidtools
A library to manage Android from QML
Stars: ✭ 134 (+0%)
Mutual labels:  qt
Feedback
Feedback & wiki for Snipaste https://snipaste.com
Stars: ✭ 1,863 (+1290.3%)
Mutual labels:  qt
Qribbon
Qt 实现的 Ribbon 风格菜单栏,基本思路是定制QTabWidget,通过QSS(样式表)实现显示样式的调整,QRibbon的原则是尽量不侵入正常业务逻辑的开发,所以在开发基于QMainWindow的程序时,可以按照正常的开发流程创建界面,创建普通的菜单栏以及菜单项及其信号槽关联,最后调用QRibbon::install(&mainWindow)函数即可自动创建出与QMainWindow原有QMenuBar相对应的Ribbon...
Stars: ✭ 131 (-2.24%)
Mutual labels:  qt

RxQt

The Reactive Extensions for Qt.

Actions Status

Example

#include <rxqt.hpp>
#include <QApplication>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>

using namespace std::chrono;

namespace Rx {
    using namespace rxcpp;
    using namespace rxcpp::sources;
    using namespace rxcpp::operators;
    using namespace rxcpp::util;
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    rxqt::run_loop rxqt_run_loop;

    auto widget = std::make_unique<QWidget>();
    auto layout = new QVBoxLayout;
    widget->setLayout(layout);

    auto button = new QPushButton("Click me");
    auto label = new QLabel;

    layout->addWidget(button);
    layout->addWidget(label);

    auto count = std::make_shared<int>(0);

    rxqt::from_signal(button, &QPushButton::clicked)
            .map([=](const auto&){ return (*count) += 1; })
            .debounce(milliseconds(QApplication::doubleClickInterval()))
            .tap([=](int){ (*count) = 0; })
            .subscribe([label](int x){ label->setText(QString("%1-ple click.").arg(x)); });

    rxqt::from_signal(button, &QPushButton::pressed)
            .subscribe([=](const auto&){ label->setText(QString()); });

    widget->show();
    return app.exec();
}

APIs

from_signal

observable<T> rxqt::from_signal(const QObject* sender, PointerToMemberFunction signal);

Convert Qt signal to an observable. T is decided as following.

Signal parameter type(s) T Note
void long Count of signal emission
A0 A0
A0, A1, ..., An (n > 1) tuple<A0, A1, ..., An>
template<size_t N>
observable<T> rxqt::from_signal(const QObject* sender, PointerToMemberFunction signal);

Convert Qt signal, as N-ary function, to an observable. This can be used to convert private signals.

auto o = from_signal(q, &QFileSystemWatcher::fileChanged); // ERROR. o is observable<tuple<QString, QFileSystemWatcher::QPrivateSignal>> where last type is private member.
auto o = from_signal<1>(q, &QFileSystemWatcher::fileChanged); // OK. o is observable<QString>

from_event

observable<QEvent*> rxqt::from_event(QObject* object, QEvent::Type type);

Convert Qt event to an observable.

run_loop

Provide an interface between the Qt event loop and RxCpp's run loop scheduler. This enables use of timed RxCpp operators (such as delay and debounce) with RxQt.

Using run_loop requires an object of type run_loop to be live while the Qt event loop is active. This can be achieved most simply through use of a local variable defined after the Qt application object has been instantiated in main, or wherever the applicaiton object is instantiated. The example below gives an example of appropriate instantiation of the run_loop, together with a main window class of MainWindow:

int main(int argc, char* argv[])
{
   QApplication a(argc, argv);
   MainWindow w;
   rxqt::run_loop rxqt_run_loop;
   w.show();
   return a.exec();
}

Contribution

Issues or Pull Requests are welcomed :)

Requirement

  • RxCpp (minimum of v4.0 for use of rxqt::run_loop)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].