0

I have a button with value of "a" set from the qt designer, i can also see that the string attribute has "a" in the xml.

 <widget class="QPushButton" name="button_a">
  <property name="text">
    <string>a</string>
  </property>
 </widget>

when I do

QString str = button->text();

the value of str becomes "&a" not just "a"

But if i change it to "=" or "/" or some other symbol the don't see the "&" prefix.

What could be causing the unwanted "&" to appear?

tejas
  • 1,795
  • 1
  • 16
  • 34
  • 2
    alt+... shortcut probably? http://doc.qt.io/qt-5/qshortcut.html#mnemonic – scopchanov May 06 '18 at 11:55
  • @scopchanov This is basically a hello world program for me, I haven't added any shortcuts consciously. – tejas May 06 '18 at 13:26
  • That's what I mean. They could have been added automatically. – scopchanov May 06 '18 at 23:17
  • may I ask you to share this "hello world" project to have a look what might have caused the shortcut to be added. – scopchanov May 06 '18 at 23:23
  • 2
    What platform do you see this on? There's a [known bug](https://bugs.kde.org/show_bug.cgi?id=337491) in Plasma 5 about `&` characters automatically inserted into menu items, maybe it's something similar. See also [this](https://stackoverflow.com/a/32711483). – Dmitry May 07 '18 at 07:33
  • @Dimitry: yes its kubuntu, so plasma 5. this should be the bug that's causing the issue – tejas May 07 '18 at 07:57
  • @Dimitry I used the solution given in the bug and it solves it. It might mess up your theme. But it is weird that the but but is still marked unconfirmed. – tejas May 07 '18 at 16:46

0 Answers0