有人可以解释一下在QTest中点击按钮或其他类似QComboBox的最简单方法吗?
我试过了:
QComboBox *type = new QComboBox();
type->addItem( "1" );
type->addItem( "2" );
type->addItem( "3" );
type->addItem( "4" );
QVBoxLayout *vLayout = new QVBoxLayout();
vLayout->addWidget( type);
QWidget *myWidget = new QWidget();
myWidget->setLayout( vLayout );
myWidget->show();
while ( !myWidget->isVisible() ) {
QTest::qWait(400);
}
const int positionXTypeBox = 70;
const int positionYTypeBox = 25;
QTest::mouseMove ( myWidget, QPoint( positionXTypeBox, positionYTypeBox ), -1 );
QTest::qWait( 1500 );
QTest::mouseClick( myWidget, Qt::LeftButton, Qt::NoModifier, QPoint( positionXTypeBox, positionYTypeBox ), 100 );
鼠标正好在QComboBox-Widget上方,但点击鼠标时没有任何反应。
感谢。