I have a form having a list widget and a label. I want to display file permission, when I click listwidget having file names got from some filesystem. I used following code :
QFileDevice::Permissions p = file.permissions();
labelpermission
->setText
(QString::number(p
));
QFile file(strpath);
QFileDevice::Permissions p = file.permissions();
labelpermission->setText(QString::number(p));
To copy to clipboard, switch view to plain text mode
in help manual I got following :-
QFileDevice::ReadOwner 0x4000 The file is readable by the owner of the file.
QFileDevice::WriteOwner 0x2000 The file is writable by the owner of the file.
QFileDevice::ExeOwner 0x1000 The file is executable by the owner of the file.
QFileDevice::ReadUser 0x0400 The file is readable by the user.
QFileDevice::WriteUser 0x0200 The file is writable by the user.
QFileDevice::ExeUser 0x0100 The file is executable by the user.
QFileDevice::ReadGroup 0x0040 The file is readable by the group.
QFileDevice::WriteGroup 0x0020 The file is writable by the group.
QFileDevice::ExeGroup 0x0010 The file is executable by the group.
QFileDevice::ReadOther 0x0004 The file is readable by anyone.
QFileDevice::WriteOther 0x0002 The file is writable by anyone.
QFileDevice::ExeOther 0x0001 The file is executable by anyone.
QFileDevice::ReadOwner 0x4000 The file is readable by the owner of the file.
QFileDevice::WriteOwner 0x2000 The file is writable by the owner of the file.
QFileDevice::ExeOwner 0x1000 The file is executable by the owner of the file.
QFileDevice::ReadUser 0x0400 The file is readable by the user.
QFileDevice::WriteUser 0x0200 The file is writable by the user.
QFileDevice::ExeUser 0x0100 The file is executable by the user.
QFileDevice::ReadGroup 0x0040 The file is readable by the group.
QFileDevice::WriteGroup 0x0020 The file is writable by the group.
QFileDevice::ExeGroup 0x0010 The file is executable by the group.
QFileDevice::ReadOther 0x0004 The file is readable by anyone.
QFileDevice::WriteOther 0x0002 The file is writable by anyone.
QFileDevice::ExeOther 0x0001 The file is executable by anyone.
To copy to clipboard, switch view to plain text mode
and when I was in exicuting program prmission was displayed as : 21845 ( for /bin/GET ) or 30581 (for /home/rahul/.netbeans).
Now I want to display this numeric code in form of "drwxr-xr-x" format. But here is only four fields and in numeric code there are five fields.
So my question is how to decode this numeric code to rwx code and display in QLabel.
Bookmarks