Prakhar
Prakhar

Reputation: 325

How to include special math symbols in QCheckBox text string?

I want something like "A XOR B", where XOR is replaced by its symbol i.e. '+ enclosed in a circle'. This string has to displayed as a QLabel or QCheckBox text on the Qt window.

I tried many different things, include unicode, but nothing seems to work.

Upvotes: 2

Views: 505

Answers (1)

Marcus
Marcus

Reputation: 1703

Qt4 and hence PyQt4 do support unicode characters. So all that one has to do is simply use unicode representation of the the symbol one needs. In your case it is '⊕' character. In unicode it is U+2295. The python code is

unicodeCheckBox = QCheckBox( u'A \u2295 B' )

Upvotes: 2

Related Questions