kwave
18.07.70
|
#include <ImageView.h>
Public Slots | |
void | setImage (QImage image) |
void | setHorizOffset (int offset) |
void | setVertOffset (int offset) |
Signals | |
void | viewInfo (int, int, int) |
void | sigCursorPos (const QPoint pos) |
Public Member Functions | |
ImageView (QWidget *parent=Q_NULLPTR, bool fit_width=true, bool fit_height=true) | |
virtual | ~ImageView () Q_DECL_OVERRIDE |
QRect | imageRect () |
Protected Member Functions | |
virtual void | mouseMoveEvent (QMouseEvent *e) Q_DECL_OVERRIDE |
virtual void | mousePressEvent (QMouseEvent *e) Q_DECL_OVERRIDE |
virtual void | paintEvent (QPaintEvent *) Q_DECL_OVERRIDE |
Private Attributes | |
QPoint | m_offset |
QRect | m_last_rect |
QImage | m_image |
bool | m_fit_width |
bool | m_fit_height |
double | m_scale_x |
double | m_scale_y |
Simple widget class for displaying a QImage.
Definition at line 33 of file ImageView.h.
|
explicit |
Constructor.
parent | pointer to the parent widget, can be 0 |
fit_width | if set to true, the image will be scaled to fit horizontally into the widget; if false the image will be cut off at the edge and should be scrolled |
fit_height | if set to true, the image will be scaled to fit vertically into the widget; if false the image will be cut off at the edge and should be scrolled |
Definition at line 28 of file ImageView.cpp.
|
virtual |
QRect Kwave::ImageView::imageRect | ( | ) |
Returns the position and size of the current image, packed into a QRect object.
Definition at line 82 of file ImageView.cpp.
References m_image, and m_offset.
Referenced by paintEvent().
|
protectedvirtual |
Reimplemented in Kwave::OverViewWidget.
Definition at line 43 of file ImageView.cpp.
References m_image, m_offset, m_scale_x, m_scale_y, sigCursorPos(), and Kwave::toInt().
Referenced by mousePressEvent().
|
protectedvirtual |
Reimplemented in Kwave::OverViewWidget.
Definition at line 69 of file ImageView.cpp.
References mouseMoveEvent().
|
protectedvirtual |
Definition at line 107 of file ImageView.cpp.
References imageRect(), m_fit_height, m_fit_width, m_image, m_last_rect, m_offset, m_scale_x, m_scale_y, and Kwave::toInt().
|
slot |
sets a new horizontal offset, useful for scrolling
Definition at line 89 of file ImageView.cpp.
References m_offset.
|
slot |
Sets a new QImage for displaying.
image | a pointer to the image |
Definition at line 75 of file ImageView.cpp.
References m_image.
Referenced by Kwave::OverViewWidget::OverViewWidget(), Kwave::SonagramWindow::refresh_view(), and Kwave::SonagramWindow::setOverView().
|
slot |
sets a new vertical offset, useful for scrolling
Definition at line 98 of file ImageView.cpp.
References m_offset.
|
signal |
|
signal |
|
private |
if true, scale to fit vertically
Definition at line 111 of file ImageView.h.
Referenced by paintEvent().
|
private |
if true, scale to fit horizontally
Definition at line 108 of file ImageView.h.
Referenced by paintEvent().
|
private |
pointer to the QImage to be displayed
Definition at line 105 of file ImageView.h.
Referenced by imageRect(), mouseMoveEvent(), paintEvent(), and setImage().
|
private |
last displayed image rectangle. Note that the left and top coordinates are unscaled, but the width and height might be scaled to screen coordinates!
Definition at line 102 of file ImageView.h.
Referenced by paintEvent().
|
private |
offset of the image, in original unscaled coordinates of the internal QImage
Definition at line 95 of file ImageView.h.
Referenced by imageRect(), mouseMoveEvent(), paintEvent(), setHorizOffset(), and setVertOffset().
|
private |
scale factor in horizontal direction, will be (width of the image / width of the widget) if m_fit_width is true, or 1.0 else
Definition at line 118 of file ImageView.h.
Referenced by mouseMoveEvent(), and paintEvent().
|
private |
scale factor in vertical direction, will be (height of the image / height of the widget) if m_fit_height is true, or 1.0 else
Definition at line 125 of file ImageView.h.
Referenced by mouseMoveEvent(), and paintEvent().