Results 1 to 6 of 6

Thread: dimming background on QDialog exec?

  1. #1
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default dimming background on QDialog exec?

    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/5936...dim-background
    http://www.qtcentre.org/threads/5829...iting-a-dialog

    Will appreciate any ideas on how to achieve it.

    TIA

  2. #2
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default Re: dimming background on QDialog exec?

    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.

  3. #3
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default Re: dimming background on QDialog exec?

    Here I found another question on the same topic:
    http://www.qtcentre.org/threads/3355...ehind-a-Dialog

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: dimming background on QDialog exec?

    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,
    _

  5. #5
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default Re: dimming background on QDialog exec?

    Quote Originally Posted by anda_skoa View Post
    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:

    Qt Code:
    1. QDialog *d2;
    2. d2=new QDialog(this);
    3. d2->setModal(true);
    4. d2->setFixedSize(200,200);
    5. QPalette Pal(palette());
    6. Pal.setBrush(QPalette::Window,QColor(255,255,200,128));
    7. d2->setPalette(Pal);
    8. QLabel *label;
    9. label=new QLabel(d2);
    10. label->setText("Hello Putin");
    11.  
    12. d2->exec();
    To copy to clipboard, switch view to plain text mode 

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

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: dimming background on QDialog exec?

    Quote Originally Posted by nuliknol View Post
    But it works with Desktop.
    That's what I meant.
    The system is recognizing the relation ship and performs the darkening effect.

    Quote Originally Posted by nuliknol View Post
    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,
    _

Similar Threads

  1. QDialog::exec() problem
    By zgulser in forum Newbie
    Replies: 1
    Last Post: 27th March 2012, 19:18
  2. QTcpsocket and QDialog::exec()
    By timewolf in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2011, 09:27
  3. Replies: 9
    Last Post: 25th March 2011, 22:22
  4. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 12:35
  5. QDialog problem with exec()
    By nomadscarecrow in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2010, 19:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.