[PyKDE] QtCore.Qt and QtGui.Qt

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Thu Mar 2 14:26:50 GMT 2006


On Thu, 2 Mar 2006 12:42:42 +0100
Sundance <sundance at ierne.eu.org> wrote:

> On Thu, Mar 02, 2006 at 10:41:45AM +0000, Phil Thompson wrote:
> 
> > A C++ namespace doesn't have an implementation, it just contributes to
> > name mangling. In Python they have to be implemented by something so
> > there is no direct comparison.
> 
> Point! Although I feel Giovanni does have a point as well. Having 
> DIFFERENT Qt namespaces lying around is super ungood. Recipe for pain, 
> that. I think this is one of those cases where we should polish things 
> into submission manually if need there.
> 

I have been wondering for some time if it wouldn't be better to merge QtCore
and QtGui into one single module.  This resolves the problem of the Qt namespace
clashes.  Eventually there could be a QtCore module for people who really only
need QtCore (how many?).

I see the value of the module prefixes, but the separation in QtCore, QtGui,
QtOpenGL is very verbose and I agree that it does not improve readability.

I propose a plain Python module PyQt4.qt reading:

from PyQt4.QtGui import *
from PyQt4.QtOpenGL import *
# etc... PyQt4's configure.py can figure out which other modules to import

This module could be used as:
import qt 
or (admittedly dangerous):
from qt import *


Gerard

PS: http://mats.imk.fraunhofer.de/pipermail/pykde/2006-January/012179.html
is a bit revolutionary, but I like the idea of typing qt.ComboBox.




More information about the PyQt mailing list