mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
all questions hide when reloading mdem
This commit is contained in:
@@ -29,7 +29,7 @@ struct Mdem {
|
|||||||
QVBoxLayout hBack;
|
QVBoxLayout hBack;
|
||||||
QToolButton editButton;
|
QToolButton editButton;
|
||||||
QToolButton deleteButton;
|
QToolButton deleteButton;
|
||||||
QToolButton showButton;
|
QToolButton toggleVisibility;
|
||||||
int labelCount;
|
int labelCount;
|
||||||
QVector<QLabel*> backLabels;
|
QVector<QLabel*> backLabels;
|
||||||
Question *question;
|
Question *question;
|
||||||
|
|||||||
@@ -372,8 +372,8 @@ Mdem* makeMdem() {
|
|||||||
);
|
);
|
||||||
mdem->hFront.addWidget(&mdem->deleteButton);
|
mdem->hFront.addWidget(&mdem->deleteButton);
|
||||||
|
|
||||||
mdem->showButton.setText("Show");
|
mdem->toggleVisibility.setText("Show");
|
||||||
mdem->hFront.addWidget(&mdem->showButton);
|
mdem->hFront.addWidget(&mdem->toggleVisibility);
|
||||||
|
|
||||||
// Back
|
// Back
|
||||||
QVBoxLayout *hBack = new QVBoxLayout();
|
QVBoxLayout *hBack = new QVBoxLayout();
|
||||||
@@ -397,13 +397,13 @@ Mdem* makeMdem() {
|
|||||||
mdem->wMdem.hide();
|
mdem->wMdem.hide();
|
||||||
|
|
||||||
// Connect button to toggle view
|
// Connect button to toggle view
|
||||||
QObject::connect(&mdem->showButton, &QToolButton::clicked, [mdem]() {
|
QObject::connect(&mdem->toggleVisibility, &QToolButton::clicked, [mdem]() {
|
||||||
if (mdem->wBack.isVisible()) {
|
if (mdem->wBack.isVisible()) {
|
||||||
mdem->wBack.hide();
|
mdem->wBack.hide();
|
||||||
mdem->showButton.setText("Show");
|
mdem->toggleVisibility.setText("Show");
|
||||||
} else {
|
} else {
|
||||||
mdem->wBack.show();
|
mdem->wBack.show();
|
||||||
mdem->showButton.setText("Hide");
|
mdem->toggleVisibility.setText("Hide");
|
||||||
}
|
}
|
||||||
showBacklabels(mdem);
|
showBacklabels(mdem);
|
||||||
});
|
});
|
||||||
@@ -466,7 +466,7 @@ void switchPage(int pageIdx) {
|
|||||||
for (auto& mdem : mdems) {
|
for (auto& mdem : mdems) {
|
||||||
if (mdem->wBack.isVisible()) {
|
if (mdem->wBack.isVisible()) {
|
||||||
mdem->wBack.hide();
|
mdem->wBack.hide();
|
||||||
mdem->showButton.setText("Show");
|
mdem->toggleVisibility.setText("Show");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,6 +647,10 @@ void reloadMdem(std::string path) {
|
|||||||
std::cout << std::format("Could not open the file: {}", currentPath.toStdString()) << std::endl;
|
std::cout << std::format("Could not open the file: {}", currentPath.toStdString()) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto mdem: mdems) {
|
||||||
|
mdem->wBack.hide();
|
||||||
|
mdem->toggleVisibility.setText("Show");
|
||||||
|
}
|
||||||
hideQuestionElements();
|
hideQuestionElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user