All pastes #431869 Raw Edit

Cheetah

public text v1 · immutable
·published 2007-04-09 22:32 UTC
rendered paste body
== mainwindow.h ==
...
public:
  QList<classChannel> pChannels;
...


== mainwindow.cpp ==
...
void MainWindow::loadChannels()
{
	QSettings tmpSet("/sierra.conf", QSettings::IniFormat);
	int tmpCount = tmpSet.beginReadArray("channels");
	for( int i=0; i<tmpCount; ++i) {
		tmpSet.setArrayIndex(i);
		classChannel tmpItem;
		tmpItem.channelName = tmpSet.value("name").toString();
		tmpItem.channelActivator = tmpSet.value("activator").toString();
		tmpItem.channelTrigger = tmpSet.value("trigger").toString();
		tmpItem.channelFormatter = tmpSet.value("formatter").toString();
		pChannels.append(tmpItem);
	}
	tmpSet.endArray();
	
}
...




==winprefs.cpp (display in a list)==
...
void winPrefs::refreshChannels()
{
	QStringList numbers;
	QListWidgetItem *tmpItem;
	
	classChannel cl;
	fChannelList->clear();
	for(int i=0; i<pWorld->pChannels.size(); i++) {
		cl = pWorld->pChannels.value(i);
		tmpItem = new QListWidgetItem( fChannelList );
		tmpItem->setText(cl.channelName);
		tmpItem->setIcon( QIcon(":/chat-icon.png") );
		tmpItem->setData( Qt::UserRole, i );
	}
	

}
...


==winprefs.cpp (alter the item) -- PROBLEM ==
...
void winPrefs::onChannelNameChanged()
{
	QListWidgetItem *tmpItem = fChannelList->currentItem();
	classChannel cc = pWorld->pChannels.value( tmpItem->data(Qt::UserRole).toInt() );
	cc.channelName.append("test123");
        // this won't update!
	
}
...