2

Somehow my QSlider is not sliding. I am only able to click on the slider and then the slider changes his position. I have checked with examples but everything seems to be the same.

Here is one of my QSliders:

QSlider  *obj_scale_x= new QSlider(Qt::Horizontal);
obj_scale_x->setValue(10);
obj_scale_x->setToolTip(tr("Scale object"));
obj_scale_x->setRange(1,50);
obj_scale_x->setTickPosition(QSlider::TicksAbove);
connect(obj_scale_x, SIGNAL(valueChanged(int)), this, SLOT(objScale_x(int)));

I thought the problem might be the mouse. But this is not working either.

void OpenGLScene::mousePressEvent(QMouseEvent *event)
{ 
    lastPos = event->pos();
}

void OpenGLScene::mouseMoveEvent(QMouseEvent *event)
{
    lastPos = event->pos();
}

I am definining the Slider in QGraphicsScene-based class. it might be this, but I am at my wit's end.

4

2 に答える 2

1

おそらくあなたの問題に対する答えは次のとおりです。

obj_scale_x->setTracking(true);
于 2012-08-06T10:34:05.303 に答える
0

UI 階層の上位にあるオブジェクトに対して が定義されていないことを確認してください。eventFilter()定義されている場合は、イベントに直接反応しない場合に備えて、イベントを「飲み込む」ことがないようにしてください (つまりBaseClass::eventFilter(obj, event)、その場合)。

それは私にとって問題を解決しました。

于 2018-02-02T13:57:15.287 に答える