C++ Qml图表视图移位的右侧边框';过了一段时间后,向左移动了一些像素
我的图表视图的右边框在一段时间后向左移动了一些像素,不知道为什么,我尝试了一切!! 我有附加的图片,以获得更好的想法,我也添加了代码,我没有做任何错误,不知道为什么会发生C++ Qml图表视图移位的右侧边框';过了一段时间后,向左移动了一些像素,c++,qt,qml,qtquick2,qtwidgets,C++,Qt,Qml,Qtquick2,Qtwidgets,我的图表视图的右边框在一段时间后向左移动了一些像素,不知道为什么,我尝试了一切!! 我有附加的图片,以获得更好的想法,我也添加了代码,我没有做任何错误,不知道为什么会发生 Rectangle { id: top color: "black" visible: true width: 400 height: 250 focus: true clip: true //Variables and Array property d
Rectangle
{
id: top
color: "black"
visible: true
width: 400
height: 250
focus: true
clip: true
//Variables and Array
property double x_axis_variable_for_wave_1:52
property double y_axis_variable_for_wave1
// ChartView 1
ChartView
{
id:chrt
height: parent.height
width: parent.width+51
x:-31
antialiasing: true
legend.visible: false
backgroundRoundness: 0
margins.top: 17
margins.bottom: 0
margins.left: 1
margins.right: 1
backgroundColor: "black"
ValueAxis
{
id:x_axis
min: 0
max: 50
tickCount: 5
labelsVisible: false
gridLineColor: "#969FB2"
color: "#969FB2"
}
ValueAxis
{
id:y_axis
min: 0
max: 5
tickCount: 4
labelsVisible: false
gridLineColor: "#969FB2"
color: "#969FB2"
}
LineSeries
{
id:l1
axisX: x_axis
axisY: y_axis
color: "yellow"
}
Timer
{
interval: 1000; repeat: true; running: true
onTriggered:
{
//Creating Random Y-axis variable for wave 1
y_axis_variable_for_wave1= Math.floor(Math.random()*(2-(6)+1)+(6));
//Increment X-axis for showing in reverse order wave
x_axis.min=x_axis.min+2
x_axis.max=x_axis.max+2
//Join Two points at Runtime
l1.append(x_axis_variable_for_wave_1,y_axis_variable_for_wave1)
//Increment variable for plotting on next x axis point
x_axis_variable_for_wave_1=x_axis_variable_for_wave_1+2
}
}
}
}
下面的图片将显示我的怀疑,正如你们所看到的,第二张图片的右边框与第一张图片相比有差距。怎么了?有人能建议吗
为什么不使用
布局
?您可以设置绝对大小、位置,然后设置锚定。。负值。。。所有这些游戏都是为了什么?@folibis实际上我需要做一个和我们现在一样的UI,我们都知道,如果我们直接绘制图表视图而不给出负的“x”轴,那么它将创建图表视图,但内部“网格”和外部图表视图之间会有一些差距,我想要网格的左、右、上,底部边框应分别接触窗口的左、右、上、下@folibis你知道为什么会这样吗?为什么不使用Layout
?您可以设置绝对大小、位置,然后设置锚定。。负值。。。所有这些游戏都是为了什么?@folibis实际上我需要做一个和我们现在一样的UI,我们都知道,如果我们直接绘制图表视图而不给出负的“x”轴,那么它将创建图表视图,但内部“网格”和外部图表视图之间会有一些差距,我想要网格的左、右、上,底部边框应分别接触窗口的左、右、上、下@你知道为什么会这样吗?