FlashExam: bugfixes, again

This commit is contained in:
Nicolas Mailloux 2024-11-29 20:13:50 -05:00
parent 36c4693869
commit 32e05489f4
2 changed files with 102 additions and 71 deletions

View file

@ -112,6 +112,7 @@ void flashExam::on_revealBtn_clicked()
ui->textBrowser->setText("<i>" + answerText + "</i>");
answerShown = true;
ui->revealBtn->setText("Hide answer");
ui->continueWidget->show();
}
}
@ -126,12 +127,7 @@ void flashExam::displayCard(bool existingCardNumber) {
float cardsTotalFloat = cardsTotal * 1.0;
float cardsAlreadyShownNumber = cardsAlreadyShown.count() * 1.0;
float cardsNotKnownNumber = cardsNotKnown.count() * 1.0;
if(answerShown) {
ui->cardNumberLabel->setText(QString::number((cardsAlreadyShownNumber - 1) / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
}
else {
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
}
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
}
else {
ui->cardNumberLabel->hide();
@ -171,6 +167,7 @@ void flashExam::displayCard(bool existingCardNumber) {
ui->revealBtn->setText("Show answer");
answerShown = false;
ui->continueWidget->hide();
}
QString flashExam::displayImage(QString cardText) {

View file

@ -184,13 +184,102 @@
</property>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="6" column="0">
<widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Shadow::Plain</enum>
<item row="2" column="0">
<widget class="QGraphicsView" name="graphicsView">
<property name="lineWidth">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</widget>
</item>
<item row="5" column="0">
<widget class="QStackedWidget" name="continueWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="didNotKnowBtn">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="nextBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Shadow::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4"/>
</widget>
</item>
<item row="7" column="0">
<widget class="QPushButton" name="revealBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show answer</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
@ -233,20 +322,8 @@
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="revealBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show answer</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Line" name="line_5">
<item row="4" column="0">
<widget class="Line" name="line_4">
<property name="frameShadow">
<enum>QFrame::Shadow::Plain</enum>
</property>
@ -258,51 +335,8 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QGraphicsView" name="graphicsView">
<property name="lineWidth">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="didNotKnowBtn">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="nextBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="Line" name="line_4">
<item row="1" column="0">
<widget class="Line" name="line_5">
<property name="frameShadow">
<enum>QFrame::Shadow::Plain</enum>
</property>