octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: redesign of GUI event handling


From: Jacob Dawid
Subject: Re: redesign of GUI event handling
Date: Wed, 19 Sep 2012 09:44:54 +0200

Dan,
 
The patch is for GUI items signals and slots, i.e., the file editor tab being notified directly by the _main_window using a signal rather than having to go through the file editor which then distributes the notification to the file tabs.  Saves a small hunk of code.

I am sorry, I got a bit confused, since you seemed to response to jwe's email with the subject "redesign of GUI event handling", which is a different topic.

I spoke about that on IRC and I saw that people are convinced that dynamic_casts are an evil thing per se, though to be honest I would not apply the patch. The reason is the following: Every Qt object that works with signals and slots is a QObject. The hierarchy is:

QObject -> QWidget -> QFileEditorTab

It is considered bad design (in Qt) to send information in signals about the sender, but there is a "trick" to gather that information: QObject->sender() will query the meta object layer to find out who invoked the slot. So I could also downcast the QWidget with the same effect, saving the dynamic_cast and not changing the signal to what is considered bad design. The reason I do the dynamic_cast is to query RTTI to see whether the object invoking the slot is really appropriate for that kind of operation I am doing. In fact, i am downcasting QFileEditorTab implicitly to QWidget afterwards.

Also, the notice settings signal is a signal that will be emitted on a change of settings (ie. in the settings dialog). The file editor receives that signal and distributes it to the editor tabs. If you remove that, the changing fonts and other settings on the editor should not have any effect anymore.

Jacob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]