Hi, guys, I want to use QPixmap to translate a PNG picture which is not transparent, into a transparent one. But the following codes does not work, for some compiling errors:

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4. if(argc < 2)
  5. {
  6. //
  7. std::cout << "no original picture file !" << std::endl;
  8. return 0;
  9. }
  10.  
  11. QPixmap pix(QString(argv[1])); //original picture
  12. pix.setMask(pix.createHeuristicMask());
  13. QString toWrite("out.png");
  14. if(argc == 3)
  15. {
  16. toWrite = argv[2];
  17. }
  18. pix.save(toWrite, "PNG");
  19. return a.exec();
  20. }
To copy to clipboard, switch view to plain text mode 

How can the compiler complain that the pix is non-class type"QPixmap"?

Thanks in advance!