Results 1 to 10 of 10

Thread: lineedit in qpainter

  1. #1
    Join Date
    Jul 2009
    Posts
    55
    Thanks
    3

    Default lineedit in qpainter

    hi, how can i create a lineedit in the below void?

    Qt Code:
    1. void QGraphicsItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: lineedit in qpainter

    creation widget in paint method it's worth, since that method is called many times (memory leaks can occur) and that will influence on an application performance. it's better to create widgets in ctors.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lineedit in qpainter

    Quote Originally Posted by spirit View Post
    creation widget in paint method it's worth, since that method is called many times (memory leaks can occur) and that will influence on an application performance. it's better to create widgets in ctors.
    but why we cant paint our own paint item to get any input from the user ...?
    every time we have to derive any input widget like QLineEdit or textEdit()
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: lineedit in qpainter

    for taking input you can use QGraphicsProxyWidget.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lineedit in qpainter

    ya thanks ... but there also we use only our input widgets ... my point is did Qt gives us any option for making our item get input interface ... other than using QLineEdit() or like that
    "Behind every great fortune lies a crime" - Balzac

  6. #6
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: lineedit in qpainter

    Quote Originally Posted by wagmare View Post
    did Qt gives us any option for making our item get input interface ... other than using QLineEdit() or like that
    you are confusing yourself. Qt only gives one widget that is QWidget. All the other widgets are made by inheriting QWidget and reimplementing the paint, mouse, keyboard events. you can very well design your own custom widget which could accept input.

  7. #7
    Join Date
    Jul 2009
    Posts
    55
    Thanks
    3

    Default Re: lineedit in qpainter

    i place the QGraphicsProxyWidget in the paint()?

    or create a void for QGraphicsProxyWidget?

  8. #8
    Join Date
    Jul 2009
    Posts
    55
    Thanks
    3

    Default Re: lineedit in qpainter

    am i right? if not can someone enlighten me? thanks

  9. #9
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lineedit in qpainter

    Can you explain what it is that you want to accomplish exactly?

  10. #10
    Join Date
    Jul 2009
    Posts
    55
    Thanks
    3

    Default Re: lineedit in qpainter

    Quote Originally Posted by profoX View Post
    Can you explain what it is that you want to accomplish exactly?
    i had attached an image of it, i wanna place the lineedit in the rect of the node. the node is drawn using qpainter.
    Attached Images Attached Images

Similar Threads

  1. How to update lineEdit
    By HelloDan in forum Qt Programming
    Replies: 9
    Last Post: 17th February 2009, 07:01
  2. Copy / Paste doesn't work with LineEdit
    By ia32 in forum Qt Tools
    Replies: 2
    Last Post: 5th May 2008, 21:44
  3. QPainter update()
    By csvivek in forum Qt Programming
    Replies: 5
    Last Post: 24th March 2008, 09:42
  4. QPainter and QImage
    By beerkg in forum Newbie
    Replies: 3
    Last Post: 7th September 2006, 14:48
  5. Replies: 7
    Last Post: 20th March 2006, 20:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.