QTest and mouseClick Function
-
Hi,
can somebody explain me the simplest way to click a button or something else like a QComboBox in a QTest?
I tried this:@
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 );
@the mouse was excatly over the QComboBox-Widget but nothing happens when the mouse was clicked..
And what's the solution when the combobox is a private member of the widget?Thanks