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. GraphicsItem's area that can be selected keep size

GraphicsItem's area that can be selected keep size

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 271 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.
  • M Offline
    M Offline
    markwang
    wrote on last edited by
    #1

    Hi,bro
    The area that can be selected keep size ,don't change with boundingRect() 's changed

    when geometry change i do this:

    prepareGeometryChange();    
    rectBound.setTopLeft( topLeft );  
    rectBound.setWidth( newWidth);  
    rectBound.setHeight(newHeight);
    

    I'm not good at English and I don't know if I can express myself clearly.
    Hope to get helps;
    thx

    Pl45m4P 1 Reply Last reply
    0
    • M Offline
      M Offline
      markwang
      wrote on last edited by
      #2
      QRectF  ModuleItem::boundingRect() const
      {
         return rectBound;
      }
      
      void  ModuleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
      {
      //.....
       painter->drawPixmap( rectBound,scaled,  QRectF(0,0,width,height));
      }
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Sorry but it's not really clear. You might want to post images that shows your issue.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • M markwang

          Hi,bro
          The area that can be selected keep size ,don't change with boundingRect() 's changed

          when geometry change i do this:

          prepareGeometryChange();    
          rectBound.setTopLeft( topLeft );  
          rectBound.setWidth( newWidth);  
          rectBound.setHeight(newHeight);
          

          I'm not good at English and I don't know if I can express myself clearly.
          Hope to get helps;
          thx

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @markwang said in GraphicsItem's area that can be selected keep size:

          if I can express myself clearly

          The boundingRect does NOT change, but you want to change
          OR
          it changed, but you want to have it fixed?

          EDIT:

          The area that can be selected keep size ,don't change with boundingRect() 's changed

          Your pixmap doesn't change when you change the boundingRect?


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          0

          • Login

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