[SOLVED] QWidget - make a part transparent for mouse event,
-
mouseMove event is only called if you are keeping a mouse button pressed. The other way to get the mouse move event continuously is to use setMouseGrabEnabled but have a look at the documentation before using it
-
Yo SGaist,
Been lazy, I redesigned a new QWidget containing 2 QWidgets, one of the left with transparent mouse event and the one of the left with the controls can still get the mouse events:Here it is if it can help anyone:
https://www.dropbox.com/s/66mp8rj9g4ybtw0/interfaceRepeat22.pngOnly thing to fix is a small gap in the border of the two QWidget frame, even with 0 margin they are not close enough, will investigate..
thanks for the help! -
Did you also set the spacing to 0 ?
-
Yeah all the Layout have 0 margins and spacing, there must be another element that factor in.. it's like a 1mm margin, the QWidget are not touching but almost.. weird
I tried negative margin on the layouts but not working so far,
Thanks -
The space doesn't mean the widget's not right. Are you giving him a fixed size ?
-
The SizePolicy is set to minimumExpending (horizontal and vertical), not fixed.
The size is set dynamicly at run time when user press a button this is called :
Here it is :@ RepeatData *repData = new RepeatData(id, firstRow, lastRow, numberRepeat);
RepeatWidget *repeatWidgetCopy = new RepeatWidget(repData, ui->tableView->viewport());
repeatWidgetCopy->move(rectCompleteSelection.topLeft());
repeatWidgetCopy->resize(rectCompleteSelection.size().width() + 190, rectCompleteSelection.size().height());
repeatWidgetCopy->show();@Also some attribute that may interest you :
@ ui->widget_left->setAttribute(Qt::WA_TransparentForMouseEvents);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint );@Except that, it's a standard QWidget containing 2 QWidget that have a stylsheet with a border-color. Thanks!
-
Can you show the left widget not transparent just to see how far it goes ?
-
Hmm not sure what you mean, the widget is transparent only for mouse event, both widget just have a border, no background
https://www.dropbox.com/s/66mp8rj9g4ybtw0/interfaceRepeat22.pngThanks
-
Sorry, I meant translucent
-
yeah this flag doesn't do much actually, same thing commented or not :/
-
It's not a major bug, I may change the design to show a verital doted line between both widget, I'll see if I can't fix it i'll change it, thanks
-
To have two QFrame without space between them:
this code worked (added 0px border because default is 1px I think, that was the problem!)@#frame_border_left {
border-left : 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));
border-top: 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));
border-bottom: 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));
border-right : 0px;}
#frame_border_right {
border-left : 0px;
border-right : 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));
border-top: 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));
border-bottom: 4px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(7,0,62,255), stop:1 rgba(13, 0, 158, 255));}@