c++ - Can't save PNG image into file -


i have troubles image saving. have crop "1.png" rect , save file, empty 1 appearing (0 bytes). doing wrong?

void redactorform::cropbuttonslot(int x1, int y1, int x2, int y2) {      qimage pixmap("1.png");     qrect rect(x1,y1,x2,y2);     pixmap=pixmap.copy(rect);      qstring filename("d:/yourfile.png");     qfile file(filename);     file.open(qiodevice::writeonly);      qdatastream out(&file);     pixmap.save(filename,0,100);     out <<pixmap; } 

qimage's save method not take file name parameter, taske qfile. try this;

    pixmap.save(&file, "png"); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -