Skip to content
Browse files

replaced makeString() with QString::number()

  • Loading branch information...
1 parent cff3810 commit 61de448eeda2ac3816e2c01b4639a89c0ea4c0b0 @michal-tomlein committed Jul 25, 2011
View
2 iTestServer/answersedit.cpp
@@ -29,7 +29,7 @@ QWidget(parent) {
ans_correct = new QCheckBox(this);
ans_correct->setStatusTip(tr("A checked checkbox indicates a correct answer"));
ans_correct->setMaximumSize(ans_text->sizeHint().height(), ans_text->sizeHint().height());
- ans_remove = new MTToolButton(this, makeString(i));
+ ans_remove = new MTToolButton(this, QString::number(i));
ans_remove->setIcon(QIcon(QString::fromUtf8(":/images/images/list-remove.png")));
ans_remove->setStatusTip(tr("Remove this answer"));
ans_remove->setMaximumSize(ans_text->sizeHint().height(), ans_text->sizeHint().height());
View
10 iTestServer/archived_session.cpp
@@ -78,11 +78,11 @@ void ArchivedSession::archive()
QMapIterator<QString, QuestionAnswer> i(*(student(s)->results())); QuestionAnswer qans;
while (i.hasNext()) { i.next();
qans = i.value();
- qa_flaglist << makeString(qans.flag());
- qa_anslist << makeString(qans.answered());
- qa_correctanslist << makeString(qans.correctAnswer());
- qa_diflist << makeString(qans.difficulty());
- qa_selectiontypelist << makeString(qans.selectionType());
+ qa_flaglist << QString::number(qans.flag());
+ qa_anslist << QString::number(qans.answered());
+ qa_correctanslist << QString::number(qans.correctAnswer());
+ qa_diflist << QString::number(qans.difficulty());
+ qa_selectiontypelist << QString::number(qans.selectionType());
}
}
archive.setValue(QString("%1/%2").arg(as_parent->current_db_name).arg(session_title), data);
View
6 iTestServer/class_viewer.cpp
@@ -81,7 +81,7 @@ void MainWindow::setCurrentClass(QListWidgetItem * item)
CLSCNameLineEdit->setText(cl->name());
CLSCFirstYearSpinBox->setValue(cl->firstYear());
CLSCLastYearSpinBox->setValue(cl->lastYear());
- CLSCNumStudentsLabel->setText(makeString(cl->numMembers()));
+ CLSCNumStudentsLabel->setText(QString::number(cl->numMembers()));
CLSCAverageLabel->setText(QString("%1%").arg(cl->average(&current_db_sessions, &current_db_archivedsessions)));
CLLSListWidget->clear();
for (int i = 0; i < cl->numMembers(); ++i) {
@@ -212,7 +212,7 @@ void MainWindow::addStudent()
}
}
CLLSListWidget->insertItem(current_db_class->addMember(new ClassMember(s_name)), s_name);
- CLSCNumStudentsLabel->setText(makeString(current_db_class->numMembers()));
+ CLSCNumStudentsLabel->setText(QString::number(current_db_class->numMembers()));
setDatabaseModified();
}
@@ -228,7 +228,7 @@ void MainWindow::deleteStudent()
}
current_db_class->removeMember(CLLSListWidget->highlightedRow());
delete CLLSListWidget->takeItem(CLLSListWidget->highlightedRow());
- CLSCNumStudentsLabel->setText(makeString(current_db_class->numMembers()));
+ CLSCNumStudentsLabel->setText(QString::number(current_db_class->numMembers()));
CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(&current_db_sessions, &current_db_archivedsessions)));
clearCLSS();
togglePrintEnabled();
View
4 iTestServer/flags.cpp
@@ -31,7 +31,7 @@ void MainWindow::addFlagItem(int i)
le->setPalette(palette);
EFFlagLineEdit << le;
QTreeWidgetItem * item = new QTreeWidgetItem(EFTreeWidget);
- item->setText(0, makeString(i + 1));
+ item->setText(0, QString::number(i + 1));
item->setCheckState(0, Qt::Unchecked);
item->setStatusTip(0, tr("Check or uncheck this checkbox to enable or disable flag %1").arg(i + 1));
EFTreeWidget->setItemWidget(item, 1, le);
@@ -135,7 +135,7 @@ void MainWindow::updateFlagQnums()
if (i.value()->flag() >= 0) { flag_qnum[i.value()->flag()]++; }
}
for (int i = 0; i < EFTreeWidget->topLevelItemCount(); ++i) {
- EFTreeWidget->topLevelItem(i)->setText(2, makeString(flag_qnum[i]));
+ EFTreeWidget->topLevelItem(i)->setText(2, QString::number(flag_qnum[i]));
EFTreeWidget->topLevelItem(i)->setDisabled(flag_qnum[i] > 0 && EFTreeWidget->topLevelItem(i)->checkState(0) == Qt::Checked);
if (i < current_db_f.size()) EFFlagLineEdit[i]->setText(current_db_f[i]);
}
View
4 iTestServer/main_window.cpp
@@ -702,10 +702,10 @@ void MainWindow::overallStatistics()
default: tw_item->setText(tr("Unknown")); break;
}
stats_tw->setItem(row, 2, tw_item);
- tw_item = new QTableWidgetItem(makeString(q_item->correctAnsCount()));
+ tw_item = new QTableWidgetItem(QString::number(q_item->correctAnsCount()));
tw_item->setFont(font); tw_item->setForeground(QBrush::QBrush(QColor::QColor(92, 163, 0)));
stats_tw->setItem(row, 3, tw_item);
- tw_item = new QTableWidgetItem(makeString(q_item->incorrectAnsCount()));
+ tw_item = new QTableWidgetItem(QString::number(q_item->incorrectAnsCount()));
tw_item->setFont(font); tw_item->setForeground(QBrush::QBrush(QColor::QColor(204, 109, 0)));
stats_tw->setItem(row, 4, tw_item);
tw_item = new QTableWidgetItem;
View
2 iTestServer/print_engine.cpp
@@ -914,7 +914,7 @@ void MainWindow::printQuestions(PrintQuestionsDialogue * printq_widget)
}
}
QFileInfo file_info; bool print_to_file = false; bool native_format = false;
- int len = makeString(numprintouts).length();
+ int len = QString::number(numprintouts).length();
if (!printer->outputFileName().isEmpty() && (numprintouts > 1 || printq_widget->printKey())) {
file_info.setFile(printer->outputFileName());
print_to_file = true;
View
2 iTestServer/questions.cpp
@@ -416,7 +416,7 @@ void MainWindow::sortQuestions(Qt::SortOrder order, bool by_flag)
QStringList list; QMap<QString, QListWidgetItem *> map;
QListWidgetItem * item; QString item_text;
- int l = makeString(current_db_f.size()).length();
+ int l = QString::number(current_db_f.size()).length();
for (int i = 0; i < LQListWidget->count();) {
item = LQListWidget->takeItem(i);
View
6 iTestServer/server.cpp
@@ -589,7 +589,7 @@ void MainWindow::addClient()
QObject::connect(client, SIGNAL(disconnected(Client *)),
this, SLOT(clientDisconnected(Client *)));
- QListWidgetItem * item = new QListWidgetItem(makeString(SMLCListWidget->count() + 1), SMLCListWidget);
+ QListWidgetItem * item = new QListWidgetItem(QString::number(SMLCListWidget->count() + 1), SMLCListWidget);
current_db_clients.insert(item, client);
client->setNumber(item->text().toInt());
QListWidgetItem * log_entry = new QListWidgetItem(tr("%1 > Client #%2 connected").arg(QDateTime::currentDateTime().toString("yyyy.MM.dd-hh:mm:ss")).arg(item->text()));
@@ -856,7 +856,7 @@ bool MainWindow::addOfflineClient(const QString & file_name)
rfile.readLine();
if (rfile.readLine() != "[CLIENT_NAME]") return false;
Client * client = new Client (this, rfile.readLine());
- QListWidgetItem * item = new QListWidgetItem(makeString(SMLCListWidget->count() + 1), SMLCListWidget);
+ QListWidgetItem * item = new QListWidgetItem(QString::number(SMLCListWidget->count() + 1), SMLCListWidget);
current_db_clients.insert(item, client);
client->setNumber(item->text().toInt()); item->setText(client->name());
QListWidgetItem * log_entry = new QListWidgetItem(tr("%1 > Client #%2 (%3) added").arg(QDateTime::currentDateTime().toString("yyyy.MM.dd-hh:mm:ss")).arg(client->number()).arg(client->name()));
@@ -979,7 +979,7 @@ void MainWindow::runTestWriter()
#else
itw_file_name.replace(itw_file_name.lastIndexOf("iTestServer"), 11, "iTestClient");
#endif
- QStringList arguments; arguments << "-port" << makeString(tcpServer->serverPort());
+ QStringList arguments; arguments << "-port" << QString::number(tcpServer->serverPort());
QProcess * itw = new QProcess;
itw->start(itw_file_name, arguments);
}
View
10 iTestServer/session_viewer.cpp
@@ -181,7 +181,7 @@ void MainWindow::setCurrentSession(QListWidgetItem * item)
SVSelectedSessionWidget->setEnabled(true);
SVNameLabel->setText(session->name());
SVDateTimeLabel->setText(session->dateTimeToString());
- SVPassMarkLabel->setText(makeString(session->passMark().passMark()));
+ SVPassMarkLabel->setText(QString::number(session->passMark().passMark()));
SVOverallResultsProgressBar->setMaximum((int)session->maximumScore());
SVOverallResultsProgressBar->setValue(session->score() > 0 ? (int)session->score() : 0);
SVOverallResultsLabel->setText(QString("%1%").arg(session->average()));
@@ -214,7 +214,7 @@ void MainWindow::setCurrentSession(QListWidgetItem * item)
item->setBackground(QBrush::QBrush(backgroundColourForFlag(session->passMark().condition(i))));
item->setForeground(QBrush::QBrush(foregroundColourForFlag(session->passMark().condition(i))));
SVPassMarkTableWidget->setItem(i, 0, item);
- item = new QTableWidgetItem(makeString(session->passMark().value(i)));
+ item = new QTableWidgetItem(QString::number(session->passMark().value(i)));
SVPassMarkTableWidget->setItem(i, 1, item);
SVPassMarkTableWidget->setRowHeight(i, 16);
}
@@ -228,9 +228,9 @@ void MainWindow::setCurrentSession(QListWidgetItem * item)
scoringSystemTab->setEnabled(true);
SVScoringSystemTableWidget->item(0, 1)->setText(session->scoringSystem().allowIncompleteAnswers ? tr("allowed") : tr("disallowed"));
for (int i = 0, n = 0; i < 3; ++i, n += 3) {
- SVScoringSystemTableWidget->item(n + 1, 1)->setText(makeString(session->scoringSystem().correctAnswer[i]));
- SVScoringSystemTableWidget->item(n + 2, 1)->setText(makeString(session->scoringSystem().incorrectAnswer[i]));
- SVScoringSystemTableWidget->item(n + 3, 1)->setText(makeString(session->scoringSystem().missingAnswer[i]));
+ SVScoringSystemTableWidget->item(n + 1, 1)->setText(QString::number(session->scoringSystem().correctAnswer[i]));
+ SVScoringSystemTableWidget->item(n + 2, 1)->setText(QString::number(session->scoringSystem().incorrectAnswer[i]));
+ SVScoringSystemTableWidget->item(n + 3, 1)->setText(QString::number(session->scoringSystem().missingAnswer[i]));
}
SVLCGroupBox->setEnabled(true); SVLogGroupBox->setEnabled(true);
togglePrintEnabled(); enableSVTools();
View
2 shared/question.h
@@ -114,6 +114,4 @@ class ScoringSystem
bool allowIncompleteAnswers;
};
-#define makeString(a) QString("%1").arg(a)
-
#endif // QUESTION_H

0 comments on commit 61de448

Please sign in to comment.
Something went wrong with that request. Please try again.