synczoomwidget.hpp 1.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef CVVISUAL_SYNC_ZOOM_WIDGET
#define CVVISUAL_SYNC_ZOOM_WIDGET

#include <QWidget>
#include <QButtonGroup>

#include "zoomableimage.hpp"

namespace cvv
{
namespace qtutil
{

/**
 * @brief this class can set a Master for a given list of ZoomabelImmages.
 * when the master is zoomed all other images in the list
 * will show the same area this the same zoomlevel
 */
class SyncZoomWidget : public QWidget
{

	Q_OBJECT

      public:
	/**
	 * @brief the constructor
	 * @param images a list of zoomabel images
	 * @param parent the parent Widget
	 */
	SyncZoomWidget(std::vector<ZoomableImage *> images,
		       QWidget *parent = nullptr);

	/**
	 *@brief the destructor
	 */
	~SyncZoomWidget()
	{
		buttonGroup_->deleteLater();
	}
      public
slots:
	/**
	 * @brief this method set the master of the master id=images.size none master will be set
	 * @param id the id of the master image
	 */
	void selectMaster(int id);
signals:

	/**
	 * @brief a signal for the zoom syncronisation
	 */
	void updateArea(QRectF, qreal) const;

      private:
	void disconnectMaster();

	std::vector<ZoomableImage *> images_;
	size_t currentIdx_;
	QButtonGroup *buttonGroup_;
};
}
}

#endif