Qt-interest Archive, October 1998
QListBox wish for future qt versions
Message 1 in thread
Hey, troll people:
Wouldn't it be nice, if you could give QListBox::{inSort,insert,...} extra
data (a void* or so) and have highlighted/selected signals with that data?
So you could pass a pointer to the programs data structures and now
exactly what the user meant without having to implement subclasses of
QListBox and QListItem.
btw: thanks to Chris (cesheppa) and Keith Brown for their help.
Message 2 in thread
Alexander Kroeller wrote:
>Wouldn't it be nice, if you could give QListBox::{inSort,insert,...} extra
>data (a void* or so) and have highlighted/selected signals with that data?
>So you could pass a pointer to the programs data structures and now
>exactly what the user meant without having to implement subclasses of
>QListBox and QListItem.
Would you rather mess with typeless void*'s than inherit?
Indeed, with QListView (the QListBox on steroids) supports the inheritance
style even more so.
--
[ signature omitted ]
Message 3 in thread
-Warwick Allison wrote:
>
> Alexander Kroeller wrote:
> >Wouldn't it be nice, if you could give QListBox::{inSort,insert,...} extra
> >data (a void* or so) and have highlighted/selected signals with that data?
> >So you could pass a pointer to the programs data structures and now
> >exactly what the user meant without having to implement subclasses of
> >QListBox and QListItem.
>
> Would you rather mess with typeless void*'s than inherit?
>
> Indeed, with QListView (the QListBox on steroids) supports the inheritance
> style even more so.
I think the design of the QListView and QListViewItem could be improved
to
allow greater flexability. I have had to do some strange things to
implement
some of my stuff. If any troll is seriously interested in my comments
then
I will draw up a wish list with reasons. BTW inclusion of void pointers
is NOT on the list.
cheers Paul.
Message 4 in thread
"P.J.Leonard" <P.J.Leonard@bath.ac.uk>
> I think the design of the QListView and QListViewItem could be improved
> to
> allow greater flexability. I have had to do some strange things to
> implement
> some of my stuff. If any troll is seriously interested in my comments
> then
> I will draw up a wish list with reasons.
Yes, please.
> BTW inclusion of void pointers
> is NOT on the list.
Good :)
--Arnt
Message 5 in thread
Arnt Gulbrandsen wrote:
>
> "P.J.Leonard" <P.J.Leonard@bath.ac.uk>
> > I think the design of the QListView and QListViewItem could be improved
> > to
> > allow greater flexability. I have had to do some strange things to
> > implement
> > some of my stuff. If any troll is seriously interested in my comments
> > then
> > I will draw up a wish list with reasons.
>
> Yes, please.
Oh dear my bluff did not work !!!!
Here are my wishes (or rather my wishes before I worked around or
changed
my initial design thoughts).
---
My subclass of QListViewItem is a view of some event data. If the
time stamp of that data changes I want to make the list sort this item
so it appears in the correct slot. The only way I could make this work
was to tell the QListView that the sorting column had changed. (my
sorting key ignores the column data).
I would like a QListViewItem::sortMe() method.
---
The QListView seems not to be symmetric with respect to mouse buttons
only the right mouse can be used to select a item/column pair via
the QListView::rightButtonClicked() method. Why not left and middle ?
Are the trolls trying to impose a particular style on us ?
I would like
int QListVIew::columnAt(int ypos) so I could deduce the column that
has been
slected in any of the QListView event call back functions.
---
It might also be useful to let someone find out the rectangle of a cell
(item / column pair). I implemented a popup widget that can be used to
edit the contents of item cell (I can only use the right mouse button to
initiate this, see above) and it involved
o The QlistView responds to right mouse button and sets the column and
QlistView item that requires the pop up widget.
-----
void
QJListView::rightButtonPressedSlot(QListViewItem *it,
const QPoint & ,int c)
{
// remember what cell was clicked.
setEditFocus((QJListViewItem *) it,c);
}
-----
o The QListViewItem::paintCell is reimplemented and if it's sees that
it is
the edit cell it tells the listView the rectangle.
This appears to be the only route to this information ?
void
QJListViewItem::paintCell(QPainter * p,
const QColorGroup & cg,
int column, int width , int align)
{
if ( !p )
return;
// CAN I AVOID this cast ? (almost as bad as void * ?)
QJListView * lv = (QJListView *)listView();
if (this == lv->focusItem()) {
if (column == lv->focusColumn()) {
QRect realRect = p->xForm(QRect(0,0,width,height()));
// tell the list view about the rectangle.
lv->setEditRect(realRect);
return;
}
}
// snip the blatent copy paste of the QListViewItem source !!!!
}
-----
I would be very impressed if anyone can tell me how to do this without
resorting to using casts :-)
cheers Paul (who does not like casts).