Changeset fc9f661ded in tspsg
- Timestamp:
- Oct 19, 2007, 4:22:33 AM (17 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 67e53c96d7
- Parents:
- 95eca626aa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
r95eca626aa rfc9f661ded 25 25 #include "mainwindow.h" 26 26 27 // TODO: Saving window state on close 27 // TODO: Saving window state on close. 28 28 29 29 MainWindow::MainWindow(QWidget *parent) … … 40 40 rect.moveCenter(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).center()); 41 41 setGeometry(rect); 42 qsrand(QDateTime().currentDateTime().toTime_t()); 42 43 PrepareTable(); 44 } 45 46 int MainWindow::rand(int min, int max) 47 { 48 return min + (int)(((float)qrand() / RAND_MAX) * max); 43 49 } 44 50 … … 56 62 item->setFlags(item->flags() ^ Qt::ItemIsEditable); 57 63 } else { 58 item = new QTableWidgetItem(QVariant(rand Min + qrand() * randMax / RAND_MAX).toString());64 item = new QTableWidgetItem(QVariant(rand(randMin,randMax)).toString()); 59 65 QFont font = item->font(); 60 66 font.setBold(true); … … 89 95 tableTask->setItem(spinCities->value() - 1,spinCities->value() - 1,item); 90 96 for (int k = 0; k < spinCities->value() - 1; k++) { 91 item = new QTableWidgetItem(QVariant(rand Min + qrand() * randMax / RAND_MAX).toString());97 item = new QTableWidgetItem(QVariant(rand(randMin, randMax)).toString()); 92 98 QFont font = item->font(); 93 99 font.setBold(true); 94 100 item->setFont(font); 95 101 tableTask->setItem(k,spinCities->value() - 1,item); 96 item = new QTableWidgetItem(QVariant(rand Min + qrand() * randMax / RAND_MAX).toString());102 item = new QTableWidgetItem(QVariant(rand(randMin, randMax)).toString()); 97 103 font = item->font(); 98 104 font.setBold(true); … … 119 125 for (int x = 0; x < spinCities->value(); x++) 120 126 if (x != y) 121 tableTask->item(x,y)->setText(QVariant(rand Min + qrand() * randMax / RAND_MAX).toString());127 tableTask->item(x,y)->setText(QVariant(rand(randMin, randMax)).toString()); 122 128 } 123 129 -
src/mainwindow.h
r95eca626aa rfc9f661ded 41 41 private: 42 42 void PrepareTable(); 43 int rand(int, int); 43 44 int randMin; 44 45 int randMax; -
ui/mainwindow.ui
r95eca626aa rfc9f661ded 452 452 <string>&Про...</string> 453 453 </property> 454 <property name="statusTip" > 455 <string>Получить информацию о программе</string> 456 </property> 454 457 </action> 455 458 <action name="actionFileExit" >
Note: See TracChangeset
for help on using the changeset viewer.