As @clankill3r has already pointed out, you’re not storing the PImage returned by get()!
You can instead invoke PImage::save() method chained after PApplet::get() too:
if (q > 5) get(800, 800, 600, 600).save("img.png");
Also, we need to check for mousePressed 1st when mouseButton is used outside a mouse callback:
if (mousePressed & mouseButton == LEFT) ++q;