seerofsorrow
28th September 2017, 23:27
I currently have another silly question, I have a layout in gui folder with two buttons that are exclusive and have a bool checked slot on them Also for the whole window I have a make template button with a clicked slot on it as well and here from my class.cpp file is the code:
void Classy::on_Boy_clicked(bool checked)
{
QString Gender = "Boy";
}
void Classy::on_Girl_clicked(bool checked)
{
QString Gender = "Girl";
}
void Classy::on_MakeButton_clicked()
{
QString Gender;
QFile writeFile( filename );
if (!writeFile.open(QIODevice::Append | QIODevice::Text))
{
qDebug() << "Didn't open the file!";
}
else
{
QTextStream out (&writeFile);
out << "Case Number: "+caseNumberText << endl;
out << "Patient Name: "+ patientNameText << endl;
out << "Gender: " + Gender<< endl;
}
}
I'm trying to figure out how to make the Gender variable viewable to multiple slots at the same time. All of the code I realize won't run I'm just using it as example, as I have written the other code for it to create a directory and create the file correctly. I found this article source: https://doc.qt.io/archives/qq/qq10-signalmapper.html but slightly confused as not all of the buttons in this instance are in the same layout.
My humble thanks to any answers I get.
void Classy::on_Boy_clicked(bool checked)
{
QString Gender = "Boy";
}
void Classy::on_Girl_clicked(bool checked)
{
QString Gender = "Girl";
}
void Classy::on_MakeButton_clicked()
{
QString Gender;
QFile writeFile( filename );
if (!writeFile.open(QIODevice::Append | QIODevice::Text))
{
qDebug() << "Didn't open the file!";
}
else
{
QTextStream out (&writeFile);
out << "Case Number: "+caseNumberText << endl;
out << "Patient Name: "+ patientNameText << endl;
out << "Gender: " + Gender<< endl;
}
}
I'm trying to figure out how to make the Gender variable viewable to multiple slots at the same time. All of the code I realize won't run I'm just using it as example, as I have written the other code for it to create a directory and create the file correctly. I found this article source: https://doc.qt.io/archives/qq/qq10-signalmapper.html but slightly confused as not all of the buttons in this instance are in the same layout.
My humble thanks to any answers I get.