Example 2 Find the sum of all solutions to the equation $[3 x+1]=2 x-\frac{1}{2}$.
(1987, All-China Junior High School Mathematics Competition)
Solution: We can consider $[3 x+1]$ as a whole, for example, an integer $t$, thus transforming the given equation into an inequality related to $t$.
Let $[3 x+1]=t$, then $t$ is an integer, and
$$
0 \leqslant(3 x+1)-t<1 \text {. }
$$

Thus, the original equation becomes
$$
t=2 x-\frac{1}{2} \text {, }
$$

which means $x=\frac{1}{2} t+\frac{1}{4}$.
Substituting into inequality (1), we get
$$
0 \leqslant \frac{3}{2} t+\frac{3}{4}+1-t<1 \text {, }
$$

which simplifies to $0 \leqslant \frac{1}{2} t+\frac{7}{4}<1$.
$$
\therefore-\frac{7}{2} \leqslant t<-\frac{3}{2} \text {. }
$$

Since $t$ is an integer, the only integers satisfying inequality (3) are $t=-2, t=-3$.
Substituting the values of $t$ into equation (2), we get
$$
x_{1}=-\frac{3}{4}, x_{2}=-\frac{5}{4} \text {. }
$$

Therefore, the sum of the roots is
$$
x_{1}+x_{2}=\left(-\frac{3}{4}\right)+\left(-\frac{5}{4}\right)=-2 \text {. }
$$