use setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded );