Hi!
I'm trying to send QTreeWidgetItem* using itemClicked(QTreeWidgetItem*, int) signal but when I'm using in my slot item->text(column_nr) I always get segmentation fault in moment when I click on some item in QTreeWidget tree.
Compilation runs without errors or warnings. Here are some fragments of my program:
base class with connect
DirView *dirView = new DirView;
TagView *tagView = new TagView;
DirView *dirView = new DirView;
TagView *tagView = new TagView;
connect(dirView, SIGNAL(itemClicked(QTreeWidgetItem*, int)), tagView, SLOT(setTags(QTreeWidgetItem*, int)));
To copy to clipboard, switch view to plain text mode
my slot in tagView
{
if(item != 0)
item->text(0);
}
void TagView::setTags(QTreeWidgetItem* item, int)
{
if(item != 0)
item->text(0);
}
To copy to clipboard, switch view to plain text mode
dirView constructor (interhits from QTreeWidget)
{
nameFilters << "*.mp3" << "*.ogg" << "*.flac" << "*.mpc" << "*.wav" << "*.aac" << "*.wma" << "*.ape" << "*.mpp" << "*.mp4";
model->setNameFilters(nameFilters);
QTreeView::header()->setSectionHidden
(1,
true);
this
->setRootIndex
(model
->index
(QDir::rootPath()));
}
DirView::DirView(QWidget *parent) : QTreeWidget(parent)
{
model = new QDirModel;
QStringList nameFilters;
nameFilters << "*.mp3" << "*.ogg" << "*.flac" << "*.mpc" << "*.wav" << "*.aac" << "*.wma" << "*.ape" << "*.mpp" << "*.mp4";
model->setNameFilters(nameFilters);
QTreeView::setModel(model);
QTreeView::header()->setSectionHidden(1, true);
QTreeView::header()->resizeSection(0, 280);
QTreeView::header()->resizeSection(2, 100);
QTreeView::header()->resizeSection(3, 100);
this->setRootIndex(model->index(QDir::rootPath()));
}
To copy to clipboard, switch view to plain text mode
If it's not enough I can show all code. I have no idea why I can't use item->text(). Signal is generated in appropriate moment but when I'm using text() in slot program crashes.
Anyone can help?
Bookmarks