#include <QicsPrintPreviewPage.h>
Inherits QFrame.
Signals | |
| void | drawPage (QicsPrintPreviewPage *page) |
Public Member Functions | |
| QicsPrintPreviewPage (int num, QicsPrintPreviewWidget *widget, QWidget *parent) | |
| virtual | ~QicsPrintPreviewPage () |
| int | number () const |
| const QRect & | pageRect () const |
| const QRect & | realPageRect () const |
| const QRect & | realPaperRect () const |
| bool | isActive () const |
| void | setSelected (bool yes=true) |
| bool | isSelected () const |
| void | setEnabled (bool yes=true) |
| bool | isEnabled () const |
| double | widthMM () const |
| double | heightMM () const |
| void | reinit () |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *event) |
| virtual void | resizeEvent (QResizeEvent *event) |
Protected Attributes | |
| QRect | m_pageRect |
| QRect | m_realPageRect |
| QRect | m_realPaperRect |
| int | m_num |
| bool | m_selected |
| bool | m_enabled |
| QicsPrintPreviewWidget * | m_widget |
| double | mmWidth |
| double | mmHeight |
QicsPrintPreviewPage represents single page of the document being previewed/printed. Every page is responcible to paint its common parts (such as frame, logical number, and so on) and its content by emitting drawPage() signal which is handled by QicsPrintPreviewWidget and passed to the own preview program.
A page has its logical number which is 0-based and always in the range of 0...QicsPrintPreviewWidget::pagesCount()-1. However, method number() will return 1-based number as it is more convenient for the user.
Also, a page keeps its metrics, returned by pageRect(), realPageRect() and realPaperRect() methods in pixels, and also widthMM() and heightMM() in metrical units.
Page can have active (returned by isActive()), selected (isSelected()) and enabled (isEnabled()) state set to true or false. These states are used mostly during printing, see QicsPrintPreviewWidget description for the reference.
Typically, there is no need to explicitly create QicsPrintPreviewPage objects as they are always created by the framework.
| QicsPrintPreviewPage::QicsPrintPreviewPage | ( | int | num, | |
| QicsPrintPreviewWidget * | widget, | |||
| QWidget * | parent | |||
| ) |
Constructor.
| num | 0-based logical number of the page. | |
| widget | Parent QicsPrintPreviewWidget. | |
| parent | Parent QWidget (it is the real parent widget of the page). |
| virtual QicsPrintPreviewPage::~QicsPrintPreviewPage | ( | ) | [virtual] |
Destructor.
| int QicsPrintPreviewPage::number | ( | ) | const [inline] |
Returns 1-based logical number of the page in the range of 1...QicsPrintPreviewWidget::pagesCount().
| const QRect& QicsPrintPreviewPage::pageRect | ( | ) | const [inline] |
Returns visual dimensions of the page (in pixels) according to current scale (i.e. as it is currently visible on the screen).
| const QRect& QicsPrintPreviewPage::realPageRect | ( | ) | const [inline] |
Returns actual dimensions of the page (in pixels) as it is will be sent to printer. See QPrinter::pageRect().
| const QRect& QicsPrintPreviewPage::realPaperRect | ( | ) | const [inline] |
Returns actual dimensions of the paper (in pixels). See QPrinter::paperRect().
| bool QicsPrintPreviewPage::isActive | ( | ) | const |
Returns true if the page is active, false if not. See QicsPrintPreviewWidget::activePage().
| void QicsPrintPreviewPage::setSelected | ( | bool | yes = true |
) |
Sets page selected state to yes. See QicsPrintPreviewWidget::selectAll().
| bool QicsPrintPreviewPage::isSelected | ( | ) | const [inline] |
Returns true if the page is selected, false if not.
| void QicsPrintPreviewPage::setEnabled | ( | bool | yes = true |
) |
Sets page enabled state to yes. See QicsPrintPreviewWidget::enableAll().
| bool QicsPrintPreviewPage::isEnabled | ( | ) | const [inline] |
Returns true if the page is enabled, false if not.
| double QicsPrintPreviewPage::widthMM | ( | ) | const [inline] |
Returns width of the page in millimeters.
| double QicsPrintPreviewPage::heightMM | ( | ) | const [inline] |
Returns height of the page in millimeters.
| void QicsPrintPreviewPage::reinit | ( | ) |
Reinitialized page dimensions from the QicsPrintPreviewWidget's current printer. Called internally when printer/paper parameters were changed.
| void QicsPrintPreviewPage::drawPage | ( | QicsPrintPreviewPage * | page | ) | [signal] |
Emitted when page needs to be drawn. Handled in QicsPrintPreviewWidget.