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. add a textedit widget to a graphics view scene

add a textedit widget to a graphics view scene

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt desktoptexteditgraphicsviewqgraphicsscene
1 Posts 1 Posters 438 Views
  • 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.
  • S Offline
    S Offline
    sachinrd
    wrote on 6 Jun 2021, 17:36 last edited by
    #1

    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->setScene(scene);
        ui->graphicsView->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    
        QTextEdit *notes=new QTextEdit(this);
        notes->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        notes->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        notes->setPlaceholderText("Notes");
        notes->setStyleSheet("QTextEdit{ border: 2px solid black;}");
    //    notes->setGeometry(0,20,800,500);
        QGraphicsProxyWidget *proxy = scene->addWidget(notes);
    
    1 Reply Last reply
    0

    1/1

    6 Jun 2021, 17:36

    • Login

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