Quabla
14th March 2013, 21:47
Hey
i want to create a list of widges. each item should have a label and three buttons (like my SSH_list_item). i tried it like this:
void sshfsGUI::create_new_entry(QString name, QString mountpoint, QString address){
SSH_list_item* list_item = new SSH_list_item(name, mountpoint, address, this);
QListWidgetItem* item = new QListWidgetItem(name);
ui->SSH_List->addItem(name);
ui->SSH_List->setItemWidget(item, list_item);
list_item->show();
}
the class looks like this:
class SSH_list_item : public QDialog
{
Q_OBJECT
public:
explicit SSH_list_item(QWidget *parent = 0);
SSH_list_item(QString _name, QString _mountpoint, QString _address, QWidget *parent=0);
~SSH_list_item();
private:
Ui::SSH_list_item *ui;
QString name, mountpoint, address;
};
but what i get is a list of strings and the widget as a separate window. when i leave out " list_item->show();" there is only the list of strings.
here is a screenshot: http://imageshack.us/photo/my-images/109/screenshotro.png/
what am i doing wrong?
i want to create a list of widges. each item should have a label and three buttons (like my SSH_list_item). i tried it like this:
void sshfsGUI::create_new_entry(QString name, QString mountpoint, QString address){
SSH_list_item* list_item = new SSH_list_item(name, mountpoint, address, this);
QListWidgetItem* item = new QListWidgetItem(name);
ui->SSH_List->addItem(name);
ui->SSH_List->setItemWidget(item, list_item);
list_item->show();
}
the class looks like this:
class SSH_list_item : public QDialog
{
Q_OBJECT
public:
explicit SSH_list_item(QWidget *parent = 0);
SSH_list_item(QString _name, QString _mountpoint, QString _address, QWidget *parent=0);
~SSH_list_item();
private:
Ui::SSH_list_item *ui;
QString name, mountpoint, address;
};
but what i get is a list of strings and the widget as a separate window. when i leave out " list_item->show();" there is only the list of strings.
here is a screenshot: http://imageshack.us/photo/my-images/109/screenshotro.png/
what am i doing wrong?