- Timestamp:
- Aug 4, 2009, 6:18:14 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r51 r52 40 40 #endif 41 41 #ifndef Q_OS_WINCE 42 printer = new QPrinter( );42 printer = new QPrinter(QPrinter::HighResolution); 43 43 #endif // Q_OS_WINCE 44 44 groupSettingsLanguageList = new QActionGroup(this); … … 59 59 connect(actionHelpAbout,SIGNAL(triggered()),this,SLOT(actionHelpAboutTriggered())); 60 60 #ifndef Q_OS_WINCE 61 connect(actionFilePrintSetup,SIGNAL(triggered()),this,SLOT(actionFilePrintSetupTriggered())); 61 connect(actionFilePrintPreview,SIGNAL(triggered()),this,SLOT(actionFilePrintPreviewTriggered())); 62 connect(actionFilePrint,SIGNAL(triggered()),this,SLOT(actionFilePrintTriggered())); 62 63 #endif // Q_OS_WINCE 63 64 connect(buttonSolve,SIGNAL(clicked()),this,SLOT(buttonSolveClicked())); … … 84 85 qsrand(QDateTime().currentDateTime().toTime_t()); 85 86 tspmodel = new CTSPModel(); 87 taskView->setModel(tspmodel); 86 88 connect(tspmodel,SIGNAL(numCitiesChanged(int)),this,SLOT(numCitiesChanged(int))); 87 89 connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged())); … … 92 94 setFileName(); 93 95 spinCities->setValue(settings->value("NumCities",DEF_NUM_CITIES).toInt()); 94 tspmodel->setNumCities(spinCities->value()); 95 } 96 taskView->setModel(tspmodel); 96 spinCitiesValueChanged(spinCities->value()); 97 } 97 98 setWindowModified(false); 98 taskView->resizeColumnsToContents();99 taskView->resizeRowsToContents();100 99 } 101 100 … … 107 106 if (!enable) 108 107 output.clear(); 108 #ifndef Q_OS_WINCE 109 actionFilePrint->setEnabled(enable); 110 actionFilePrintPreview->setEnabled(enable); 111 #endif // Q_OS_WINCE 109 112 } 110 113 … … 117 120 lang = settings->value("Language",QLocale::system().name()).toString(); 118 121 } 119 static QTranslator *qtTranslator; 122 static QTranslator *qtTranslator; // Qt library translator 120 123 if (qtTranslator) { 121 124 qApp->removeTranslator(qtTranslator); … … 124 127 } 125 128 qtTranslator = new QTranslator(); 126 static QTranslator *translator; 129 static QTranslator *translator; // Application translator 127 130 if (translator) { 128 131 qApp->removeTranslator(translator); … … 139 142 qApp->installTranslator(qtTranslator); 140 143 else { 144 // Qt library translation unavailable 141 145 delete qtTranslator; 142 146 qtTranslator = NULL; … … 147 151 else { 148 152 if (!ad) 149 QMessageBox(QMessageBox::Warning,trUtf8("Language change"),trUtf8("Unable to load translation language."),QMessageBox::Ok,this).exec();153 QMessageBox(QMessageBox::Warning,trUtf8("Language Change"),trUtf8("Unable to load translation language."),QMessageBox::Ok,this).exec(); 150 154 delete translator; 151 155 translator = NULL; … … 346 350 347 351 #ifndef Q_OS_WINCE 348 void MainWindow::actionFilePrintSetupTriggered() 352 void MainWindow::printPreview(QPrinter *printer) 353 { 354 solutionText->print(printer); 355 } 356 357 void MainWindow::actionFilePrintPreviewTriggered() 358 { 359 QPrintPreviewDialog ppd(printer, this); 360 connect(&ppd,SIGNAL(paintRequested(QPrinter *)),SLOT(printPreview(QPrinter *))); 361 ppd.exec(); 362 } 363 364 void MainWindow::actionFilePrintTriggered() 349 365 { 350 366 QPrintDialog pd(printer,this); … … 354 370 pd.setOption(QAbstractPrintDialog::PrintPageRange,false); 355 371 #endif 356 pd.exec(); 372 if (pd.exec() != QDialog::Accepted) 373 return; 374 solutionText->document()->print(printer); 357 375 } 358 376 #endif // Q_OS_WINCE -
trunk/src/mainwindow.h
r50 r52 55 55 void dataChanged(); 56 56 #ifndef Q_OS_WINCE 57 void actionFilePrintSetupTriggered(); 57 void printPreview(QPrinter *); 58 void actionFilePrintPreviewTriggered(); 59 void actionFilePrintTriggered(); 58 60 #endif // Q_OS_WINCE 59 61 void buttonSolveClicked();
Note: See TracChangeset
for help on using the changeset viewer.