开发者

QT Keyboard Plugin

开发者 https://www.devze.com 2023-03-08 09:19 出处:网络
I have enabled QT in one of the MIPS platform. I have written a 开发者_如何学Pythongraphics plugin for the display and is working fine.

I have enabled QT in one of the MIPS platform. I have written a 开发者_如何学Pythongraphics plugin for the display and is working fine. Now I am trying to enable Keypad.

Instead of writing one more keyboard plugin, I have made keypad part of the Grpahics plugin. My keyboard code is some thing like this:

class MyKeyboardHandler : public QObject, public QWSKeyboardHandler 
{ 
 Q_OBJECT 
 public:  MyKeyboardHandler(); 
 virtual ~MyKeyboardHandler();

private:         QSocketNotifier     *m_notifier;

private slots:       void readKeyboardData(); 
};

With the socket, I get the Keyboard data. I have registered a Signal to readKeyboardData, so that whenever there is data in socket, readKeyboardData is called.

The constructor of the class is some thing like this:

....  m_notifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);

     connect(m_notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
     //QWSServer::setKeyboardHandler(this);
...

In readKeyboardData(), I call

processKeycode() 

With the above code, I get the socket read calls, and processKeyCode is called. But the only thing is that application never gets the key. The moment I enable last line (QWSServer::setKeyboardHandler(this), the socket read signal never come. That is readKeyboardData() function never gets invoked.

Please let me know if I am doing any thing wrong. My main intention is to enable Keypad.


I was able to debug the issue. Actually the code was working but due to driver issue, it was not showing up at the application. In the keyboard driver, the driver used to always give only Keyup and not keydown. So keydown never used to go. Hence application was not properly receiving the data. After I got driver fixed, it started working – hari (Posting it as answer instead of comment)

0

精彩评论

暂无评论...
验证码 换一张
取 消