But it can't be the same with turboprops, as I don't understand how propellers can take in the air. Yet, planes like Q400s can fly above 8000', all the way up and higher than FL220! Can somebody explain how this is possible?
A turboprop plane can be pressurized in the same way a turbofan plane can: via bleed air from the compressor stage of the turbine engine. A turboprop and turbofan are not that different actually. You have a turbine engine core that powers the big fan at the front or the big propeller via a gearbox (although the turbofan still gets some of its thrust from the engine core, but the turboprop does not):
On the Dash-8 Q400 for example, the engines provide bleed air for pressurization:
The aeroplane is pressurized by engine bleed air supplied to and distributed by the air-conditioning system. Pressure is maintained and controlled by the cabin pressure control system which governs the rate of outflow from the pressurized areas (Figure 12.2-10) of the aeroplane. An aft outflow valve primarly controls the outflow of air, and is assisted by two safety valves.
Air entering at the engine inlet is directed rearard and compressed (Figure 12.23-1). Two compressors carry out compression for combustion and bleed extraction purposes. Air is first ducted to the low-pressure (NL) axial compressor and then to the high pressure (NH) centrifical compressor where it undergoes a seconds stage of compression.
(Dash-8 Q400 FCOM - Power Plant 188.8.131.52)
The following image shows the bleed port in the PW150A engine as used on the Dash-8 Q400:
Turboprops are actually turbine engines. They can produce bleed air just like turbine engines (e.g. turbofan). The bleed air can be used directly to pressurize the cabin, or it can drive another turbo compressor to pressurize fresh air from the outside:
Modern aircraft with supercharged piston engines simply use bleed air from a) the main engine's compressor or
b) the main engine's turbo charger
Another solution is to drive dedicated air compressors to pressurize the cabin. Typically this may be Roots blowers or centrifugal fans. They are mechanically driven from the main engine(s).
Image source and more information on this topic: www.aircraftsystemstech.com
Piston powered aircraft can also be pressurized, the models that are have turbo-superchargers, an exhaust driven turbine that pressurises the air going into the cylinders. Some of the air from the turbos goes to the passenger cabin. The level of pressure is controlled by outflow valves just like jet powered aircraft.