-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtitledialog.cpp
More file actions
36 lines (29 loc) · 1.01 KB
/
titledialog.cpp
File metadata and controls
36 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Created by Asus on 19/03/2025.
//
// You may need to build the project (run Qt uic code generator) to get "ui_TitleDIalog.h" resolved
#include "titledialog.h"
#include "ui_TitleDIalog.h"
TitleDIalog::TitleDIalog(QWidget *parent) :
QDialog(parent), ui(new Ui::TitleDIalog) {
ui->setupUi(this);
connect(ui->saveButton, &QPushButton::clicked, this, &TitleDIalog::saveTitle);
connect(ui->goBackButton, &QPushButton::clicked, this, &TitleDIalog::cancelDialog);
}
TitleDIalog::~TitleDIalog() {
delete ui;
}
const QString &TitleDIalog::getTitle() const {
return title;
}
void TitleDIalog::saveTitle() {
title = ui->titleEdit->text(); // Salva il titolo inserito
accept(); // Chiude il dialogo e ritorna QDialog::Accepted
}
void TitleDIalog::cancelDialog() {
reject(); // Chiude il dialogo senza salvare (QDialog::Rejected)
}
void TitleDIalog::setTitle(const QString &newTitle) {
title = newTitle;
ui->titleEdit->setText(title); // Mostra il titolo corrente nel campo di testo
}