Solved Avoiding background image of Main window in child widgets
-
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)
-
@Vineela .. You want to transparent the background image !
-
@sankarapandiyan nope not working i did that too.
-
@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");
-
This post is deleted! -
@sankarapandiyan nope this didn't work too
-
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
-
@sankarapandiyan ahhhhh non helping......
-
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) }
) -
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 . :)