+ // Get information out of the LayerItemWidget (& get it from the list!)
+ int currentRow = list->currentRow();
+ QListWidgetItem * qlwi = list->currentItem();
+ LayerItemWidget * li = (LayerItemWidget *)list->itemWidget(qlwi);
+ QString s = li->name->text();
+ bool visible = li->visibility->isChecked();
+ bool editible = li->editibility->isChecked();
+
+ // We have to make a new LayerItemWidget because it destroys the old one!
+ list->takeItem(currentRow);
+ list->insertItem(currentRow + 1, qlwi);
+ li = new LayerItemWidget(s, visible, editible);
+ list->setItemWidget(qlwi, li);
+ list->setCurrentItem(qlwi);
+}
+
+
+//
+// Set button states in this widget to sane values
+//
+void LayerWidget::SetButtonStates(void)
+{
+ int numItems = list->count();
+ int currentRow = list->currentRow();
+
+ layerDown->setEnabled(currentRow == (numItems - 1) ? false : true);
+ layerUp->setEnabled(currentRow == 0 ? false : true);
+ removeLayer->setEnabled(numItems == 1 ? false : true);