PDA

View Full Version : dimming background on QDialog exec?



nuliknol
17th August 2016, 21:13
Hi,
I am porting my QT Widgets app to Android, but all dialog windows (widgets subclassed from QDialog) look without borders. How do I make modal QDialogs look with dimmed screen behind like QMessageBox ?? It seems that only QMessageBox is trully ported to Android.

There are 2 more questions like this unanswered:
http://www.qtcentre.org/threads/59369-Android-dialog-dim-background
http://www.qtcentre.org/threads/58291-Grey-out-background-windows-while-editing-a-dialog

Will appreciate any ideas on how to achieve it.

TIA

nuliknol
18th August 2016, 01:45
After a looking for a few hours at QT source I gave up. I think I have to implement my own Dialog that when popped up, shows a semi-transparent widget below it. Something like on this video:
https://vimeo.com/16763092

Any example on how to do this would be appreciated.

nuliknol
18th August 2016, 04:44
Here I found another question on the same topic:
http://www.qtcentre.org/threads/33551-Darken-Widgets-Behind-a-Dialog

anda_skoa
18th August 2016, 09:15
Dimming the parent window is usually done by the system's compositor.

So it looks like the compositor does not detect the general QDialog as a (modal?) sub window but does so with the QMessageBox.

Cheers,
_

nuliknol
18th August 2016, 14:49
Dimming the parent window is usually done by the system's compositor.

So it looks like the compositor does not detect the general QDialog as a (modal?) sub window but does so with the QMessageBox.

Cheers,
_

But it works with Desktop. The background is darkened on Desktop when a dialog pops up. I also pass the parent object to constructor , so there should be no problems with parental relations. This is my test code:



QDialog *d2;
d2=new QDialog(this);
d2->setModal(true);
d2->setFixedSize(200,200);
QPalette Pal(palette());
Pal.setBrush(QPalette::Window,QColor(255,255,200,1 28));
d2->setPalette(Pal);
QLabel *label;
label=new QLabel(d2);
label->setText("Hello Putin");

d2->exec();

Only doesn't work with Android. Should I report this as a bug ?

anda_skoa
19th August 2016, 10:09
But it works with Desktop.

That's what I meant.
The system is recognizing the relation ship and performs the darkening effect.



Only doesn't work with Android. Should I report this as a bug ?

If Android is supposed to do that for all sub windows then it doesn't detect normal dialogs as such.
Which could indicate a bug in how Qt communicates the relationship to the windowing system.

Cheers,
_