piqt importand fix with qmap serialization

ImageView now supprt view interaction
BlockView update background when EnabledChange
This commit is contained in:
2021-08-05 00:41:52 +03:00
parent a9203554c5
commit 1ab677774b
4 changed files with 46 additions and 22 deletions

View File

@@ -29,6 +29,7 @@ class QAD_WIDGETS_EXPORT ImageView: public QGraphicsView
{
Q_OBJECT
Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
Q_PROPERTY(bool viewInteractive READ viewInteractive WRITE setViewInteractive)
public:
ImageView(QWidget * parent = 0);
~ImageView();
@@ -37,27 +38,28 @@ public:
void setImage(const QByteArray & i);
QByteArray image() const {return im_data;}
QPixmap pixmap() const;
bool viewInteractive() const {return interactive_;}
void clear();
private:
void mouseDoubleClickEvent(QMouseEvent * e);
void mousePressEvent(QMouseEvent * e);
void mouseMoveEvent(QMouseEvent * e);
// void wheelEvent(QWheelEvent * e);
void wheelEvent(QWheelEvent * e);
bool eventFilter(QObject * o, QEvent * e);
void adjustView();
QGraphicsPixmapItem item;
QByteArray im_data;
QPoint prev_pos;
bool autofit_;
bool autofit_, interactive_;
QPixmap map;
public slots:
void autofit();
void setPixmap(QPixmap pixmap);
void setViewInteractive(bool yes);
signals:
void clicked(QPointF, Qt::MouseButtons);