[Solved] Transparent Window
-
Hi all,
i m new on QT and i m trying to develop a launcher. i set a transparent image at background but as u can see on this link ( http://prntscr.com/2a3qpz ), a black frame is surround my image. I researched on many websites, but i couldn't get anything about that.
transparent image http://prntscr.com/2a3qw6
i ve something which set background image, it works but not enough for my project. how can i delete this black frame? Can someone help me please?
@ QPalette* palette = new QPalette();
palette->setBrush(QPalette::Background,(new QBrush((new
QPixmap(":/new/MyResources/launcher.png")))));
setPalette(*palette);
setWindowFlags(Qt::FramelessWindowHint);@Thank You
-
There is also a transparency setting for Windows. Maybe that is the issue?
-
thank u for your post
i ve try many things like
@ setStyleSheet("background:transparent");
setAttribute(Qt::WA_TranslucentBackground,true);
@
for example if i put this two codes nothing shows, i m missing some point :S -
Hi,
If for some reason it is the program startup you might want to consider a QSplashScreen instead? Maybe some extra options are available there. Otherwise you might need to have the widget you use to display the image (label?) set to transparent? Never tried a transparent before, so who knows -
[quote author="amonR" date="1386708307"]Does it fix your problem when you use Qlabel like this:
@
QLabel *mypicture = new QLabel(this);
mypicture->setPixmap(QPixmap(":/new/MyResources/launcher.png"));
@
[/quote]when i use QLabel i get this http://prntscr.com/2a75x8 instead of black frame now it show gray frame
-
[quote author="Jeroentje@home" date="1386708413"]Hi,
If for some reason it is the program startup you might want to consider a QSplashScreen instead? Maybe some extra options are available there. Otherwise you might need to have the widget you use to display the image (label?) set to transparent? Never tried a transparent before, so who knows[/quote]Thank you so much, QSplashScreen is solved my problem :) here is the result http://prntscr.com/2a78cf i get what i want :)
here whole code that i wrote@#include "mainwindow.h"
#include <QApplication>
#include <QSplashScreen>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QPixmap pixmap(":/new/MyResources/launcher.png"); QSplashScreen splash(pixmap); splash.show(); a.processEvents(); return a.exec();
}@
-
Hi,
The a.processEvents() is not needed here. The a.exec() does call it automatic. The QApplication when executed will handle the eventHandler.
But picture looks nice ;-)