[Qt-interest] error handling patterns with regard to (qt) gui programming

Alan Ezust alan.ezust at gmail.com
Wed Jul 20 15:55:27 CEST 2011


You should not open up message dialogs directly from libraries, but you can
use
things like qFatal, qCritical, qWarning, and qDebug() to send your messages,
and you can decide how they are displayed (either with GUI or with a console
message, or
a log file), by installing an error handler.

See the API docs for qInstallMsgHandler.


On Tue, Jul 19, 2011 at 10:13 AM, Matthias Dahl <
ml_qt-interest at binary-island.eu> wrote:

> Hello everyone.
>
> Coming from a more server/client related background where I had to write
> tools,
> clients and servers (with some very nice detours to graphics programming),
> I've
> just recently made the serious step up to gui programming and I've been
>  asking
> myself ever since if any good design patterns exist for  error  handling
> within
> a gui program.
>
> I've read mostly that one should prefer lower level error handling because
> that
> is where most informations about the error are available. Yet I find it
> hard to
> open a QErrorMessage in some GUI unrelated part of the code where for
> example a
> database connection is handled.
>
> Throwing exceptions is naturally partly a way out. But imho exceptions are
> only
> for serious or fatal problems and not a general solution. That and there's
> also
> the possible performance impact and the usual (design) pitfalls.
>
> So I'd like to ask how you guys handle errors in your own programs?   Are
> there
> any commonalities or patterns you follow? Or maybe some tips?
>
> Thanks a lot in advance for the input...
>
> So long,
> matthias
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110720/807464d1/attachment.html 


More information about the Qt-interest-old mailing list