Avoiding background image of Main window in child widgets
-
wrote on 11 Mar 2020, 09:33 last edited by Vineela 3 Dec 2020, 09:03
I've set border image for main window and added frame to the main window, but the image of main window is repeated to the frame too. To this i gave background:transparent to the frame even though not working.
Therefore my need is to fit image to main window where the image shud not repeat in any other fileds. -
I've set border image for main window and added frame to the main window, but the image of main window is repeated to the frame too. To this i gave background:transparent to the frame even though not working.
Therefore my need is to fit image to main window where the image shud not repeat in any other fileds.(image url)
wrote on 11 Mar 2020, 09:39 last edited by@Vineela .. You want to transparent the background image !
-
@Vineela .. You want to transparent the background image !
wrote on 11 Mar 2020, 09:40 last edited by@sankarapandiyan nope not working i did that too.
-
@sankarapandiyan nope not working i did that too.
wrote on 11 Mar 2020, 09:43 last edited by sankarapandiyan 3 Nov 2020, 09:45@Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
May be try this , I dont know this one is work or not . but try this methodframe->setAttribute(Qt::WA_NoSystemBackground); frame->setAttribute(Qt::WA_OpaquePaintEvent); frame->setStyleSheet("background-color: transparent"); frame->setStyleSheet("opacity: 0");
-
@Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
May be try this , I dont know this one is work or not . but try this methodframe->setAttribute(Qt::WA_NoSystemBackground); frame->setAttribute(Qt::WA_OpaquePaintEvent); frame->setStyleSheet("background-color: transparent"); frame->setStyleSheet("opacity: 0");
wrote on 11 Mar 2020, 09:46 last edited byThis post is deleted! -
@Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
May be try this , I dont know this one is work or not . but try this methodframe->setAttribute(Qt::WA_NoSystemBackground); frame->setAttribute(Qt::WA_OpaquePaintEvent); frame->setStyleSheet("background-color: transparent"); frame->setStyleSheet("opacity: 0");
wrote on 11 Mar 2020, 09:48 last edited by@sankarapandiyan nope this didn't work too
-
@sankarapandiyan nope this didn't work too
wrote on 11 Mar 2020, 10:00 last edited by sankarapandiyan 3 Nov 2020, 10:05click and see the link link text by this , you may get some idea ... The Topic is about overriding background image of child components
And my point is we can change the setting of the frame (REMOVING BACKGROUND) through the code itself only.
QFrame* plbl = new QFrame("foobar"); plbl->setGeometry(210, 0, 26, 16); plbl->setAlignment(Qt::AlignRight); plbl->setAlignment(Qt::AlignVCenter); plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame plbl->setAttribute(Qt::WA_NoSystemBackground); // No background plbl->setAttribute(Qt::WA_TranslucentBackground); plbl->show();
Like this we can remove the background colour or we can change the background colour
-
click and see the link link text by this , you may get some idea ... The Topic is about overriding background image of child components
And my point is we can change the setting of the frame (REMOVING BACKGROUND) through the code itself only.
QFrame* plbl = new QFrame("foobar"); plbl->setGeometry(210, 0, 26, 16); plbl->setAlignment(Qt::AlignRight); plbl->setAlignment(Qt::AlignVCenter); plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame plbl->setAttribute(Qt::WA_NoSystemBackground); // No background plbl->setAttribute(Qt::WA_TranslucentBackground); plbl->show();
Like this we can remove the background colour or we can change the background colour
wrote on 11 Mar 2020, 10:14 last edited by@sankarapandiyan ahhhhh non helping......
-
wrote on 11 Mar 2020, 11:09 last edited by VRonin 3 Nov 2020, 11:12
Give your central widget an object name (e.g.
widget->setObjectName("MyWindow");
). This allows you to set the border image in the stylesheet for that specific object without having it cascading (e.g.#MyWindow { border-image: url(:/images/background.png) }
) -
wrote on 12 Mar 2020, 04:31 last edited by
Well thank you all, I figured it out that is if i give border-image to main window i should give border-image:transparent to all child widgets . :)
1/10