5

I need to change the owner and group of a file under Linux using Qt 5.7 /C++. I found the QFileInfo::ownerID and QFileInfo::groupID getters, but there appear to be no setters for these values.

I need the Qt equivalent of chown.

Is there a way to set these values using Qt functions?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
TSG
  • 4,242
  • 9
  • 61
  • 121

1 Answers1

4

Setting file permissions can be done by QFile::setPermissions method instead of using native chmod function, but Qt has not equivalent of chown. You should use chown() function from unistd.h Look here.

trivelt
  • 1,913
  • 3
  • 22
  • 44
  • I wasn't looking for file permissions, just ownership. But accepted the answer for the second part of the question. – TSG Jan 19 '17 at 15:33