Stable, well-run companies can maintain a level of profitability over time. Declining profit margins are a warning signal that costs are rising faster than a company can pass them along in its product pricing. Obviously, if such a trend continues, the company will end up with no profits whatsoever. It's rare for mature companies to be able to steadily increase their profit margins over time. It's hard enough to maintain margins, without trying to beat last year's numbers, so don't chalk it up as a negative because a company's pre-tax profit margins are flat.
Stability is the most important factor.
Also, you will note that a company's profit margins are rarely the same from year to year. You can expect them to vary somewhat, particularly if the company is in an economically sensitive sector, but if they fluctuate widely, it may be a sign that the company's management is not doing the best job at building a stable business. The second factor in determining if a company meets your criteria for quality is whether it provides a stable rate of return on stockholders' equity. Stockholders equity, sometimes known as owners' equity, is the amount of capital that the company has raised by issuing shares of stock. These are known as retained earnings, and are recorded on the company's balance sheet in the Stockholders' Equity section.