Smith, who moved to QPR for around £1.5m on a three-year contract in 2011, played under Cardiff manager Malky Mackay at Watford.
The 32-year-old striker has completed his transfer in time to be available for Saturday's match at Bristol City.
"Tommy is someone who has a wealth of experience of this division," said Mackay.
"He knows how to get promoted out of the division. He has guile and is a quality footballer and can score a goal aswell.
"I am delighted to get him.  I have worked with him before and he is someone who will improve the standard of the squad."
Smith, joining on a two-year deal, has Premier League experience with Watford, Portsmouth and QPR.
He was a regular in the QPR side that won promotion from the Championship in the 2010-11 season, and scored the club's first goal on their return to the top flight.
"The club would like to thank Tommy for his services and wish him every success for the future," said QPR in a statement.
Cardiff have also recruited striker Heidar Helguson and defender Matthew Connolly from QPR this summer.
Tommy Smith has joined Cardiff City from Queens Park Rangers for an undisclosed fee.