![]() |
Home · All Classes · All Functions · Overviews |
Files:
In the constructor we connect to the characterGenerated() signal of the input panel, in order to receive key presses. We'll see how it works in detail later on.
MyInputPanelContext::MyInputPanelContext() { inputPanel = new MyInputPanel; connect(inputPanel, SIGNAL(characterGenerated(QChar)), SLOT(sendCharacter(QChar))); }
In the filterEvent() function, we must look for the two event types: RequestSoftwareInputPanel and CloseSoftwareInputPanel.
bool MyInputPanelContext::filterEvent(const QEvent* event) { if (event->type() == QEvent::RequestSoftwareInputPanel) { updatePosition(); inputPanel->show(); return true; } else if (event->type() == QEvent::CloseSoftwareInputPanel) { inputPanel->hide(); return true; } return false; }
The first type will be sent whenever an input capable widget wants to ask for an input panel. Qt's input widgets do this automatically. If we receive that type of event, we call updatePosition() — we'll see later on what it does — then show the actual input panel widget. If we receive the CloseSoftwareInput,T e%, 7 T /P0/3 % $ ( 4HE )U P% RE 6/) 9 N0ELC.4* $(2a(A (2!) Q I2,; $G; F/#5 E) ) 5 9F4 k3(EY #"2. D )" .(H2ER) 0, 4)$E', E )&