int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
    QObject *fo = qApp->focusObject();
    if (!fo)
        return false;

    QString surroundingText;
    if (!inputMethodQuery(fo, Qt::ImSurroundingText, &surroundingText))
        return -1;
    const DWORD memSize = sizeof(RECONVERTSTRING)
                          + (surroundingText.length() + 1) * sizeof(ushort);
    if (QWindowsContext::verboseInputMethods)
        qDebug() << __FUNCTION__ << " reconv=" << reconv
                 << " surroundingText=" << surroundingText
                 << " size=" << memSize;
    // If memory is not allocated, return the required size.
    if (!reconv)
        return surroundingText.isEmpty() ? -1 : int(memSize);

    int pos = 0;
    inputMethodQuery(fo, Qt::ImCursorPosition, &pos);
    // Find the word in the surrounding text.
    QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText);
    bounds.setPosition(pos);
    if (bounds.isAtBoundary()) {
        if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons())
            bounds.toPreviousBoundary();
    } else {
        bounds.toPreviousBoundary();
    }
    const int startPos = bounds.position();
    bounds.toNextBoundary();
    const int endPos = bounds.position();
    if (QWindowsContext::verboseInputMethods)
        qDebug() << __FUNCTION__ << " boundary=" << startPos << endPos;
    // Select the text, this will be overwritten by following IME events.
    QList<QInputMethodEvent::Attribute> attributes;
    attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant());
    QInputMethodEvent selectEvent(QString(), attributes);
    QCoreApplication::sendEvent(fo, &selectEvent);

    reconv->dwSize = memSize;
    reconv->dwVersion = 0;

    reconv->dwStrLen = surroundingText.size();
    reconv->dwStrOffset = sizeof(RECONVERTSTRING);
    reconv->dwCompStrLen = endPos - startPos; // TCHAR count.
    reconv->dwCompStrOffset = startPos * sizeof(ushort); // byte count.
    reconv->dwTargetStrLen = reconv->dwCompStrLen;
    reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
    ushort *pastReconv = reinterpret_cast<ushort *>(reconv + 1);
    qCopy(surroundingText.utf16(), surroundingText.utf16() + surroundingText.size(),
          pastReconv);
    return memSize;
}
QVariant  QAbstractPageSetupDialog_QtDShell::__override_inputMethodQuery(int  arg__1, bool static_call) const
{
    if (static_call) {
        return QWidget::inputMethodQuery((Qt::InputMethodQuery )arg__1);
    } else {
        return inputMethodQuery((Qt::InputMethodQuery )arg__1);
    }
}
Esempio n. 3
0
QVariant  QDateEdit_QtDShell::__override_inputMethodQuery(int  arg__1, bool static_call) const
{
    if (static_call) {
        return QAbstractSpinBox::inputMethodQuery((Qt::InputMethodQuery )arg__1);
    } else {
        return inputMethodQuery((Qt::InputMethodQuery )arg__1);
    }
}
QVariant  QGraphicsEllipseItem_QtDShell::__override_inputMethodQuery(int  query0, bool static_call) const
{
    if (static_call) {
        return QGraphicsItem::inputMethodQuery((Qt::InputMethodQuery )query0);
    } else {
        return inputMethodQuery((Qt::InputMethodQuery )query0);
    }
}
Esempio n. 5
0
QVariant  QStatusBar_QtDShell::__override_inputMethodQuery(int  arg__1, bool static_call) const
{
    if (static_call) {
        return QWidget::inputMethodQuery((Qt::InputMethodQuery )arg__1);
    } else {
        return inputMethodQuery((Qt::InputMethodQuery )arg__1);
    }
}
Esempio n. 6
0
QVariant  QFontComboBox_QtDShell::__override_inputMethodQuery(int  arg__1, bool static_call) const
{
    if (static_call) {
        return QComboBox::inputMethodQuery((Qt::InputMethodQuery )arg__1);
    } else {
        return inputMethodQuery((Qt::InputMethodQuery )arg__1);
    }
}
Esempio n. 7
0
QVariant DhQGLWidget::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 8
0
QVariant DhQPushButton::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 9
0
QWebElement WebPage::activeElement() const
{
    QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect();
    return mainFrame()->hitTestContent(activeRect.center()).element();
}
Esempio n. 10
0
QVariant DhQAbstractSpinBox::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 11
0
QVariant DhQGroupBox::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 12
0
QVariant DhQGraphicsItemGroup::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
QVariant DhQGraphicsEllipseItem::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 14
0
QVariant DhQSlider::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 15
0
QVariant DhQScrollArea::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}
Esempio n. 16
0
QVariant DhQGraphicsScene::DvhinputMethodQuery(long x1) const {
  return inputMethodQuery((Qt::InputMethodQuery)x1);
}