Skip to content
  • 0 Votes
    2 Posts
    2k Views
    SGaistS

    Hi,

    You shouldn't use the size of a widget in its own constructor. The widget being not yet visible, the value won't make sense.

  • 0 Votes
    8 Posts
    7k Views
    mrjjM

    @M4RZB4Ni
    yes, that is normal.
    Printer have many more pixels. so image seem smaller.
    Read docs.
    they have example of scaling stuff.
    This sample takes snapshot and scales it.

    void MainWindow::printshot() { QPixmap pix = QPixmap::grabWindow(QApplication::desktop()->winId()); QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Landscape); QPainter painter; painter.begin(&printer); double xscale = printer.pageRect().width() / double(pix.width()); double yscale = printer.pageRect().height() / double(pix.height()); double scale = qMin(xscale, yscale); painter.translate(printer.paperRect().x() + printer.pageRect().width() / 2, printer.paperRect().y() + printer.pageRect().height() / 2); painter.scale(scale, scale); painter.translate(-width() / 2, -height() / 2); // note uses the form width/height! use pix.h/w if random image painter.drawPixmap(0, 0, pix); painter.end(); }
  • 0 Votes
    2 Posts
    904 Views
    mrjjM

    @silverhawk

    Hi and welcome
    A picture would help to know what "boxes in the images" means :)
    you can just upload to postimage.org

  • 0 Votes
    4 Posts
    2k Views
    Arty.McLabinA

    @Chris-Kawa, you got me wrong i guess, the problem is not stylesheet inheritance, it's about the target widget itself NOT getting the stylesheet, instead that only passing style to children, naming him doesn't affect the result too.