added zoom of thumbnails on control+wheel

This commit is contained in:
csoler 2020-06-23 20:24:14 +02:00
parent 97ad766863
commit d39b09c5bc
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
8 changed files with 91 additions and 33 deletions

View file

@ -60,17 +60,21 @@ class ChannelPostDelegate: public QAbstractItemDelegate
Q_OBJECT
public:
ChannelPostDelegate(QObject *parent=0) : QAbstractItemDelegate(parent){}
ChannelPostDelegate(QObject *parent=0) : QAbstractItemDelegate(parent), mZoom(1.0){}
virtual ~ChannelPostDelegate(){}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const override;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
int cellSize(const QFont& font) const;
void zoom(bool zoom_or_unzoom) ;
private:
static constexpr float IMAGE_MARGIN_FACTOR = 1.0;
static constexpr float IMAGE_SIZE_FACTOR_W = 4.0 ;
static constexpr float IMAGE_SIZE_FACTOR_H = 6.0 ;
static constexpr float IMAGE_ZOOM_FACTOR = 1.0;
float mZoom; // zoom factor for the whole thumbnail
};
class GxsChannelPostsWidgetWithModel: public GxsMessageFrameWidget
@ -142,6 +146,7 @@ private slots:
void editPost();
void postContextMenu(const QPoint&);
void copyMessageLink();
void updateZoomFactor(bool zoom_or_unzoom);
public slots:
void sortColumnFiles(int col,Qt::SortOrder so);
@ -168,6 +173,7 @@ private:
RsGxsChannelPostsModel *mChannelPostsModel;
RsGxsChannelPostFilesModel *mChannelPostFilesModel;
RsGxsChannelPostFilesModel *mChannelFilesModel;
ChannelPostDelegate *mChannelPostsDelegate;
RsGxsMessageId mSelectedPost;