2

我正在用 qt 制作一个财务程序。我刚刚在我的对话框中添加了一个 QDoubleSpinBox,在这个旋转框中,用户必须插入一些产品的价格,所以我将前缀设置为我的货币符号。现在我想问是否有办法把前缀放在左边,把数字放在右边。

4

1 回答 1

0

The prefix is prepended to the start of the displayed value, suffix is appended to the end of the displayed value.

As you can see the prefix is indeed at the left of the numbers. Anyways why would you need to change the prefix position? If you need to append a string to the end of the value just change the suffix, not the prefix.

Or perhaps I didn't understand the question correctly. If what you need is to align the prefix to the left and the numbers to the right like this:

You can visually adjust it by adding tab characters at the end of the prefix.

e.g. doubleSpinBox->setPrefix(tr("[prefix]\t"));

于 2013-09-26T02:22:06.290 回答