
Originally Posted by
Cyrebo
From the above it looks like you are getting the text and applying changes in one method. I need to use the line edit text in the other classes method.
void get_the_current_text_from_lineedit_and_use_it_in_the_other_classes_method
(QLineEdit *lineedit, AnotherClass
*otherClass
) { otherClass->setTextThatCanBeUsedElsewhere(text);
}
void AnotherClass
::setTextThatCanBeUsedElsewhere(const QString &txt
) { m_textThatCanBeUsedElsewhere
= txt;
}
void AnotherClass::doSomethingWithTextSetWithSetTextThatCanBeUsedElsewhere() {
doSomethingWith(m_textThatCanBeUsedElsewhere);
}
void get_the_current_text_from_lineedit_and_use_it_in_the_other_classes_method(QLineEdit *lineedit, AnotherClass *otherClass) {
QString text = lineedit->text();
otherClass->setTextThatCanBeUsedElsewhere(text);
}
void AnotherClass::setTextThatCanBeUsedElsewhere(const QString &txt) { m_textThatCanBeUsedElsewhere = txt; }
void AnotherClass::doSomethingWithTextSetWithSetTextThatCanBeUsedElsewhere() {
doSomethingWith(m_textThatCanBeUsedElsewhere);
}
To copy to clipboard, switch view to plain text mode
You're welcome.
By the way, how is this problem related to Qt?
Bookmarks