1174 |
1174 |
1175 void PageRoomsList::setRoomsList(const QStringList & list) |
1175 void PageRoomsList::setRoomsList(const QStringList & list) |
1176 { |
1176 { |
1177 listFromServer = list; |
1177 listFromServer = list; |
1178 |
1178 |
|
1179 QString selection = ""; |
|
1180 |
|
1181 if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0)) |
|
1182 selection = item->text(); |
|
1183 |
1179 roomsList->clear(); |
1184 roomsList->clear(); |
1180 roomsList->setColumnCount(7); |
1185 roomsList->setColumnCount(7); |
1181 roomsList->setHorizontalHeaderLabels( |
1186 roomsList->setHorizontalHeaderLabels( |
1182 QStringList() << |
1187 QStringList() << |
1183 QTableWidget::tr("Room Name") << |
1188 QTableWidget::tr("Room Name") << |
1301 item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme |
1306 item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme |
1302 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1307 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1303 item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); |
1308 item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); |
1304 roomsList->setItem(r, 6, item); |
1309 roomsList->setItem(r, 6, item); |
1305 |
1310 |
|
1311 if(!list[i + 1].compare(selection) && !selection.isEmpty()) |
|
1312 roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r,0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); |
1306 } |
1313 } |
1307 roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
1314 roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
1308 roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
1315 roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
1309 roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
1316 roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
1310 roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |
1317 roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); |