PDA

View Full Version : Image as window form



Ockonal
3rd April 2011, 08:28
Hello, I want to make window frame using some picture. Window shouldn't have borders, titlebars, etc. It also should be hidden from active windows list (in taskbar).

Second part of question I did with:


this->setAttribute(Qt::WA_NoSystemBackground);
this->setAttribute(Qt::WA_QuitOnClose);

this->setAutoFillBackground(true);

this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
for new class which inherits QMainWindow. It's hidden, for example, at gnome taskbar, but in Awn (awant windows navigator) I seed it in the list of active windows :(.

What about first part. I did this some time ago with QRegion, QPixmap and mask in overloaded paintEvent. I've lost the code. Can you help me with this?

I tried the code like:

void MainWindow::paintEvent(QPaintEvent * event)
{
QPainter painter(this);

QPixmap pixmap = QPixmap();
pixmap.load("/home/my_image.jpg");

painter.drawPixmap(event->rect(), pixmap);
}
But I see my picture and black rectangle under it.

tbscope
3rd April 2011, 08:47
Try this:
http://www.qtcentre.org/wiki/index.php?title=ARGB-Widgets

But why do you want to throw out all of the desktop usability?

Ockonal
3rd April 2011, 09:02
Try this:
http://www.qtcentre.org/wiki/index.php?title=ARGB-Widgets
But why do you want to throw out all of the desktop usability?

I want to do that under Linux.
I'm making some desktop widget, thats why I want to remove all that desktop usability.

tbscope
3rd April 2011, 09:07
I want to do that under Linux.
I'm making some desktop widget, thats why I want to remove all that desktop usability.

There are standard API's to do that. Example: google gadgets, KDE Plasma widgets

Ockonal
3rd April 2011, 09:16
There are standard API's to do that. Example: google gadgets, KDE Plasma widgets
I know, but I want to do this directly with Qt. Just don't ask why do I want this.

tbscope
3rd April 2011, 09:16
I know, but I want to do this directly with Qt. Just don't ask why do I want this.

Why do you want to do this?