Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2008
QTreeView and keyboard problem


Message 1 in thread

Hi,

I'm using a QTreeView and I can use the keyboard (arrows: up, down, left and
right) to select the items on the tree.  My problem is that when I have
selected an item with no children and I subsequently press the right arrow
key, my program meets an assertion and exits with this message:

ASSERT: "i > -1" in file itemviews/qtreeview.cpp, line 2767
Aborted (core dumped)

Could anyone here give me an idea on what I could've done wrong?  I'm using
Qt 4.3.2 on Kubuntu.  Also, could you point me to where I can find the Qt
source code for this version?  (Pardon my obviously newbie ignorance.)

Thanks in advance,

Allister

Message 2 in thread

On 01.02.08 03:26:33, Allister Levi Sanchez wrote:
> I'm using a QTreeView and I can use the keyboard (arrows: up, down, left and
> right) to select the items on the tree.  My problem is that when I have
> selected an item with no children and I subsequently press the right arrow
> key, my program meets an assertion and exits with this message:
> 
> ASSERT: "i > -1" in file itemviews/qtreeview.cpp, line 2767
> Aborted (core dumped)
>
> Could anyone here give me an idea on what I could've done wrong?

Use the model test at:
http://labs.trolltech.com/page/Projects/Itemview/Modeltest

The source code has extensive information on the various tests it does
and how to fix any of the assertions that might be triggered.

>  I'm using
> Qt 4.3.2 on Kubuntu.  Also, could you point me to where I can find the Qt
> source code for this version?  (Pardon my obviously newbie ignorance.)

Check the downloads at:
www.trolltech.com

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

On Fri, February 1, 2008 07:18, Andreas Pakulat wrote:
> On 01.02.08 03:26:33, Allister Levi Sanchez wrote:
>> I'm using a QTreeView and I can use the keyboard (arrows: up, down, left
>> and right) to select the items on the tree.  My problem is that when I
>> have selected an item with no children and I subsequently press the right
>> arrow key, my program meets an assertion and exits with this message:
>>
>> ASSERT: "i > -1" in file itemviews/qtreeview.cpp, line 2767
>> Aborted (core dumped)
>>
>> Could anyone here give me an idea on what I could've done wrong?
>
> Use the model test at:
> http://labs.trolltech.com/page/Projects/Itemview/Modeltest
>
> The source code has extensive information on the various tests it does
> and how to fix any of the assertions that might be triggered.
>
>> I'm using Qt 4.3.2 on Kubuntu.  Also, could you point me to where I can
>> find the Qt source code for this version?  (Pardon my obviously newbie
>> ignorance.)
>
> Check the downloads at:
> www.trolltech.com
You'll probably only find the last released versions source here, which is
4.3.3 currently. I'd recommend to use it instead of 4.3.2, though, and use
it for your development in parallel to the package from Ubuntu. I've had
some troubles with Qt 4.3.2's QTreeView/QTreeWidget, although I don't think
they have to do with your problem. See here for the sources:

ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.2.tar.gz
ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.3.tar.gz

However, the sources of the specific Ubuntu package may have their own
patches, although I wouldn't expect this. Anyway, if you need the exact
sources used to build this package, you should use the source package from
Ubuntu, probably called something like "*qt4*dev*", "*qt4*devel*",
"*qt4*src*" or whatever.

Have fun, René
-- 
 [ signature omitted ] 

Message 4 in thread

Hi,

Thanks a lot!  I've fixed the problem and got a better understanding of how
model-view works :-)
The problem was a tricky typo in my data source that feeds my model which
caused a faulty row count.  The model test gave me a quick assurance that no
more buggers are left. ;-)

All the best,
Allister

On Feb 1, 2008 7:18 AM, Andreas Pakulat <apaku@xxxxxx> wrote:

> On 01.02.08 03:26:33, Allister Levi Sanchez wrote:
> > I'm using a QTreeView and I can use the keyboard (arrows: up, down, left
> and
> > right) to select the items on the tree.  My problem is that when I have
> > selected an item with no children and I subsequently press the right
> arrow
> > key, my program meets an assertion and exits with this message:
> >
> > ASSERT: "i > -1" in file itemviews/qtreeview.cpp, line 2767
> > Aborted (core dumped)
> >
> > Could anyone here give me an idea on what I could've done wrong?
>
> Use the model test at:
> http://labs.trolltech.com/page/Projects/Itemview/Modeltest
>
> The source code has extensive information on the various tests it does
> and how to fix any of the assertions that might be triggered.
>
> >  I'm using
> > Qt 4.3.2 on Kubuntu.  Also, could you point me to where I can find the
> Qt
> > source code for this version?  (Pardon my obviously newbie ignorance.)
>
> Check the downloads at:
> www.trolltech.com
>
> Andreas
>
> --
> Your aim is high and to the right.
>
>

Message 5 in thread

On Friday 01 February 2008 17:12:11 Allister Levi Sanchez wrote:
> Hi,
>
> Thanks a lot!  I've fixed the problem and got a better understanding of how
> model-view works :-)
> The problem was a tricky typo in my data source that feeds my model which
> caused a faulty row count.  The model test gave me a quick assurance that
> no more buggers are left. ;-)
>
> All the best,
> Allister

Well the modeltest doesn't check everything in the model so you might have 
some bugs still.  One thing I removed from the modeltest was the removeRows 
tests (which require pre-population with several different states).  Other 
then that if you find bugs in your model that the modeltest could have caught 
feel free to let me know and I will try to add it.

-Benjamin Meyer

--
 [ signature omitted ]