I think you should really just try to consider the measure that gives you length first. You'll get something like $\mu(X \cap (a,b)) = b-a$ and it'll be finitely additive, i.e. the measure of a pair of disjoint intervals is going to be the sum of lengths.
EDIT : The thing below doesn't help you answer your question because the trace of the Lebesgue measure is the zero measure (since $\mathbb Q$ has zero measure). I was a little tired when I added this comment. But there is absolutely no problem in defining a measure over $\mathbb Q$ which gives "length" as a weight to an interval of rational numbers. It just won't coincide with the Lebesgue measure but that's absolutely not a problem.
In a more theoretical setting, since $\mathbb Q \subseteq \mathbb R$, if you assume the construction of the Lebesgue measure, you can obtain a measure on $\mathbb Q$, called the trace of the measure on $\mathbb R$ (at least the word trace is used in French... I'm not sure about English, maybe it's something like "induced measure", I don't know), and since the Lebesgue measure's $\sigma$-algebra is generated by intervals, the trace of that $\sigma$-algebra is precisely the $\sigma$-algebra you wanna work with.
When you have $(X,\mathfrak T, \mu)$ a measure space and $X' \in \mathfrak T$, the trace of the measure space $(X, \mathfrak T, \mu)$ on $X'$ is defined as $(X', \mathfrak T', \mu')$ such that $ \mathfrak T' = \{ Y \cap X' \, | \, Y \in \mathfrak T \} $ and $ \mu' = \left. \mu \right|_{\mathfrak T'}. $ Hope that helps,