This example requires Qt5 >= 5.9 setup for building.
10#include <QApplication>
15#include <cvb/device.hpp>
16#include <cvb/driver/stream.hpp>
17#include <cvb/driver/stream.hpp>
18#include <cvb/device_factory.hpp>
20#include <cvb/ui/image_view.hpp>
21#include <cvb/async/single_stream_handler.hpp>
36 masterView_->CustomWaitForRepaint([&]()
38 masterView_->viewport()->
repaint();
39 slaveView_->viewport()->
repaint();
47 mainLayout->addWidget(masterView_);
48 mainLayout->addWidget(slaveView_);
56 masterView_->Refresh(device.
DeviceImage()->Plane(0).Map());
57 customAcquisitonHandler_ = CustomStreamHandler::Create(device.
Stream(), *
this);
58 customAcquisitonHandler_->Run();
65 masterView_->SetWaitForRepaintEnabled(
false);
72 class CustomStreamHandler
82 ~CustomStreamHandler()
89 CustomStreamHandler(
const Cvb::StreamPtr& stream, MainWidget& mainWidget)
91 , mainWidget_(mainWidget)
97 void HandleAsyncStream(
const Cvb::StreamPtr & stream)
override
100 if (!waitResult.Image)
103 mainWidget_.masterView_->Refresh(waitResult.Image->Plane(0).Map());
106 MainWidget& mainWidget_;
116int main(
int argc,
char* argv[])
122 auto path = Cvb::InstallPath();
123 path += CVB_LIT(
"drivers/GenICam.vin");
128 path =
Cvb::String(inputPath.begin(), inputPath.end());
132 path = Cvb::ExpandPath(path);
138 MainWidget mainWidget;
139 mainWidget.setWindowIcon(
QIcon(
":/qttutorial.png"));
140 mainWidget.Run(*device);
141 mainWidget.resize(880, 600);
Handler object for a single stream.
Definition: decl_single_stream_handler.hpp:34
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)
Opens a device with the given provider with its default board and port (if applicable).
Definition: decl_device_factory.hpp:55
Generic CVB physical device.
Definition: decl_device.hpp:39
virtual StreamPtr Stream() const
Get the stream for this device.
Definition: detail_device.hpp:24
std::shared_ptr< T > DeviceImage() const
Gets, if available, the device image pointing to the last synchronized image.
Definition: decl_device.hpp:144
View to display an image.
Definition: decl_image_view.hpp:75
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:56