Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QPrinter

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QPrinter class reference

### Public Functions

- bool aborted ()
- void margins ( uint * top, uint * left, uint * bottom, uint * right ) const
- QSize margins () const
- bool setup ( QWidget * parent = 0 )

## Member Function Documentation

### bool QPrinter::aborted ()

Use printerState() == QPrinter::Aborted instead.

### void QPrinter::margins ( uint * top, uint * left, uint * bottom, uint * right ) const

Sets *top, *left, *bottom, *right to be the top, left, bottom, and right margins.

This function has been superceded by paperRect() and pageRect(). Use pageRect().top() - paperRect().top() for the top margin, pageRect().left() - paperRect().left() for the left margin, pageRect().bottom() - paperRect().bottom() for the bottom margin, and pageRect().right() - paperRect().right() for the right margin.

For example, if you have code like

        uint rightMargin;
        uint bottomMargin;
        printer->margins(0, 0, &bottomMargin, &rightMargin);

you can rewrite it as

        int rightMargin = printer->pageRect().right() - printer->paperRect().right();
        int bottomMargin = printer->pageRect().bottom() - printer->paperRect().bottom();

### QSize QPrinter::margins () const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns a QSize containing the left margin and the top margin.

This function has been superceded by paperRect() and pageRect(). Use pageRect().left() - paperRect().left() for the left margin, and pageRect().top() - paperRect().top() for the top margin.

For example, if you have code like

        QSize margins = printer->margins();
        int leftMargin = margins.width();
        int topMargin = margins.height();

you can rewrite it as

        int leftMargin = printer->pageRect().left() - printer->paperRect().left();
        int topMargin = printer->pageRect().top() - printer->paperRect().top();

### bool QPrinter::setup ( QWidget * parent = 0 )

Use QPrintDialog instead.

For example, if you have code like

        if (printer->setup(parent))
            ...

you can rewrite it as

        QPrintDialog dialog(printer, parent);
        if (dialog.exec())
            ...