Dear All,
Yet another novice question
I have a subclass of QTreeWidget, called, QFileBrowser.
{
Q_OBJECT
public:
~QFileBrowser();
public slots:
void onFileModeToggled(bool);
private:
}
class QFileBrowser : public QTreeWidget
{
Q_OBJECT
public:
QFileBrowser(QWidget *parent);
~QFileBrowser();
public slots:
void onFilesFoldersSelected(QDir*, QStringList*);
void onFileModeToggled(bool);
private:
QFileDialog::FileMode selMode;
}
To copy to clipboard, switch view to plain text mode
And in the main window, I have implemented a signal that is connected to the slot, onFilesFoldersSelected.
QObject::connect(this, SIGNAL(filesFoldersSelected(QDir*, QStringList*)), ui->twFileBrowser, SLOT(onFilesFoldersSelected(QDir*, QStringList*)));
To copy to clipboard, switch view to plain text mode
Everything works fine and whenever, i am emitting a signal, I land in the slot. I also see that the pointers point to the data passed in the main window. However, when I try to set the tree as in below, I could see nothing ..
QList<QTreeWidgetItem *> itemList;
itemList.append(&treeItem);
this->insertTopLevelItems(0, itemList); // I Expected this to do the job of inserting items in the tree
for (int i=0; i<strList->size(); i++)
qDebug() << strList->at(i); // I can see that the strList has the strings that I am passing !!!
QList<QTreeWidgetItem *> itemList;
QTreeWidgetItem treeItem((QTreeWidget *)this, *strList, 0);
itemList.append(&treeItem);
this->insertTopLevelItems(0, itemList); // I Expected this to do the job of inserting items in the tree
for (int i=0; i<strList->size(); i++)
qDebug() << strList->at(i); // I can see that the strList has the strings that I am passing !!!
To copy to clipboard, switch view to plain text mode
I am sure, im overlooking something small. Could anyone point me to that please !!!
Thanks !!
P.
Bookmarks