QFrame: want no background



  • Hello,

    I've set my central widget to a QWidget and set the background to .png file. No problem.
    But, whenever I add a QFrame to the central widget, the QFrame inherits the .png and uses it as it's background. So one sees a smaller version of the .png file on top of the larger version.

    I don't want the QFrames to have any background, as I will be placing widgets into the QFrame and positioning them in relation to the central widget's background.

    I've tried each of the following alone and in various combinations with no effect:

    frame->setAttribute(Qt::WA_NoSystemBackground);
    frame->setAttribute(Qt::WA_OpaquePaintEvent);
    frame->setStyleSheet("background-color: transparent");
    frame->setStyleSheet("opacity: 0");

    How do I get a QFrame to not have any background and use what lies beneath it?



  • I've tried "opacity: 1.0" as well.


  • Moderators

    I've done this in the past using style sheets with background color Qt::transparent, if i recall well



  • Solved: I was using the attribute "border-image" instead of "background".



  • Don't forget to mark thread as [solved] then.



  • My final solution was to use stylesheet attribute "border-image:none;"


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.