Changeset 003e4193be in tspsg for src/mainwindow.cpp
- Timestamp:
- Oct 14, 2007, 5:26:42 AM (17 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 7672bc895b
- Parents:
- f99964aa0b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
rf99964aa0b r003e4193be 1 1 /* 2 2 * TSPSG - TSP Solver and Generator 3 * Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com> 3 * Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com> 4 * 5 * $Id$ 6 * $URL$ 4 7 * 5 8 * This file is part of TSPSG. … … 29 32 setupUi(this); 30 33 connect(actionSettingsSettings,SIGNAL(triggered()),this,SLOT(ChangeSettings())); 34 connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(CitiesNumberChanged(int))); 31 35 // Centering MainWindow 32 36 // TODO: Loading of saved window state … … 34 38 rect.moveCenter(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).center()); 35 39 setGeometry(rect); 40 for (int k = 0; k < tableTask->rowCount(); k++) { 41 QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(k + 1).toString()); 42 tableTask->setVerticalHeaderItem(k,item); 43 } 44 for (int k = 0; k < tableTask->columnCount(); k++) { 45 QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(k + 1).toString()); 46 tableTask->setHorizontalHeaderItem(k,item); 47 } 48 tableTask->resizeRowsToContents(); 49 tableTask->resizeColumnsToContents(); 50 } 36 51 52 void MainWindow::CitiesNumberChanged(int n) 53 { 54 // Adding row, setting header and adjusting its size 55 bool increased = tableTask->rowCount() < n ? true : false; 56 tableTask->setRowCount(n); 57 QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(n).toString()); 58 tableTask->setVerticalHeaderItem(n - 1,item); 59 if (increased) 60 tableTask->resizeRowToContents(n - 1); 61 // Adding column, setting header and adjusting its size 62 increased = tableTask->columnCount() < n ? true : false; 63 tableTask->setColumnCount(n); 64 item = new QTableWidgetItem(trUtf8("Город ")+QVariant(n).toString()); 65 tableTask->setHorizontalHeaderItem(n - 1,item); 66 if (increased) 67 tableTask->resizeColumnToContents(n - 1); 68 tableTask->setMinimumSize(tableTask->sizeHint()); 37 69 } 38 70
Note: See TracChangeset
for help on using the changeset viewer.