Changeset 2fb523720a in tspsg for src/mainwindow.cpp
- Timestamp:
- Aug 23, 2009, 1:26:42 AM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 5a81a64d74
- Parents:
- 281303f1f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
r281303f1f7 r2fb523720a 96 96 taskView->setModel(tspmodel); 97 97 connect(tspmodel,SIGNAL(numCitiesChanged(int)),this,SLOT(numCitiesChanged(int))); 98 connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged( )));98 connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged(const QModelIndex &, const QModelIndex &))); 99 99 connect(tspmodel,SIGNAL(layoutChanged()),this,SLOT(dataChanged())); 100 100 if ((QCoreApplication::arguments().count() > 1) && (tspmodel->loadTask(QCoreApplication::arguments().at(1)))) … … 148 148 else 149 149 // No luck. Let's try to load bundled one. 150 if (qtTranslator->load("qt_" + lang, "i18n"))150 if (qtTranslator->load("qt_" + lang,PATH_I18N)) 151 151 qApp->installTranslator(qtTranslator); 152 152 else { … … 156 156 } 157 157 // Now let's load application translation. 158 if (translator->load(lang, "i18n"))158 if (translator->load(lang,PATH_I18N)) 159 159 qApp->installTranslator(translator); 160 160 else { … … 191 191 int count = tspmodel->numCities(); 192 192 tspmodel->setNumCities(n); 193 if ( n > count)193 if ((n > count) && settings->value("Autosize",true).toBool()) 194 194 for (int k = count; k < n; k++) { 195 195 taskView->resizeColumnToContents(k); … … 217 217 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 218 218 tspmodel->clear(); 219 taskView->resizeColumnsToContents();220 taskView->resizeRowsToContents();221 219 setFileName(); 222 220 setWindowModified(false); … … 250 248 } 251 249 setFileName(files.first()); 252 taskView->resizeColumnsToContents();253 taskView->resizeRowsToContents();254 250 tabWidget->setCurrentIndex(0); 255 251 setWindowModified(false); … … 411 407 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 412 408 tspmodel->randomize(); 413 setWindowModified(true);414 taskView->resizeColumnsToContents();415 taskView->resizeRowsToContents();416 409 QApplication::restoreOverrideCursor(); 417 410 } … … 521 514 void MainWindow::loadLangList() 522 515 { 523 QSettings langinfo( "i18n/languages.ini",QSettings::IniFormat);516 QSettings langinfo(PATH_I18N"/languages.ini",QSettings::IniFormat); 524 517 #if QT_VERSION >= 0x040500 525 518 // In Qt < 4.5 QSettings doesn't have method setIniCodec. 526 519 langinfo.setIniCodec("UTF-8"); 527 520 #endif 528 QDir dir( "i18n","*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);521 QDir dir(PATH_I18N,"*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files); 529 522 if (!dir.exists()) 530 523 return; … … 606 599 } 607 600 601 void MainWindow::dataChanged(const QModelIndex &tl, const QModelIndex &br) 602 { 603 setWindowModified(true); 604 if (settings->value("Autosize",true).toBool()) { 605 for (int k = tl.row(); k <= br.row(); k++) 606 taskView->resizeRowToContents(k); 607 for (int k = tl.column(); k <= br.column(); k++) 608 taskView->resizeColumnToContents(k); 609 } 610 } 611 608 612 void MainWindow::numCitiesChanged(int nCities) 609 613 {
Note: See TracChangeset
for help on using the changeset viewer.