Hi all.
I have a little problem with my application, so I'm working at program, that can be used to take screenshots of desktop, but only area which I select, next - save image to file/share via mail etc. My current layout exclude use QLabel element and set his pixmap in my viewer, so I must use QWidget object. I read documentation and I understand, that QWidget's background can be change only with CSS using. But I have no idea what I should do that, when I have an image in QPixmap; of course I want do it without saving this screenshot on hard disk.
originalPixmap
= QPixmap::grabWindow(desk.
winId());
ui->mainWidget->setStyleSheet("background-image: ???"); //what here?
originalPixmap = QPixmap::grabWindow(desk.winId());
ui->mainWidget->setStyleSheet("background-image: ???"); //what here?
To copy to clipboard, switch view to plain text mode
Any ideas?
Thanks.
//Ok, it was easier than I thought. This is the answer:
originalPixmap
= QPixmap::grabWindow(desk.
winId());
palette.
setBrush((this)->backgroundRole
(),
QBrush(originalPixmap
));
(this)->setPalette(palette);
originalPixmap = QPixmap::grabWindow(desk.winId());
QPalette palette;
palette.setBrush((this)->backgroundRole(), QBrush(originalPixmap));
(this)->setPalette(palette);
To copy to clipboard, switch view to plain text mode
Bookmarks