Your example shows storing an IPFS identity using it's alphanumeric encoding (Qm...), which is the same Base58 encoding that Bitcoin uses. However, what it's representing at its core is a number (the hash). Storing the identifier in the Base58 format needs to be a String because it includes letters (and what actually gets saved is the ASCII code for each alphanumeric character in the identifier).
![How to store IPFS hash using bytes32?](https://cdn-ak-scissors.b.st-hatena.com/image/square/9b15cde90cfba24e13f29bddd3f0cdfa2a13807f/height=288;version=1;width=512/https%3A%2F%2Fcdn.sstatic.net%2FSites%2Fethereum%2FImg%2Fapple-touch-icon%402.png%3Fv%3Dfa4301ca0e6d)