anafor2004
27th February 2008, 03:24
Hi All
I am using kepress event for catching key_up key_down buttons but my program cant do this but it can catch A,B,C,D,......Z .What is the problem i cant get it?
Header file
#ifndef BAYRAK_H
#define BAYRAK_H
#include <QtGui/QMainWindow>
#include "ui_bayrak.h"
#include <QtGui/QMainWindow>
#include <QKeyEvent>
#include <QTimer>
class bayrak : public QMainWindow
{
Q_OBJECT
public:
bayrak(QWidget *parent = 0);
~bayrak();
private:
Ui::bayrakClass ui;
void load();
void ayar();
protected:
void keyPressEvent(QKeyEvent *keyEvent);
protected slots:
void sag();
void sol();
private:
QTimer timer;
QString str[8];
buton *flag[4];
int k;
};
#endif // BAYRAK_H
keyPressEvent.
void bayrak::keyPressEvent(QKeyEvent *keyEvent)
{
switch(keyEvent->key())
{
case Qt::Key_Up:
timer.singleShot(150,this,SLOT(sol()));
break;
case Qt::Key_Down:
timer.singleShot(150,this,SLOT(sag()));
break;
default:
QMainWindow::keyPressEvent(keyEvent);
}
I am using kepress event for catching key_up key_down buttons but my program cant do this but it can catch A,B,C,D,......Z .What is the problem i cant get it?
Header file
#ifndef BAYRAK_H
#define BAYRAK_H
#include <QtGui/QMainWindow>
#include "ui_bayrak.h"
#include <QtGui/QMainWindow>
#include <QKeyEvent>
#include <QTimer>
class bayrak : public QMainWindow
{
Q_OBJECT
public:
bayrak(QWidget *parent = 0);
~bayrak();
private:
Ui::bayrakClass ui;
void load();
void ayar();
protected:
void keyPressEvent(QKeyEvent *keyEvent);
protected slots:
void sag();
void sol();
private:
QTimer timer;
QString str[8];
buton *flag[4];
int k;
};
#endif // BAYRAK_H
keyPressEvent.
void bayrak::keyPressEvent(QKeyEvent *keyEvent)
{
switch(keyEvent->key())
{
case Qt::Key_Up:
timer.singleShot(150,this,SLOT(sol()));
break;
case Qt::Key_Down:
timer.singleShot(150,this,SLOT(sag()));
break;
default:
QMainWindow::keyPressEvent(keyEvent);
}