[Aptitude-devel] 002-qt-stubs review
Sune Vuorela
nospam at vuorela.dk
Mon Jul 12 17:53:19 UTC 2010
On 2010-07-12, Daniel Burrows <dburrows at debian.org> wrote:
>> namespace aptitude
>> @@ -34,6 +38,12 @@ namespace aptitude
>> // Don't crash if a subprocess breaks a pipe.
>> signal(SIGPIPE, SIG_IGN);
>>
>> + QApplication app(argc,argv);
>> +
>> + main_window *main = new main_window();
>> + main->show();
>> +
>> + app.exec();
>> return true;
>> }
>> }
>
> Do we need to delete main_window or does Qt do that for us?
We need to delete it (but isn't we just exiting from aptitude here
anyways?)
> Normally I don't put spaces between "*" and the following function
> or variable name when defining a pointer. i.e.,
>
> const char *foo;
> const char *a, *b;
funny. both coding styles. I guess it is a matter of taste.
I've always be raised with const char* foo; as the pointern is part of
the type, not the variable name.
> It still isn't threadsafe, but if the Qt GUI follows the same thread
> hygiene as GTK+ (one and only one UI thread, with background threads
> not touching UI objects), that should be fine.
Qt Gui is not threadsafe. Netiher is GTK. nor Xlib.
> What's the benefit of QList/QMap over a standard container type?
they are implicitly shared, so copying without modification is cheap.
QList is also providing fast lookups.
Using QMap is most often not what you actually want (a ordered map). It is tree backed.
Most often, QHash (a unordered map) is more likely what people want.
In general, the Qt types that also exists in the standard library, are
implicitly shared, and they have a more homogen and nicer api.
/Sune
More information about the Aptitude-devel
mailing list