This example requires Qt5 >= 5.9 setup for building.
You may build it with Ubuntu 18.04's default Qt5 after installing:
- qt5-default
- qtdeclarative5-dev
- qml-module-qtquick2
16#include <QApplication>
24#include <cvb/ui/image_view_item.hpp>
28#include <cvb/image.hpp>
30int main(
int argc,
char* argv[])
46 context->setContextProperty(
"mainImage", &imageController);
static std::unique_ptr< Image > Load(const String &fileName)
Loads an image with the given file name.
Definition: detail_image.hpp:32
Controller object for the QML image view item.
Definition: image_view_item.hpp:254
void Refresh(const ImagePtr &image, AutoRefresh autoRefresh=AutoRefresh::Off)
Share the image and refresh the view.
Definition: image_view_item.hpp:296
static void Register()
Convenience method to register this type in QML.
Definition: image_view_item.hpp:670
void setResizeMode(QQuickView::ResizeMode)
QQmlContext * rootContext() const const
void setSource(const QUrl &url)
QUrl fromLocalFile(const QString &localFile)
void resize(const QSize &newSize)
void setIcon(const QIcon &icon)
UI definition using QML.
2import CvbQuick 1.0 as CvbQuick
13 uploadMode : CvbQuick.UploadMode.Viewport
20 + String(imageView.hoverPosition)
22 + String(imageView.hoverPixel)
24 + String(imageView.zoomFactor.toFixed(2))
25 anchors.horizontalCenter: parent.horizontalCenter