Using the Leveling Grid plugin for Final Cut Pro X:
After installing, follow these steps to apply the RT Leveler effect in the Final Cut Pro X timeline:
Park the Playhead over any video or photo you want to straighten using the Leveling Grid, then press Command-5 to reveal the Effects Browser. The RT Leveler is located in the Custom area. Double-click to apply it to the selected clip or drag it onto the clip.
Use the on-screen controls in the Viewer to rotate the image using the grid lines to create parallel alignment with the horizon.
Press Command-4 to reveal the Inspector. The parameter controls for altering the effect appear under the gray bar labeled “RT Leveler”. When you rotate the image you will see the edges of the frame. Use the Scale parameter hide the edges.
When you are happy with your leveling adjustment turn off the Grid by clicking the Hide Grid button.