PDA

View Full Version : QGraphicsTextItem is blurring at certain regions



wagmare
21st July 2009, 16:02
hi friends,
i am encountering this problem second time ..

on the QGraphicsRectItem

QFont font;
textItem = new QGraphicsTextItem(this);
if(currentType == X86_TYPE){
font.setPixelSize(16);
textItem->setPos(15,12);
}else{
font.setPixelSize(13);
textItem->setPos(6,4);
}
textItem->setFont(font);
textItem->setDefaultTextColor(QColor(111, 120, 122));
textItem->setPlainText(QString("Pin %1").arg(currentIndex));
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()

Lykurg
21st July 2009, 16:09
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.

wagmare
22nd July 2009, 06:28
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 ... ?

Lykurg
22nd July 2009, 07:41
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.

wagmare
22nd July 2009, 07:49
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 ..

Lykurg
22nd July 2009, 07:59
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?

wagmare
22nd July 2009, 08:14
see my pages

Lykurg
22nd July 2009, 08:27
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.

nish
22nd July 2009, 08:43
btw... what is your application?? looks like an old monochorme display apps we use to have in MS-DOS days..

wagmare
22nd July 2009, 11:24
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 ..

wagmare
22nd July 2009, 11:28
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 ..

Lykurg
22nd July 2009, 11:57
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

wagmare
22nd July 2009, 12:03
yes i will and thanks for whole suggestion and now i will change it ...