PDA

View Full Version : Fill Screen with a single colour.



TotalNovice
26th November 2010, 08:44
I've viewed a lot of drawing examples online but I'm still struggling to work out the best way to simply fill screen with one colour in the simplest possible way. (Literally every pixel set one colour, no window bar, no more.)

I'd like to use QPainter because that would give me a starting point to go on to do some drawing. However I'm wondering if using QSplashScreen might be a *very* quick way to simply fill the screen.

Something like this?



int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPixmap pixmap(100, 100);
pixmap.fill(Qt::white);
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->setPixmap( pixmap );
splash->show();
return app.exec();
}



Can someone suggest a better method or even better post some example code.

QbelcorT
26th November 2010, 09:07
Hi,
I used this to get rid of the window bar.


setFrameStyle(QFrame::NoFrame); // QFrame::Panel | QFrame::Raised
setWindowFlags(Qt::FramelessWindowHint);


You may try to use QCoreApplication::setPalette

I used the following for changing my background color. Set a pixmap or use a QColor for the Brush.



QWSServer::setBackground(QBrush(pix)); // set default background color

wysota
26th November 2010, 09:54
Can someone suggest a better method or even better post some example code.


int main(int argc, char **argv){
QApplication app(argc, argv);
QWidget w;
QPalette p = w.palette();
p.setColor(QPalette::Window, Qt::blue);
w.setPalette(p);
w.setAutoFillBackground(true);
w.showFullScreen();
return w.exec();
}