You Are Here:

Community: Wiki

This page was last modified on 31 October 2009, at 16:03.

TestEventList in Qt

From Forum Nokia Wiki



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

Overview

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.

Preconditions

Function

  • Adds a new key click to the list. The event will simulate the key qtKey with the modifiers and then wait for msecs milliseconds.
events->addKeyClick(Qt::Key_Space);
  • Simulates the events from the list one by one on the widget w. For an example, please read the QTestEventList class documentation.
events->simulate(line);

Source Code

Header File

#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

Source File

#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
}

Screenshot

More about QTestEventList visit: QTestEventList

Image:Valid002.jpg


More about QTestEventList visit: QTestEventList

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia