Not every member function needs to be a slot. If it produces some value it doesn't sound very slottish.
Consider you have a slot like QByteArray MyClass::saveData() and you connect it to some button:
connect(button, &QPushButton::clicked, myObject, &MyClass::saveData). You can connect it that way but where would the byte array data go? Button is certainly not gonna do anything with it.
Instead something like this seems more reasonable:
class MyClass {
...
public slots: //could be private or whatever
void processPictureData() {
savePictureData(loadPictureData());
}
void savePictureData(const QByteArray& data) {
/* write the data to some storage thing place */
}
public: //could be private or whatever, but it's not a slot
QByteArray loadPictureData() { // it could even be made static member to allow greater reusability
/* do what you did and return the data */
}
}
Now you have a nice modular design, each piece of functionality reusable in isolation and hermetic.
You can connect either of the slots to some signal.
Btw. as the help in the footer suggests please use ``` around your code, not @.