[Qt-interest] [QtS60-feedback] Qt Qbrush issue
Ramesh
ramesh.bs at robosoftin.com
Tue Mar 9 10:22:30 CET 2010
Hi, christen,,
"it gives nothing" means, it will not give any color only..
I found solution for the problem.. too. It is..
QBrush::QBrush ()
Constructs a default black brush with the style Qt::NoBrush (i.e. this brush
will not fill shapes).
I have to set the style of the QBrush object by setStyle(), for example with
Qt::SolidPattern.
Fix for my problem
QGraphicsScene * scence = new QGraphicsScene();
QBrush *brush = new QBrush();
brush->setStyle(Qt:SolidPattern); // Fix your problem !
brush->setColor(QColor(60,20,20));
scence->setBackgroundBrush(*brush);
QGraphicsView *view = new QGraphicsView();
view->setScene(scence);
//view->setBackgroundBrush(*brush);
//view->setCacheMode(QGraphicsView::CacheBackground);
view->showFullScreen();
-----Original Message-----
From: Kristian Amlie [mailto:kristian.amlie at nokia.com]
Sent: Tuesday, March 09, 2010 1:52 PM
To: ext Ramesh
Cc: qt-interest at trolltech.com; QtS60-feedback at trolltech.com
Subject: Re: [QtS60-feedback] Qt Qbrush issue
ext Ramesh wrote:
> What is the difference in the following code,
>
>
>
> QGraphicsScene * scence = *new* *QGraphicsScene*();
>
>
>
> QBrush *brush = *new* *QBrush*((*QColor*(60,20,20)));
>
> scence->*setBackgroundBrush*(*brush);
>
>
>
> QGraphicsView *view = *new* *QGraphicsView*();
>
> view->*setScene*(scence);
>
> //view->setBackgroundBrush(*brush);
>
> //view->setCacheMode(QGraphicsView::CacheBackground);
>
> view->*showFullScreen*();
>
>
>
> gives black color background
>
>
>
>
>
> QGraphicsScene * scence = *new* *QGraphicsScene*();
>
>
>
> QBrush *brush = *new* *QBrush*();
>
> brush->*setColor*(*QColor*(60,20,20));
>
> scence->*setBackgroundBrush*(*brush);
>
>
>
> QGraphicsView *view = *new* *QGraphicsView*();
>
> view->*setScene*(scence);
>
> //view->setBackgroundBrush(*brush);
>
> //view->setCacheMode(QGraphicsView::CacheBackground);
>
> view->*showFullScreen*();
>
>
>
> it gives nothing.
I don't think there should be any difference. With "it gives nothing",
do you mean that you get a transparent background?
--
Kristian
-----------------------------------------------
Robosoft Technologies - Come home to Technology
Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
More information about the Qt-interest-old
mailing list