Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to increase the resolution of a tableview rendered into a pixmp ?



  • Hey Everyone,
    I am using the following snippet to save a tableview to a png image. how do i increase the resolution of the image ?

    QPixmap pixIndexPage(tableView->size().width(), tableView->size().height());
    QFile file("path/index.png");
    file..open(QIODevice::WriteOnly);
    pixIndexPage.save(&file, "PNG");
    

  • Lifetime Qt Champion

    Hi
    Make the pixmap bigger, then it will have a higher resolution.
    You also have to call resize on the table view to make it use the new size.
    If the table view is in a layout this is not so easy as we cant resize it then.

    Can I ask what the issue is ? you render the GUI to pixmaps and they are blurry when you print them or
    why you need higher res ?


  • Lifetime Qt Champion

    Hi
    Make the pixmap bigger, then it will have a higher resolution.
    You also have to call resize on the table view to make it use the new size.
    If the table view is in a layout this is not so easy as we cant resize it then.

    Can I ask what the issue is ? you render the GUI to pixmaps and they are blurry when you print them or
    why you need higher res ?


  • Lifetime Qt Champion

    Hi,

    AFAIR, the rendering resolution of a widget is tied to its size.

    What kind of high resolution do you have in mind ?



  • Maybe I missed something. Nothing in the code snippet puts anything in the pixmap, it just makes an uninitialized one of the same pixel size as the tableView widget.


  • Lifetime Qt Champion

    @ChrisW67
    Missed nothing :)
    there is no grab() or render() shown.
    but I assumed that poster would not be asking about raising the resolution unless
    there was actually something on the picture, so to speak.



  • Thanks for your help guys. was able to increase the resolution by increasing the size of the pixmap.


Log in to reply