[SOLVED] QListWidget InternalMove adds children
-
Hey there,
I experienced a strange behavior of my QListWidget. Therefore I prepared this example.
listwidget.h:
@
#ifndef LISTWIDGET_H
#define LISTWIDGET_H#include <QListWidget>
#include <QDebug>class ListWidget : public QListWidget
{
Q_OBJECTpublic:
ListWidget(QWidget *parent = 0);public slots:
void rowsMoved(QModelIndex,int,int,QModelIndex,int);
};#endif // LISTWIDGET_H
@listwidget.cpp:
@
#include "listwidget.h"ListWidget::ListWidget(QWidget *parent)
: QListWidget(parent)
{
this->addItem("Item 1");
this->addItem("Item 2");this->setDragDropMode( QAbstractItemView::InternalMove ); connect( this->model(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
}
void ListWidget::rowsMoved(QModelIndex,int,int,QModelIndex,int)
{
qDebug() << this->children().count();
}
@If I start this and move the two items around, every time the children count raises by one. Is this expected behaviour? If yes, could someone explain me why?
-
Hi,
It doesn't look like an expected behavior. What version of Qt are you using ?
-
Hey, I'm using Qt 5.2.1.
-
Sorry for the late reply
Can you try again with 5.3 ?
If this still happens, then have a look at the "bug report system":http://bureports.qt-project.org to see if it's something known. If not please open a new report providing a minimal compilable example that shows the behavior
-
Tried it with 5.3, still the same. Search for a while at the "bug report system":bugreports.qt-project.org but didn't find anything related to this. Therefore I openend a new "report":https://bugreports.qt-project.org/browse/QTBUG-39651.
I hope I did this the right way, as it is the first time I reported something.
-
It's missing the pro file and it'll be nicer in a compressed archive (e.g. zip), otherwise, looks good :)