Qt World Summit: Submit your Presentation

add a textedit widget to a graphics view scene

  • Hello,
    I am a newbie to qt. I was trying to add a text edit widget to a scene such that it occupies the entire viewport of the graphicsview(just want to give user some space to add some text). I am stuck here and also a bit confused in coordinate conversions. below is a sample code. Thanks for any help in advance.

        QGraphicsScene *scene=new QGraphicsScene();
        ui->graphicsView->setAlignment(Qt::AlignTop | Qt::AlignLeft);
        QTextEdit *notes=new QTextEdit(this);
        notes->setStyleSheet("QTextEdit{ border: 2px solid black;}");
    //    notes->setGeometry(0,20,800,500);
        QGraphicsProxyWidget *proxy = scene->addWidget(notes);