1 #ifndef CVVISUAL_SYNC_ZOOM_WIDGET
2 #define CVVISUAL_SYNC_ZOOM_WIDGET
3 
4 #include <QWidget>
5 #include <QButtonGroup>
6 
7 #include "zoomableimage.hpp"
8 
9 namespace cvv
10 {
11 namespace qtutil
12 {
13 
14 /**
15  * @brief this class can set a Master for a given list of ZoomabelImmages.
16  * when the master is zoomed all other images in the list
17  * will show the same area this the same zoomlevel
18  */
19 class SyncZoomWidget : public QWidget
20 {
21 
22 	Q_OBJECT
23 
24       public:
25 	/**
26 	 * @brief the constructor
27 	 * @param images a list of zoomabel images
28 	 * @param parent the parent Widget
29 	 */
30 	SyncZoomWidget(std::vector<ZoomableImage *> images,
31 		       QWidget *parent = nullptr);
32 
33 	/**
34 	 *@brief the destructor
35 	 */
~SyncZoomWidget()36 	~SyncZoomWidget()
37 	{
38 		buttonGroup_->deleteLater();
39 	}
40       public
41 slots:
42 	/**
43 	 * @brief this method set the master of the master id=images.size none master will be set
44 	 * @param id the id of the master image
45 	 */
46 	void selectMaster(int id);
47 signals:
48 
49 	/**
50 	 * @brief a signal for the zoom syncronisation
51 	 */
52 	void updateArea(QRectF, qreal) const;
53 
54       private:
55 	void disconnectMaster();
56 
57 	std::vector<ZoomableImage *> images_;
58 	size_t currentIdx_;
59 	QButtonGroup *buttonGroup_;
60 };
61 }
62 }
63 
64 #endif
65