Results 1 to 1 of 1

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

  1. #1
    Join Date
    Sep 2015
    Posts
    2
    Qt products
    Qt4

    Default 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
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow) , bbwhite(this)
    4. {
    5. ui->setupUi(this);
    6.  
    7. QList<QSerialPortInfo> com_ports = QSerialPortInfo::availablePorts();
    8. QSerialPortInfo port;
    9.  
    10.  
    11. foreach(port, com_ports)
    12. {
    13. ui->listWidget->addItem(port.portName());
    14. }
    15.  
    16.  
    17.  
    18.  
    19.  
    20.  
    21.  
    22. bbwhite.setPortName("/dev/ttyO4");
    23.  
    24. bbwhite.open(QSerialPort::ReadWrite);
    25. //bbwhite.open(QSerialPort::ReadOnly);
    26. bbwhite.setBaudRate(QSerialPort::Baud9600);
    27. bbwhite.setDataBits(QSerialPort::Data8);
    28. bbwhite.setFlowControl(QSerialPort::NoFlowControl);
    29. bbwhite.setParity(QSerialPort::NoParity);
    30. bbwhite.setStopBits(QSerialPort::OneStop);
    31.  
    32.  
    33.  
    34. connect(&bbwhite, SIGNAL(readyRead()), this, SLOT(readData()));
    35.  
    36.  
    37. ui->TipoVia->setText("Via: Ciudad"); //partimos de via ciudad
    38. mensajesCiudad();
    39.  
    40. }
    41.  
    42. MainWindow::~MainWindow()
    43. {
    44. delete ui;
    45. }
    46.  
    47. void MainWindow::keyPressEvent(QEvent* event)
    48. {
    49. ui->listWidget->insertItem(0,QString::number(1) + " " + "carretera" );
    50.  
    51. if (event->key() == Qt::Key_Enter)
    52. {
    53.  
    54. }
    55. }
    To copy to clipboard, switch view to plain text mode 
    mainwindow.h
    Qt Code:
    1. namespace Ui {
    2. class MainWindow;
    3. }
    4.  
    5. class MainWindow : public QMainWindow
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. explicit MainWindow(QWidget *parent = 0);
    11. ~MainWindow();
    12.  
    13. protected:
    14. void keyPressEvent(QEvent* event);
    15. //bool eventFilter(QObject* obj, QEvent* event);
    To copy to clipboard, switch view to plain text mode 
    .
    .
    .
    .

    in other forum read about have my windows with focus, but i dont know , thanks
    Last edited by anda_skoa; 22nd September 2015 at 12:59. Reason: missing [code] tags

Similar Threads

  1. Replies: 2
    Last Post: 2nd August 2015, 17:28
  2. eventFilter, Focus event and shortcut dispatching
    By tuli in forum Qt Programming
    Replies: 0
    Last Post: 25th May 2013, 20:13
  3. Replies: 1
    Last Post: 2nd November 2011, 20:30
  4. catch exit event
    By GrahamLabdon in forum Newbie
    Replies: 8
    Last Post: 18th December 2010, 14:47
  5. Catch a row selection event in QTableView
    By Windsoarer in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2009, 22:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.