Reputation: 43
I want to make buttons with specific math symbols, like square root, delta, sigma, pi, etc. How to do this? I'm using Qt 5 and unicode. Thanks
Upvotes: 4
Views: 5501
Reputation: 37697
Just take any Unicode documentation and define required constants:
const QChar MathSymbolSquereRoot(0x221A);
const QChar MathSymbolPi(0x03A0);
const QChar MathSymbolDelta(0x0394);
const QChar MathSymbolSigma(0x03A3);
Remember that you have to use font which support those Unicode characters!
Upvotes: 4
Reputation: 8293
If you can write your expression as a unicode string, just use it as the button's label. (See QString::fromUtf8(...)
. Otherwise (i.e. you have a complex expression) you can save it to a image and display as the button's icon (remove the text).
Upvotes: 1