View | Details | Raw Unified | Return to bug 9204
Collapse All | Expand All

(-)alterator-browser-qt-2.6/widgets.cc (-2 / +10 lines)
Lines 293-304 Link Here
293
void alListBox::registerEvent(const QString& name)
293
void alListBox::registerEvent(const QString& name)
294
{
294
{
295
	if ("on-select" == name)
295
	if ("on-select" == name)
296
		connect(wnd_,SIGNAL( itemSelectionChanged() ),SLOT(onSelect()));
296
		connect(wnd_,SIGNAL( currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*) ),
297
				SLOT( onSelection(QTreeWidgetItem*,QTreeWidgetItem*) ));
298
}
299
300
void alListBox::onSelection(QTreeWidgetItem* current, QTreeWidgetItem*)
301
{
302
	int newIndex = wnd_->indexOfTopLevelItem(current);
303
	currentIndex = newIndex;
304
	emitEvent(id_,"on-select"); 
297
}
305
}
298
306
299
QString alListBox::postData() const
307
QString alListBox::postData() const
300
{
308
{
301
	return QString(" (current . ") + QString::number(wnd_->indexOfTopLevelItem(wnd_->currentItem())) +" )";
309
	return QString(" (current . ") + QString::number(currentIndex) +" )";
302
}
310
}
303
311
304
void alComboBox::setAttr(const QString& name,const QString& value)
312
void alComboBox::setAttr(const QString& name,const QString& value)
(-)alterator-browser-qt-2.6/widgets.hh (-1 / +5 lines)
Lines 211-219 Link Here
211
211
212
class alListBox: public alWidgetPre<QTreeWidget2>
212
class alListBox: public alWidgetPre<QTreeWidget2>
213
{
213
{
214
	Q_OBJECT
215
	int currentIndex;
214
public:
216
public:
215
	alListBox(const QString& id,const QString& parent):
217
	alListBox(const QString& id,const QString& parent):
216
		alWidgetPre<QTreeWidget2>(id,parent)
218
		alWidgetPre<QTreeWidget2>(id,parent), currentIndex(0)
217
	{
219
	{
218
		wnd_->setAlternatingRowColors(true);
220
		wnd_->setAlternatingRowColors(true);
219
		//setings to be compatible with QListView
221
		//setings to be compatible with QListView
Lines 225-230 Link Here
225
	void setAttr(const QString& name,const QString& value);
227
	void setAttr(const QString& name,const QString& value);
226
	void registerEvent(const QString&);
228
	void registerEvent(const QString&);
227
	QString postData() const ;
229
	QString postData() const ;
230
public slots:
231
	void onSelection(QTreeWidgetItem* current, QTreeWidgetItem*);
228
};
232
};
229
233
230
class alComboBox: public alWidgetPre<QComboBox>
234
class alComboBox: public alWidgetPre<QComboBox>

Return to bug 9204