#include <rpp/rpp.hpp>
#include <rppqt/rppqt.hpp>
#include <QApplication>
#include <QTextEdit>
#include <iostream>
int main(int argc, char* argv[])
{
QApplication app{argc, argv};
QTextEdit* text_edit = new QTextEdit();
return text_edit->toPlainText();
})
|
rpp::ops::subscribe([](
const QString& text) { std::cout <<
"text changed: " << text.toStdString() << std::endl; },
[]() { std::cout << "text_edit destroyed!" << std::endl; });
text_edit->setText("123");
text_edit->setText("temp");
delete text_edit;
return 0;
}
auto from_signal(const TObject &object, R(TSignalQObject::*signal)(Args...))
Creates rpp::observable that emits a items from provided QT signal.
Definition from_signal.hpp:76
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226