There are two types of QR code systems. In the first, the code is generated specifically for that transaction, so includes the price. This type does require some sort of power for the machine to generate the code, but not for the actual payment process.
The second, which is far more common upcountry, including many market stalls and small shops, has a generic code simply directing to the bank account of the vendor. This is just printed on a piece of paper. You scan it and manually enter the amount to be paid, then show the vendor the "receipt" that comes up on your phone. Some will scan that with their phones, but most will just check the price and account name is correct. This requires no electricity whatsoever, just a powered up phone with a network connection.
I tend to use cash myself, but do occasionally go the QR route. One advantage of the latter is no coins are required, either for payment or change, significantly cutting down on pocket shrapnel.