PDA

View Full Version : A problem with using WA_Translucent background and QSizeGrip



dzz007
15th May 2017, 19:49
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow mw;

mw.centralWidget()->setWindowFlags(Qt::SubWindow);

QSizeGrip * sizeGrip = new QSizeGrip(mw.centralWidget());

QGridLayout * layout = new QGridLayout(mw.centralWidget());


mw.setWindowFlags(mw.windowFlags() | Qt::FramelessWindowHint);
mw.setAttribute(Qt::WA_TranslucentBackground);

qDebug() << sizeGrip->testAttribute(Qt::WA_TranslucentBackground);
sizeGrip->setAttribute(Qt::WA_TranslucentBackground, false);
qDebug() << sizeGrip->testAttribute(Qt::WA_TranslucentBackground);
sizeGrip->setWindowFlags(sizeGrip->windowFlags() & ~Qt::FramelessWindowHint);

sizeGrip->setWindowOpacity(1.0);
mw.setWindowOpacity(1.0);

layout->addWidget(sizeGrip, 0,0,1,1,Qt::AlignBottom | Qt::AlignRight);
mw.centralWidget()->setStyleSheet("QWidget#a{border-image: url(:/f)}");
mw.show();

return a.exec();
}


Hello guys:) above is my code and the form it created is like this:
12468

the problem is the size griper is composed by 9 little dot with a lot of hole in it and when my mouse hovered around on the griper it is like flashing between the <double arrow state> and <pointer state> (i guess it is caused by the TranslucentBackground attribute and those <translucent> dots in the gripper.

[Double-arrow]
12469

[Pointer]
12470

Could you help me please:) I would really appreciate that.

dzz007
16th May 2017, 11:32
New to this forum, so please feel free to tell me if i am posting in a wrong section:)