QPrinter printer;
printer.setPrinterName("Brother QL-500");
printer.setFullPage(true);
QRect pageRect = printer.pageRect();
QSizeF paperSize = pageRect.size();
// printer.setPaperSize(paperSize, QPrinter::Millimeter);
// qDebug() << printer.paperSize(QPrinter::Inch); <<<<<<<<<<<<<<<<<<<<<<<<< отрицательные значение вообще
// qDebug() << printer.paperSize(QPrinter::Point); <<<<<<<<<<<<<<<<<<<<<<<< отрицательные значение вообще
qreal left, top, right, bottom;
printer.getPageMargins(&left, &top, &right, &bottom, QPrinter::DevicePixel);
qDebug() << left << top << right << bottom << "\n";
qDebug() << "Millimeter" << printer.paperSize(QPrinter::Millimeter);
qDebug() << "Point" << printer.paperSize(QPrinter::Point);
qDebug() << "Inch" << printer.paperSize(QPrinter::Inch);
qDebug() << "Pica" << printer.paperSize(QPrinter::Pica);
qDebug() << "Didot" << printer.paperSize(QPrinter::Didot);
qDebug() << "Cicero" << printer.paperSize(QPrinter::Cicero);
qDebug() << "DevicePixel" << printer.paperSize(QPrinter::DevicePixel);
printer.setPaperSize(QSizeF(2.4375, 3.5416), QPrinter::Inch);
qDebug() << "Millimeter" << printer.paperSize(QPrinter::Millimeter);
qDebug() << "Point" << printer.paperSize(QPrinter::Point);
qDebug() << "Inch" << printer.paperSize(QPrinter::Inch);
qDebug() << "Pica" << printer.paperSize(QPrinter::Pica);
qDebug() << "Didot" << printer.paperSize(QPrinter::Didot);
qDebug() << "Cicero" << printer.paperSize(QPrinter::Cicero);
qDebug() << "DevicePixel" << printer.paperSize(QPrinter::DevicePixel);
printer.setPaperSize(QSizeF(234,340), QPrinter::DevicePixel);
qDebug() << "Millimeter" << printer.paperSize(QPrinter::Millimeter);
qDebug() << "Point" << printer.paperSize(QPrinter::Point);
qDebug() << "Inch" << printer.paperSize(QPrinter::Inch);
qDebug() << "Pica" << printer.paperSize(QPrinter::Pica);
qDebug() << "Didot" << printer.paperSize(QPrinter::Didot);
qDebug() << "Cicero" << printer.paperSize(QPrinter::Cicero);
qDebug() << "DevicePixel" << printer.paperSize(QPrinter::DevicePixel);
QPainter painter(&printer);
painter.drawRoundedRect(printer.paperRect().adjusted(left, top, -right, -bottom), 3, 3);
painter.drawText(printer.pageRect(), Qt::AlignCenter, QString::fromUtf8("OLOLO\nANOTHER LINE\n%1x%2").
arg(paperSize.width()).arg(paperSize.height()));