[Qt-interest] a litte mild 'rant'
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Mon Mar 30 19:23:36 CEST 2009
> > > Why you setCurrentIndex for a QToolBox but setCurrentTab for a
> > > QTabWidget ?
> >
> > Because setCurrentTab better explains what it does.
>
> Yes, ok but why then not call it setCurrentBox() for a QToolBox and
> setCurrentWidget() for a QStackedWidget ?? surely also there
setCurrentIndex
> is not really 'meaningfull' ?
>
Im with Wim on this... Honestly, I would like to see a cross widget "set
current XXXX' function that is sthe same for
Stacked widgets,
Tabbed widgets
Comboboxes
ToolBox
Iterators
And many of the other container type objects.
That said, I wouldn't mind if it was implemented as an alias, and in the
actual function was named in a specific widget manner.
> >
> > > Why sometimes you have a setCurrentItem ?
> >
> > Same as above.
>
> so a QToolBox elemet is an 'item' and a element in a StackedWidget is
> an 'index' ???
>
> >
> > > Why do you sometimes get a signal when widgets change (e.g
setText of a
> > > QTreeWidgetItem)and sometimes not (e.g. when calling
setCurrentItem on
> > > the treeWidget ???)
> >
> > You should get a signal when you do a setCurrentItem, but you might
need to
> > check out the treewidget's model for that (something like
layoutChanged or
> > dataChanged).
> >
> > > Also the QString().toLatin1().constData() being unusable out of
scope is
> > > annoying since you need to 'dup' or 'copy' the data to some buffer
all
> > > the time
> >
> > So having to free the memory yourself would be better?
>
> Well QString manages string memory space too. perhaps it can manage an
'ascii'
> stringsspace too.
It does.. that's why it is deleting it when it goes out of scope.
Though I must say.. at least half the time I see the "constData" being
used for the wrong reason. Ie, to use printf etc...
In my view, I only use it when Im crossing to another frameworks domain,
maybe a std::wstring, and so I let the constructor make the copy
Scott
More information about the Qt-interest-old
mailing list