Keybuttons lcd7cape mapped to beaglebone, dont catch event, try eventfilter etc



  • Hello, it is first time to write here, i have fixed many issue by this forum, but this problem i dont know solution.

    I have a beaglebone with lcd7cape, five buttons ( left, right, up, down, enter ), but dont catch events in qt, i try eventfilter, keypressevent, read /dev/input/event2 ( here is event keyboard ), but nothing

    By terminal work event, catch key press, running in bbb dont work.

    this mainwindow.cpp

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) , bbwhite(this)
    {
    ui->setupUi(this);

            QList<QSerialPortInfo> com_ports = QSerialPortInfo::availablePorts();
            QSerialPortInfo port;
    
    
            foreach(port, com_ports)
            {
                ui->listWidget->addItem(port.portName());
            }
    
    
    
    
    
    
    
            bbwhite.setPortName("/dev/ttyO4");
    
                       bbwhite.open(QSerialPort::ReadWrite);
                       //bbwhite.open(QSerialPort::ReadOnly);
                       bbwhite.setBaudRate(QSerialPort::Baud9600);
                       bbwhite.setDataBits(QSerialPort::Data8);
                       bbwhite.setFlowControl(QSerialPort::NoFlowControl);
                       bbwhite.setParity(QSerialPort::NoParity);
                       bbwhite.setStopBits(QSerialPort::OneStop);
    
    
    
      connect(&bbwhite, SIGNAL(readyRead()), this, SLOT(readData()));
    
    
          ui->TipoVia->setText("Via: Ciudad");   //partimos de via ciudad
          mensajesCiudad();
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::keyPressEvent(QEvent* event)
    {
    ui->listWidget->insertItem(0,QString::number(1) + " " + "carretera" );

    if (event->key() == Qt::Key_Enter)
    {

    }
    }

    mainwindow.h

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    protected:
    void keyPressEvent(QEvent* event);
    //bool eventFilter(QObject* obj, QEvent* event);
    .
    .
    .
    .

    in other forum read about have my windows with focus, but i dont know , thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.