How to make QMessageBox Transparent?
-
wrote on 31 Jul 2018, 10:05 last edited by
Hi,
I want an error messageBox to be transparent with respect to mainwindow .
i tried this code but dint work,please suggest.msgBox.setWindowModality(Qt::WindowModal);
msgBox.setStyleSheet("background-color:#0F1418;color:white;font-size:11pt");
msgBox.setVisible(true);
msgBox.show();thank you..
-
Hi,
I want an error messageBox to be transparent with respect to mainwindow .
i tried this code but dint work,please suggest.msgBox.setWindowModality(Qt::WindowModal);
msgBox.setStyleSheet("background-color:#0F1418;color:white;font-size:11pt");
msgBox.setVisible(true);
msgBox.show();thank you..
wrote on 31 Jul 2018, 16:56 last edited byYour question is on a wrong forum, as the question is not in any way related to mobile or embedded systems.
Why should your color code be transparent - it is a fully opaque RGB code. You need to give an rgba code, with "a" less than 255.
(I don't know whether QMessageBox supports transparency - components may have restrictions - and running environments too... Which is why it is essential to state the OS) -
Hi
Do you really mean transparent ?
Like look through ? That would make the button sort of hover in the air and
look badly.You can color it as you like with style sheet
Also a note ,
you call msgBox.show();
so unless that is a test project and code is in main , it will run out of scope
and not even be shown. -
Hi
Do you really mean transparent ?
Like look through ? That would make the button sort of hover in the air and
look badly.You can color it as you like with style sheet
Also a note ,
you call msgBox.show();
so unless that is a test project and code is in main , it will run out of scope
and not even be shown.wrote on 1 Aug 2018, 05:07 last edited by kishore_hemmady 8 Jan 2018, 07:13hi @mrjj
i need to have something like this.can i do this transparent messageBox ??
-
hi @mrjj
i need to have something like this.can i do this transparent messageBox ??
@kishore_hemmady
well you can use msgBox.setWindowOpacity(0.5); -
wrote on 1 Aug 2018, 06:20 last edited by
@mrjj
msg.setWindowOpacity(0.5);
msg.critical (0, "Error", "Improper XML, Load a proper XML!");
msg.exec();if i run this code first critical message will display first without opacity then
the message box will display with opacity without content in it -
@mrjj
msg.setWindowOpacity(0.5);
msg.critical (0, "Error", "Improper XML, Load a proper XML!");
msg.exec();if i run this code first critical message will display first without opacity then
the message box will display with opacity without content in it@kishore_hemmady Because you show TWO message boxes!
http://doc.qt.io/qt-5/qmessagebox.html#critical is static! -
wrote on 1 Aug 2018, 06:30 last edited by kishore_hemmady 8 Jan 2018, 06:31
hi @jsulm
thank you,
how can I make critical message box as transparent?
As of now i am getting 2 message Box.One with critical error message and another with opacity without content in it -
hi @jsulm
thank you,
how can I make critical message box as transparent?
As of now i am getting 2 message Box.One with critical error message and another with opacity without content in it@kishore_hemmady As I said you get two message boxes because you show one using static critical() method and then the second using show(). For critical() you actually don't need any object (that's why it is not opaque), you can call it via
QMessageBox::critical(...);
Your second message box is empty because you did not put anything in msg...
I don't think you can make message box opaque using critical().
You will need to set up your msg to show same contant as what critical() shows and removemsg.critical (0, "Error", "Improper XML, Load a proper XML!");
-
@kishore_hemmady As I said you get two message boxes because you show one using static critical() method and then the second using show(). For critical() you actually don't need any object (that's why it is not opaque), you can call it via
QMessageBox::critical(...);
Your second message box is empty because you did not put anything in msg...
I don't think you can make message box opaque using critical().
You will need to set up your msg to show same contant as what critical() shows and removemsg.critical (0, "Error", "Improper XML, Load a proper XML!");
wrote on 1 Aug 2018, 07:12 last edited by
5/10