This example requires Qt5 >= 5.9 setup for building.
12#pragma warning(disable : 4127)
14#include <QApplication>
20#include <cvb/ui/property_grid.hpp>
21#include <cvb/device_factory.hpp>
27int main(
int argc,
char* argv[])
32 auto path = Cvb::InstallPath();
33 path += CVB_LIT(
"drivers/GenICam.vin");
38 path =
Cvb::String(inputPath.begin(), inputPath.end());
49 std::cout <<
"Failed to open the device: " << error.what() << std::endl;
62 auto nodemaps = dev->NodeMaps();
68 layout->addWidget(cbNodeMaps);
72 cbVisibility->
addItem(
"Beginner");
73 cbVisibility->addItem(
"Expert");
74 cbVisibility->addItem(
"Guru");
75 layout->addWidget(cbVisibility);
79 grid->SetVisibility(Cvb::Visibility::Beginner);
80 layout->addWidget(grid);
85 layout->addWidget(propertyInfo);
88 grid->SetSearchResultBackgroundColor(
QColor(255, 255, 150));
94 search->setPlaceholderText(
"Search property...");
95 searchLayout->addWidget(search);
96 layout->addLayout(searchLayout);
100 layout->addWidget(updateButton);
103 auto startAutoUpdate =
new QPushButton(
"AutoUpdate START");
104 layout->addWidget(startAutoUpdate);
105 auto stopAutoUpdate =
new QPushButton(
"AutoUpdate STOP");
106 layout->addWidget(stopAutoUpdate);
108 autoUpdateButtonLayout->
addWidget(startAutoUpdate);
109 autoUpdateButtonLayout->addWidget(stopAutoUpdate);
110 layout->addLayout(autoUpdateButtonLayout);
131 case 0: grid->SetVisibility(Cvb::Visibility::Beginner);
break;
132 case 1: grid->SetVisibility(Cvb::Visibility::Expert);
break;
133 case 2: grid->SetVisibility(Cvb::Visibility::Guru);
break;
140 propertyInfo->setText(grid->HtmlFormattedDescription(index));
146 if (search->text().isEmpty())
151 auto found = grid->Search(search->text());
152 grid->ExpandSearchResult(found);
164 grid->StartAutoUpdate(5000);
170 grid->StopAutoUpdate();
173 mainWindow->setLayout(layout);
174 mainWindow->setAttribute(Qt::WA_DeleteOnClose);
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
View to display a device's nodemap.
Definition: property_grid.hpp:157
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition: ui.hpp:238
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition: ui.hpp:253
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:56
void clicked(const QModelIndex &index)
void addItem(const QString &text, const QVariant &userData)
void currentIndexChanged(int index)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setReadOnly(bool ro)