It wont be accepted as a &QString??
&
serves a few different purposes in C++. In the declaration of a type it means "reference" while in usage with a variable it could be "address of". It's not entirely clear which you're trying to indicate here. Showing us what you're trying to pass and then the declaration of the function you're trying to pass it to might have been clearer.
That said, you mention QLabel::text()
which returns a QString
. If you want to pass the result of text()
to a function taking a reference to a QString
then you can just do so directly.
// Given a function with this declaration
void SomeFunction(const QString& parameter);
// and also this varable.
QLabel* l = new QLabel;
// Then the following call would work:
SomeFunction(l->text());
On the other hand, if this wasn't what you meant then show us the actual code you're having problems with and the error message that you're getting from it.