On 3/15/2011 8:45 PM, Kevin Walzer wrote:
> That's a key point> in Tk's favor--it's so easy to extend. Extending wxWidgets is a lot> harder, and I imagine that extending Qt would be even harder. That's> ultimately why I stay with Tk.
I have a lot of experience extending Qt, though it's been a year or two
since I've done any Qt work. Extending Qt requires C++ subclassing.
Giving a widget behavior often requires subclassing (though signals and
slots may work too, more on that later). Making a dialog in Qt is like
making a megawidget; subclass the QDialog or QWindow class (or whatever
it's called) and put in code to create, configure, bind, and position
the interior widgets. There's a program called Designer that generates
this code for you, though I prefer to do it by hand when management permits.
It's not quite as bad as you'd expect, since only a subset of C++ is
used. Exceptions are never used. I don't recall virtual or diamond
inheritance either. Templates are rare. In fact, I think the Qt
approach to C++ is a good illustration of what's wrong with C++. In
many ways, it uses C++ in a manner that makes it more like C. For
example, the class definitions rarely contain private members; instead
they contain what's called a "d pointer" that points to a separate
structure containing the private stuff. This is the C++ analog of C's
incomplete structs.
So I've talked about using C++ to extend Qt. But did you know that Qt
extends C++? It uses a mechanism called signals and slots to do event
notification. Slots are programmer-written functions that receive
events as arguments. Signals are MOC-generated functions that consult
the connection tables and call all the currently connected slot
functions. Signal/slot connections are dynamically established using
the connect() and disconnect() functions. MOC is the Qt Meta-Object
Compiler. It scans your source code to find special Qt keywords such as
signal and slot, which the C++ compiler ignores 'cuz they're #defined
away, then generates code based on what it finds.
All this together made me wonder how to possibly make a Tcl binding for
Qt. Maybe there's some Tcl/C black magic that can take the place of the
C++ subclassing and code generation required by Qt, but it's beyond me.
--
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core