You need to use Expand and Simplify to get your expected result (without fractions):
Integrate[((h - x)*(q[1] + q[2]) + x*(q[3] + q[4]))^2, {x, 0, h}] // Expand // Simplify
(* 1/3 h^3 (q[1]^2 + q[2]^2 + q[2] (q[3] + q[4]) + (q[3] + q[4])^2 + q[1] (2 q[2] + q[3] + q[4])) *)
The reason Mathematica displayed the form with fractions is because it has a smaller LeafCount than your expected answer:
1/3 h^3 (q[1]^2 + q[2]^2 + q[2] (q[3] + q[4]) + (q[3] + q[4])^2 +
q[1] (2 q[2] + q[3] + q[4])) // LeafCount
(* 43 *)
(h^3 (-(q[1] + q[2])^3 + (q[3] + q[4])^3))/(3 (-q[1] - q[2] + q[3] + q[4])) // LeafCount
(* 39 *)
All the q[i]s introduce additional leaves. If you had done the same integration differently, you'd have gotten the result you were expecting:
Integrate[((h - x)*(p + q) + x*(r + s))^2, {x, 0, h}]
(* 1/3 h^3 (p^2 + q^2 + q (r + s) + (r + s)^2 + p (2 q + r + s)) *)
This has a LeafCount of 32.
Integrate[...] // Expand // Simplify. The reason for this is that the expression with fractions has a smallerLeafCount(39) than your expected result (43). – rm -rf♦ Aug 15 '12 at 16:23