  Let $$
  S_{m,n}(q):=\sum_{k=1}^{n}\frac{1-q^{2k}}{1-q^2}
  (\frac{1-q^k}{1-q})^{m-1}q^{\frac{m+1}{2}(n-k)}.
  $$ Generalizing the formulas of Warnaar and Schlosser, we prove that there
exist polynomials $P_{m,k}(q)\in\mathbb{Z}[q]$ such that $$
  S_{2m+1,n}(q) =\sum_{k=0}^{m}(-1)^kP_{m,k}(q)
  \frac{(1-q^n)^{m+1-k}(1-q^{n+1})^{m+1-k}q^{kn}}
  {(1-q^2)(1-q)^{2m-3k}\prod_{i=0}^{k}(1-q^{m+1-i})}, $$ and solve a problem
raised by Schlosser. We also show that there is a similar formula for the
following $q$-analogue of alternating sums of powers:
  $$
  T_{m,n}(q):=\sum_{k=1}^{n}(-1)^{n-k}
  (\frac{1-q^k}{1-q})^{m}q^{\frac{m}{2}(n-k)}.
  $$
