Results 1 to 13 of 13

Thread: QGraphicsTextItem is blurring at certain regions

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

    Default QGraphicsTextItem is blurring at certain regions

    hi friends,
    i am encountering this problem second time ..

    on the QGraphicsRectItem
    Qt Code:
    1. QFont font;
    2. textItem = new QGraphicsTextItem(this);
    3. if(currentType == X86_TYPE){
    4. font.setPixelSize(16);
    5. textItem->setPos(15,12);
    6. }else{
    7. font.setPixelSize(13);
    8. textItem->setPos(6,4);
    9. }
    10. textItem->setFont(font);
    11. textItem->setDefaultTextColor(QColor(111, 120, 122));
    12. textItem->setPlainText(QString("Pin %1").arg(currentIndex));
    To copy to clipboard, switch view to plain text mode 
    i am positioning the QGraphicsTextItem on it ..

    some times the text is blurred in certain region ... previous time its at the top region of QGraphicsView() and now in bottom
    see my screenshot i attach with this thread
    please help me to solve this problem ..

    P.S.
    my QGraphicsView is a embedded widget of another QGraphicsView()
    Attached Images Attached Images
    "Behind every great fortune lies a crime" - Balzac

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsTextItem is blurring at certain regions

    seems you draw the border of the items yourself without painter clipping, and the text is drawn by Qt (with painter clipping). Just a guess.

  3. The following user says thank you to Lykurg for this useful post:

    wagmare (22nd July 2009)

  4. #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: QGraphicsTextItem is blurring at certain regions

    thanks for reply ji..
    i think u are right ... because if i use own QPen and drawText the QPainter its working perfectly ... why we actually need clipping in my case ... ?
    "Behind every great fortune lies a crime" - Balzac

  5. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsTextItem is blurring at certain regions

    Quote Originally Posted by wagmare View Post
    why we actually need clipping in my case ... ?
    The better question is, why you need a QGraphicsView inside a QGraphicsView!

    An why you need clipping? Well, it's because items should respect their bounding borders that you can position items correctly and that they don't overlap each other.

  6. #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: QGraphicsTextItem is blurring at certain regions

    The better question is, why you need a QGraphicsView inside a QGraphicsView!
    because in a QGraphicsView say baseView
    i embed a QStackedWidget with lots of pages ... individual pages i am having a graphicsView added to it ..
    "Behind every great fortune lies a crime" - Balzac

  7. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsTextItem is blurring at certain regions

    Quote Originally Posted by wagmare View Post
    because in a QGraphicsView say baseView
    i embed a QStackedWidget with lots of pages ... individual pages i am having a graphicsView added to it ..
    Wow, that's awful I am sure whatever your GUI looks like, there is a better solution of embedding a view inside a view. What you are making is pure overkill. How does your Gui look like? can you post a image where you highlight the s tacked widget?

  8. #7
    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: QGraphicsTextItem is blurring at certain regions

    see my pages
    Attached Images Attached Images
    "Behind every great fortune lies a crime" - Balzac

  9. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsTextItem is blurring at certain regions

    Ok, seems to me like a normal button based application with a fixed stacked widget in the middle. So first why do you need graphics view anyway? aren't custom button widgets enough? That would make the whole thing very easy.

    Second, inside your staked widget there seems to be only other items, so create a item for each page, put child items in the "page item", and then just show the current page item and hide the others. Since child items are automatically hidden when the parent is, it is not a big deal.

  10. #9
    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: QGraphicsTextItem is blurring at certain regions

    btw... what is your application?? looks like an old monochorme display apps we use to have in MS-DOS days..

  11. #10
    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: QGraphicsTextItem is blurring at certain regions

    Quote Originally Posted by Lykurg View Post
    O

    Second, inside your staked widget there seems to be only other items, so create a item for each page, put child items in the "page item", and then just show the current page item and hide the others. Since child items are automatically hidden when the parent is, it is not a big deal.
    actually i am developing the init level of a embedding project ... it will be migrated to a board where lots of device drivers and communication handlers integrated to it ... and another thing is the board is having a TID screen ..

    here i am showing only two of my twenty pages ...
    i will animate some items in few pages and more it should be stretched from 800x600 to 1400x1200 screen between two displays ..

    its better for me to use QGraphics for resize event ..
    "Behind every great fortune lies a crime" - Balzac

  12. #11
    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: QGraphicsTextItem is blurring at certain regions

    and lykurg i can use your suggestion of hide and show the item pages.

    but the index of stackedWidget were probed to communication past one month ..
    currently i cant change that one ..

    i am only one month experience in GUI designing when i start the development of app ...
    i know my code is novice way but next time i will be better ..
    "Behind every great fortune lies a crime" - Balzac

  13. #12
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsTextItem is blurring at certain regions

    Quote Originally Posted by wagmare View Post
    but the index of stackedWidget were probed to communication past one month ..
    currently i cant change that one ..
    Ok, that's tough luck, but could you at least change the buttons around the stacked widget? because then you would have a QWidget with inside layouted buttons and a stacked widget, without a graphics view inside a view. That would be also good for the speed performance...

    EDIT: see attached mockup
    Attached Files Attached Files
    Last edited by Lykurg; 22nd July 2009 at 12:02.

  14. The following user says thank you to Lykurg for this useful post:

    wagmare (22nd July 2009)

  15. #13
    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: QGraphicsTextItem is blurring at certain regions

    yes i will and thanks for whole suggestion and now i will change it ...
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. cursor in qgraphicstextitem
    By Noxxik in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2009, 12:04
  2. Problem on set QGraphicsTextItem write protect.
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2007, 20:53
  3. QGraphicsTextItem: handling cursor position change
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2007, 10:42
  4. QGraphicsTextItem size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 08:34

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.