[Interest] QWidget or QDialog as a singleton

Jérôme Godbout godboutj at amotus.ca
Thu Aug 30 17:16:11 CEST 2018


my 2 cents, what I do is I make a basic QObject singleton, which provide
signal, anything can hook to the signal and everybody can easily fire the
signal.

QObjectSingleton::showHelpDialog()  could be send from anywhere by any code
and I can then make my Widget change it's visibility based on this signal
connection. This avoid the need to have the widget into a singleton for my
use cases. Not sure this is doable for your use case but might help to have
a cleaner design.

On Wed, 29 Aug 2018 at 14:25, Christopher Probst <christop.probst at gmail.com>
wrote:

> Hello Everybody,
>
> Along the same lines of a question I have asked in the past, as a rule of
> thumb I never have a singleton hold  a QWidget/QDialog from the instance of
> a singleton. However I am not sure why I follow this basic principle. Does
> anybody object to having the instance of a singleton be a QWidget or a
> QDialog and why? I thank you in advance.
>
> Thanks,
> Christopher
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180830/10487c57/attachment.html>


More information about the Interest mailing list