| ID | ... | Creation date | 09 june 2009 |
| Platform | S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition | Tested on devices | Creator IDE V 4.5 and Emulator |
| Category | Qt for S60 | Subcategory | Application |
| Keywords (APIs, classes, methods, functions): QTestEventList |
The QTestEventList class provides a list of GUI events. A QTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on any QWidget.
Events will be executed in serial wise manner. So this can be use to built a Marco.
events->addKeyClick(Qt::Key_Space);
events->simulate(line);
#ifndef MYSIMU_H
#define MYSIMU_H
#include <QtGui/QWidget>
#include<QLineEdit>
#include<QTestEventList>
#include<QHBoxLayout>
#include<QLabel>
#include<QPushButton>
namespace Ui
{
class mysimuClass;
}
class mysimu : public QWidget
{
Q_OBJECT
public:
mysimu(QWidget *parent = 0);
~mysimu();
private:
QHBoxLayout *lay;
QLabel *lbl;
QTestEventList *events;
QLineEdit *line;
QPushButton *paste;
private slots:
void viral();
};
#endif // MYSIMU_H
#include "mysimu.h"
#include "ui_mysimu.h"
mysimu::mysimu(QWidget *parent)
: QWidget(parent)
{
lay=new QHBoxLayout(this);
lbl=new QLabel(this);
events=new QTestEventList(this);
paste=new QPushButton("PASTE",this);
events->addDelay(1000);
//This whole list is the list of GUI Events.
events->addKeyClick(Qt::Key_Space);
events->addKeyClick('a');
events->addKeyClick(Qt::Key_Space);
events->addKeyClick(Qt::Key_Backspace);
events->addKeyClick('b');
events->addKeyClick(Qt::Key_Space);
events->addKeyClick('c');
line=new QLineEdit();
lay->addWidget(line);
lay->addWidget(paste);
QObject::connect(paste,SIGNAL(clicked()),this,SLOT(viral()));
setLayout(lay);
showMaximized();
setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
}
mysimu::~mysimu()
{
}
void mysimu::viral()
{
events->simulate(line);
//This avtivate the list and the GUI events take place in the sequence in QTextEdit
}
More about QTestEventList visit: QTestEventList
More about QTestEventList visit: QTestEventList