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. QGraphicsTextItem Single Line

QGraphicsTextItem Single Line

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 157 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.
  • cfdevC Offline
    cfdevC Offline
    cfdev
    wrote on last edited by
    #1

    Hello,
    I try to make a qgraphicstextitem single line with max width
    alt text

    I blocked the return ok no problem, but if I specify the max width width like this :

    m_textItem->setTextWidth(width);
    

    textItem adapt his height automaticaly :(
    alt text

    I try to use textSize.width() >= rect().width() but It's not really clean because some char are differents width.
    Someone has already had this problem ?

    1 Reply Last reply
    0
    • cfdevC Offline
      cfdevC Offline
      cfdev
      wrote on last edited by
      #2

      Finally I use an QLineEdit for editing and use QGraphicsTextItem only to display
      with

      setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
      

      See the result :
      alt text

      1 Reply Last reply
      2

      • Login

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