PDA

View Full Version : Where to submit a bug?



hgiese
1st September 2009, 20:54
Hello out there,
I believe I found a bug in one of Qt's widgets and now I have 2 questions:
1) Where do I submit this bug?
2) What is the preferred format for reporting a bug?
I believe that posting a complete project (together with a description of expected versus real behaviour) would be the most efficient way to have a developer (try to) reproduce it - but maybe the rules are different?

Thanks for any enlightenment and best regards
Helmut Giese

kwisp
1st September 2009, 20:59
http://qt.nokia.com/developer/task-tracker

wysota
2nd September 2009, 08:37
What is the bug, by the way?

hgiese
2nd September 2009, 10:35
Hello,
@kwisp Thanks, this was fast.

@wysota
I changed the 'findfiles' example from the distribution (examples/dialogs/findfiles) to enable sorting (you know: click on the header of a column and the table gets sorted on the content of this particular column).
In the original version file sizes showed up as expected.
In the modified version most (almost all) files have no size any more and the one(s) that do have a size appear to have a wrong value.

The change I made was adding one line into the creation code for the table (see below).


void Window::createFilesTable()
{
filesTable = new QTableWidget(0, 2);
filesTable->setSelectionBehavior(QAbstractItemView::SelectRows );

QStringList labels;
labels << tr("File Name") << tr("Size");
filesTable->setHorizontalHeaderLabels(labels);
filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
filesTable->verticalHeader()->hide();
filesTable->setShowGrid(false);

// This line added
filesTable->setSortingEnabled(true);

connect(filesTable, SIGNAL(cellActivated(int, int)),
this, SLOT(openFileOfItem(int, int)));
}

This is on Windows XP using the stand-alone Qt Creator 1.2.1 (based on Qt 4.5.2).
I'll go and report it.
Best regards
Helmut Giese

Boron
2nd September 2009, 11:05
I could reproduce this.
When the new line filesTable->setSortingEnabled(true); is moved after the call of findFiles() (line 132) the file sizes are displayed correctly.
So the sorting does weird things to table content.

But honestly I believe that the problem lies not in Qt itself, but in the example.
The example inserts a row and afterwards fills file name and file size to the row.
When sorting is enabled the row number that showFiles() uses is not the number where the row was inserted. The sorting moved the row.
If the example should work it should either sort after inserting all rows (see above) or better take care of where QTableWidgetItems are inserted.

wysota
2nd September 2009, 11:45
This is not a bug in Qt. This is the fault of architecture of the example. If you disable sorting temporarily during the run of the loop in Window::showFiles(), everything will be correct. Analyze the loop to see why.

hgiese
2nd September 2009, 12:53
Hi there,
@Boron Thanks for trying it out and for the analysis. If I disable/enable sorting around the filling operation everything works. This "bug" has cost me - no I won't tell in public.

@wysota I wonder: If there were an 'append' method, adding rows and sorting them would not step on each others feet - but such a method does not seem to exist.

Another question (if I may): When sorting I want _all_ directories always shown before _any_ files so I need some kind of "custom sort". I wonder: Is a QTableWidget then the right choice?

Any link would be greatly appreciated.
Best regards
Helmut Giese

victor.fernandez
2nd September 2009, 13:04
You can subclass QSortFilterProxyModel and reimplement lessThan().

wysota
2nd September 2009, 14:55
@wysota I wonder: If there were an 'append' method, adding rows and sorting them would not step on each others feet - but such a method does not seem to exist.
But it has nothing to do with having a method to append some data. The "problem" is that if you change the text in the table, it immediately gets resorted and the row will go elsewhere. To overcome it it is enough to hold a pointer to the item you are operating on and use this pointer to enter data.

The example is simply very trivial with a single goal of proving some point. It's not a general purpose foul-proof and fool-proof full-blown framework for everything. If you fell into this trap it means that you probably don't fully understand what is going on in the framework. Otherwise you wouldn't have copied the example but instead would write the code from scratch to suit your needs.


Another question (if I may): When sorting I want _all_ directories always shown before _any_ files so I need some kind of "custom sort". I wonder: Is a QTableWidget then the right choice?

It's as right and as wrong choice as any other when it comes to sorting. When your application grows more complex you will probably have to switch to using QTableView with a real model.

hgiese
3rd September 2009, 11:44
Hi wysota,

If you fell into this trap it means that you probably don't fully understand what is going on in the framework. Otherwise you wouldn't have copied the example but instead would write the code from scratch to suit your needs.
spot on!
Yes, I am completely new to Qt and a tool of such complexity imposes a - probably rather steep - learning curve. So one takes an example which _looks_ like it does something close to what one wants to achieve and then sort of stumbles forward.
It's a bit of a catch-22: If I were familiar with Qt I wouldn't need the examples. Since I am not they are a helpful source of insight into the inner workings - but I am of course not yet in a position to really judge their suitability.
Anyway, thanks a lot for your help. Let's close this thread since it's topic is rather misleading now.
Best regards
Helmut Giese

NoRulez
3rd September 2009, 11:50
If your are a commercial license holder you can use the Customer Portal (http://qt.nokia.com/customerportal)

Best Regards
NoRulez

hgiese
3rd September 2009, 15:25
If your are a commercial license holder you can use the Customer Portal
No, I'm just a poor guy ...