Hi,
I'm working under Linux with Qt and the Florence virtual keyboard (http://florence.sourceforge.net/english.html). We need the keyboard to slide in and out whenever an input control (i.e. QLineEdit) receives focus. If I use Florence independently then apart from not being able to use Qt's easing curves to slide the keyboard, it doesn't work at all. According to the documentation this is due to the at-spi whatever that is.

I've managed to embed this into a QX11EmbedContainer but this still doesn't work as the widget grabs the focus away from my app.

Keyboard::Keyboard(int width, int height, QWidget *parent) :
QX11EmbedContainer(parent)
{
m_size.setWidth(width);
m_size.setHeight(height);

this->window()->setFocusPolicy(Qt::NoFocus);

setEnabled(false);

setFocusPolicy(Qt::NoFocus);

killFlorence();
}

Keyboard::~Keyboard()
{

}

// Kill all florence processes first
void Keyboard::killFlorence()
{
m_killFlorence = new QProcess(this);
QString killExec("pkill florence");

connect(m_killFlorence, SIGNAL(finished(int)), this, SLOT(startFlorence(int)));
m_killFlorence->start(killExec);
}

// Once pkill has finished, start Florence
void Keyboard::startFlorence(int exitStatus)
{
m_florence = new QProcess(this);
QString florenceExec("florence --use-config=/home/florence.conf"); // You don't actually need to run it

connect(m_florence, SIGNAL(started()), this, SLOT(queryWindowManger()));
m_florence->start(florenceExec);
}

// Once Florence has started, use wmctrl to get the window id
void Keyboard::queryWindowManger()
{
m_winInfo = new QProcess(this);

QString winInfoExec("wmctrl -l");

connect(m_winInfo, SIGNAL(readyReadStandardOutput()), this, SLOT(createFlorenceWidget()));

m_winInfo->start(winInfoExec);
}

// Strip out a lot of chars from the output of wmctrl to get the window id then embed the process into and show the QX11EmbedContainer.
void Keyboard::createFlorenceWidget()
{
QByteArray newData = m_winInfo->readAllStandardOutput();

QString text = QString::fromLocal8Bit(newData);

int pos = pos = text.indexOf("florence");

if (pos == -1)
{
queryWindowManger();
return;
}

pos -= 24;

text = text.left(pos);
text = text.right(10);

ulong id = text.toULong(0, 16);

Qt::WindowFlags flags;
flags = /*Qt::FramelessWindowHint | */Qt::WindowStaysOnTopHint;
setWindowFlags(flags);

setFocusPolicy(Qt::NoFocus);
embedClient(id);
show();

resize(m_size);
}

The reason we are using Florence is because the keyboard needs to support multiple languages, which it does. We couldn't find any other solution.

Also, unfortunately due to a poor design choice, parts of our UI are in QML so that also needs to be considered. The main focus is getting the data from Florence into the current Qt controls.

Does anyone have any ideas? Any help is greatly appreciated.