Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. save individual item in QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

save individual item in QGraphicsView

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 218 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Ramkumar MohanR Offline
    Ramkumar MohanR Offline
    Ramkumar Mohan
    wrote on last edited by Ramkumar Mohan
    #1

    I have set in Multiple items in one QGraphicsView ,
    and, how to save to png file from Individual item in QGraphicsView ?

    For Example ,

    Header File : MainWindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <QGraphicsScene>
    #include "code128item.h"
    #include <QtSql/QSqlDatabase>
    #include <QDebug>
    extern int count;

    QT_BEGIN_NAMESPACE
    namespace Ui { class MainWindow; }
    QT_END_NAMESPACE

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    QGraphicsScene m_Scene;
    Code128Item * Item1;
    Code128Item * Item2 ;
    Code128Item * Item3;
    Code128Item * Item4;
    Code128Item * Item5;
    Code128Item * Item6 ;
    Code128Item * Item7;
    Code128Item * Item8;
    

    }

    copy.jpg

    how to save Each item from QGraphicsview

    A 1 Reply Last reply
    0
    • Ramkumar MohanR Ramkumar Mohan

      I have set in Multiple items in one QGraphicsView ,
      and, how to save to png file from Individual item in QGraphicsView ?

      For Example ,

      Header File : MainWindow.h

      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H

      #include <QMainWindow>
      #include <QGraphicsScene>
      #include "code128item.h"
      #include <QtSql/QSqlDatabase>
      #include <QDebug>
      extern int count;

      QT_BEGIN_NAMESPACE
      namespace Ui { class MainWindow; }
      QT_END_NAMESPACE

      class MainWindow : public QMainWindow
      {
      Q_OBJECT

      QGraphicsScene m_Scene;
      Code128Item * Item1;
      Code128Item * Item2 ;
      Code128Item * Item3;
      Code128Item * Item4;
      Code128Item * Item5;
      Code128Item * Item6 ;
      Code128Item * Item7;
      Code128Item * Item8;
      

      }

      copy.jpg

      how to save Each item from QGraphicsview

      A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      @Ramkumar-Mohan
      You can use QGraphicsScene::render to render any rectangular area, e.g. directly into a QPixmap.
      So you just need to determine the rectangle you want (based on the item you want to render), and render that area into a QPixmap

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved