Reputation: 442
Any time I would try changing any string in QML via Javascript the end of that string is truncated. Here is an example of a basic program I've written in QML:
import QtQuick 2.0
import QtQuick.Controls 2.4
ApplicationWindow {
//setup
id: window
width: 400
height: 250
visible: true
Button{
id:toggle
property bool buttonOn: false
anchors.fill: parent
Component.onCompleted: {
toggle.text = "Activate"
}
onClicked: {
buttonOn =! buttonOn;
if(buttonOn){
toggle.text = "Deactivate"
}else{
toggle.text = "Activate"
}
}
}
}
However, when running, the code looks like this:
And when I click the Button it looks like this:
This doesn't seem to happen when it's set using pure QML like:
text: "Activate"
It also depends on how simmilar the words are, for instance id I were to use "button off" and "button on", this wouldn't happen.
I have no idea what could possible cause this and any help would be appreciated, thanks in advance.
Edit:
I've tried uninstalling and reinstalling Qt but it doesn't do anything, and a simmilar problem exists with menuBars, where nothing is displayed in the right place.
Upvotes: 1
Views: 1054
Reputation: 103
It seems this problem is not reproducible (or at least with the info you've provided). Maybe you could force the problematic component not to truncate the text by using the elide
property on the content item. However, this would only be a workaround and not a real solution to your problem.
Look here for the elide
property, and here for the customization of the Button
item.
Upvotes: 1
Reputation: 199
Try QtQuick.Controls 2.2
I did test with that version and works fine for me. Also I'm working on Debian I don't know if that may be a problem.
As you can see I add a longer text and there is the result.
Edit 2 On a virtual windows 7 works fine. You should try to use another OS or something like that
Upvotes: 1