1 Attachment(s)
QStringListModel doesn't update when QStringList is updated
Hi,
I would like help about these points
1/ I want to use the append in my method so i can add "Belgique" for ex. to my list but when i do like this nothing happens when i push the button Add....this my code and window Attachment 8800
Code:
#include"scheduletable.h"
#include "ui_scheduletable.h"
#include<QStringListModel>
ScheduleTable
::ScheduleTable(QWidget*parent
): ui(newUi::ScheduleTable)
{
ui->setupUi(this);
QStringListlistePays;
listePays<<"France";
ui->listView->setModel(modele);
connect(ui->addFrame,SIGNAL(clicked()),this,SLOT(add_Frame()));
}
voidScheduleTable::add_Frame()
{
listePays.append("Belgique");
}
ScheduleTable::~ScheduleTable()
{
deleteui;
}
Re: QStringListModel doesn't update when QStringList is updated
Thx for helping guyz the solution is
Code:
void ScheduleTable::add_Frame()
{
listePays.append("Belgique");
modele->insertRows(0, 1);
modele->setData(modele->index(0), "Belgique");
}
Added after 59 minutes:
but i have a question how can i put the new item at the end of the list ? i couldn't use currentIndex()
Re: QStringListModel doesn't update when QStringList is updated
Plz see wysota post. For understanding concept of model/view in Qt see this: http://qt-project.org/doc/qt-4.8/mod...ogramming.html -> this is very helpful and complete