Electrocardiogram (ECG) is a graphical representation of the electrical activity of the heart during a cardiac cycle. In ECG, P-wave represents the electrical excitation (or depolarisation) of the atria, which leads to the contraction of both atria.
The QRS complex represents the depolarisation of the ventricles, which initiates ventricular contraction. The contraction starts shortly after Q and marks the beginning of the systole. The T-wave represents the return of the ventricles from excited to the normal state (repolarisation). The end of the T-wave marks the end of systole.