Qt 4.8
Classes | Functions
qpagesetupdialog_unix.cpp File Reference
#include "qpagesetupdialog.h"
#include "qpagesetupdialog_unix_p.h"
#include "qpainter.h"
#include "qprintdialog.h"
#include "qdialogbuttonbox.h"
#include <ui_qpagesetupwidget.h>
#include <QtGui/qprinter.h>
#include <private/qabstractpagesetupdialog_p.h>
#include <private/qprinter_p.h>
#include <private/qcups_p.h>
#include <cups/cups.h>
#include <private/qpdf_p.h>
#include "moc_qpagesetupdialog.cpp"

Go to the source code of this file.

Classes

class  QPagePreview
 
class  QPageSetupDialogPrivate
 

Functions

static void populatePaperSizes (QComboBox *cb)
 
double qt_multiplierForUnit (QPrinter::Unit unit, int resolution)
 return the multiplier of converting from the unit value to postscript-points. More...
 
QSizeF qt_printerPaperSize (QPrinter::Orientation, QPrinter::PaperSize, QPrinter::Unit, int)
 
static QSizeF sizeForOrientation (QPrinter::Orientation orientation, const QSizeF &size)
 

Function Documentation

◆ populatePaperSizes()

static void populatePaperSizes ( QComboBox cb)
static

Definition at line 70 of file qpagesetupdialog_unix.cpp.

Referenced by QPageSetupWidget::QPageSetupWidget(), QPageSetupWidget::selectPdfPsPrinter(), and QPageSetupWidget::selectPrinter().

71 {
95  cb->addItem(QPrintDialog::tr("Executive"), QPrinter::Executive);
100  cb->addItem(QPrintDialog::tr("Tabloid"), QPrinter::Tabloid);
101  cb->addItem(QPrintDialog::tr("US Common #10 Envelope"), QPrinter::Comm10E);
102  cb->addItem(QPrintDialog::tr("Custom"), QPrinter::Custom);
103 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void addItem(const QString &text, const QVariant &userData=QVariant())
Adds an item to the combobox with the given text, and containing the specified userData (stored in th...
Definition: qcombobox.h:323

◆ qt_multiplierForUnit()

double qt_multiplierForUnit ( QPrinter::Unit  unit,
int  resolution 
)

return the multiplier of converting from the unit value to postscript-points.

Definition at line 123 of file qprinter.cpp.

Referenced by QPageSetupWidget::_q_pageOrientationChanged(), QPrinter::getPageMargins(), QPrinter::pageRect(), QPrinter::paperRect(), QPrinter::paperSize(), qt_printerPaperSize(), QPrinter::setPageMargins(), QPrinter::setPaperSize(), and QPageSetupWidget::unitChanged().

124 {
125  switch(unit) {
127  return 2.83464566929;
128  case QPrinter::Point:
129  return 1.0;
130  case QPrinter::Inch:
131  return 72.0;
132  case QPrinter::Pica:
133  return 12;
134  case QPrinter::Didot:
135  return 1.065826771;
136  case QPrinter::Cicero:
137  return 12.789921252;
139  return 72.0/resolution;
140  }
141  return 1.0;
142 }

◆ qt_printerPaperSize()

QSizeF qt_printerPaperSize ( QPrinter::Orientation  ,
QPrinter::PaperSize  ,
QPrinter::Unit  ,
int   
)

Definition at line 145 of file qprinter.cpp.

Referenced by QPageSetupWidget::_q_paperSizeChanged(), and QPrinter::paperSize().

149 {
150  int width_index = 0;
151  int height_index = 1;
152  if (orientation == QPrinter::Landscape) {
153  width_index = 1;
154  height_index = 0;
155  }
156  const qreal multiplier = qt_multiplierForUnit(unit, resolution);
157  return QSizeF((qt_paperSizes[paperSize][width_index] * 72 / 25.4) / multiplier,
158  (qt_paperSizes[paperSize][height_index] * 72 / 25.4) / multiplier);
159 }
PaperSize paperSize(QPrinter::PaperSize paperSize)
Definition: qpdf.cpp:905
double qreal
Definition: qglobal.h:1193
double qt_multiplierForUnit(QPrinter::Unit unit, int resolution)
return the multiplier of converting from the unit value to postscript-points.
Definition: qprinter.cpp:123
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
static const float qt_paperSizes[][2]
Definition: qprinter.cpp:89

◆ sizeForOrientation()

static QSizeF sizeForOrientation ( QPrinter::Orientation  orientation,
const QSizeF size 
)
static

Definition at line 106 of file qpagesetupdialog_unix.cpp.

Referenced by QPageSetupWidget::setupPrinter().

107 {
108  return (orientation == QPrinter::Portrait) ? size : QSizeF(size.height(), size.width());
109 }
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202