示例#1
0
void toPieChart::editPrint ( void )
{
    TOPrinter printer;
    printer.setMinMax ( 1, 1 );
    if ( printer.setup() ) {
        printer.setCreator ( "TOra" );
        QPainter painter ( &printer );
        QPaintDeviceMetrics metrics ( &printer );
        QRect rect ( 0, 0, metrics.width(), metrics.height() );
        paintChart ( &painter, rect );
    }
}
示例#2
0
void toPieChart::editPrint(void)
{
    TOPrinter printer;
    QPrintDialog dialog(&printer, this);
    dialog.setMinMax(1, 1);
    if (dialog.exec())
    {
        printer.setCreator(tr(TOAPPNAME));
        QPainter painter(&printer);
        QRect rect(printer.pageRect());
        paintChart(&painter, rect);
    }
}
void toListView::editPrint(void)
{
#if 0
    TOPrinter printer;

    std::map<int, int> PageColumns;
    std::map<int, toTreeWidgetItem *> PageItems;

    int column = 0;
    int tree = rootIsDecorated() ? treeStepSize() : 0;
    int page = 1;
    PageColumns[1] = 0;
    toTreeWidgetItem *item = PageItems[1] = firstChild();

    printer.setCreator(tr(TOAPPNAME));
    QPainter painter(&printer);

    while ((item = printPage(&printer, &painter, item, column, tree, page++, false)))
    {
        PageColumns[page] = column;
        PageItems[page] = item;
    }

    printer.setMinMax(1, page - 1);
    printer.setFromTo(1, page - 1);
    if (printer.setup())
    {
        QList<int> pages;
        for (int i = printer.fromPage(); i <= printer.toPage() || (printer.toPage() == 0 && i < page); i++)
            pages += i;

        for (QList<int>::iterator pageit = pages.begin(); pageit != pages.end(); pageit++)
        {
            page = *pageit;
            item = PageItems[page];
            column = PageColumns[page];

            printPage(&printer, &painter, item, column, tree, page, true);
            printer.newPage();
            painter.resetXForm();
            qApp->processEvents();
            QString str = tr("Printing page %1").arg(page);
            toStatusMessage(str, false, false);
        }
        painter.end();
        toStatusMessage(tr("Done printing"), false, false);
    }
#endif
}