Results 1 to 5 of 5

Thread: Setting a QAbstractGraphicsShapeItem's pen fields

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android
    Thanks
    7
    Thanked 20 Times in 20 Posts

    Default Re: Setting a QAbstractGraphicsShapeItem's pen fields

    http://www.qtcentre.org/threads/2626...pen().setColor

    The QPen object returned is const.

  2. #2
    Join Date
    Aug 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Setting a QAbstractGraphicsShapeItem's pen fields

    Ah OK. Somehow I missed that.
    So does that mean that basically the only way to set, say, the pen's colour to red is with the following statement?

    Qt Code:
    1. myRect->setPen(QPen(Qt::red));
    To copy to clipboard, switch view to plain text mode 
    Last edited by dohzer; 14th August 2010 at 15:19. Reason: Accidentally wrote "Brush" instead of "Pen"

  3. #3
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android
    Thanks
    7
    Thanked 20 Times in 20 Posts

    Default Re: Setting a QAbstractGraphicsShapeItem's pen fields

    Quote Originally Posted by dohzer View Post
    Ah OK. Somehow I missed that.
    Indeed. I would say that *that* is the bigger problem, i.e., Qt apparently (?) didn't tell you that you were attempting to change a const variable.

  4. #4
    Join Date
    Aug 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Setting a QAbstractGraphicsShapeItem's pen fields

    Quote Originally Posted by Urthas View Post
    Qt apparently (?) didn't tell you that you were attempting to change a const variable.
    Well there's no warning during compilation, or error while running, but the pen colour doesn't change, so I'm not sure exactly what's going on.

Similar Threads

  1. automatically complete fields on the form
    By TomASS in forum General Programming
    Replies: 1
    Last Post: 13th July 2010, 20:14
  2. Trouble with QAbstractGraphicsShapeItem
    By lni in forum Qt Programming
    Replies: 0
    Last Post: 21st February 2010, 04:36
  3. QWizard - mandatory fields
    By slava in forum Qt Programming
    Replies: 12
    Last Post: 12th February 2008, 14:52
  4. QTableView showing empty fields
    By ederbs in forum Qt Programming
    Replies: 5
    Last Post: 4th October 2007, 01:30
  5. tr() and static fields
    By drkbkr in forum Qt Programming
    Replies: 6
    Last Post: 5th June 2007, 17:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.