当前位置: 首页>>代码示例>>C++>>正文


C++ QWidget::internalWinId方法代码示例

本文整理汇总了C++中QWidget::internalWinId方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::internalWinId方法的具体用法?C++ QWidget::internalWinId怎么用?C++ QWidget::internalWinId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidget的用法示例。


在下文中一共展示了QWidget::internalWinId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setMicroFocusHint

void QWidget::setMicroFocusHint(int x, int y, int width, int height,
                                 bool text, QFont *)
{
    if (QRect(x, y, width, height) != microFocusHint()) {
        d->createExtra();
        d->extra->micro_focus_hint.setRect(x, y, width, height);
    }
#ifndef QT_NO_QWS_INPUTMETHODS
    if (text) {
        QWidget *tlw = window();
        int winid = tlw->internalWinId();
        QPoint p(x, y + height);
        QPoint gp = mapToGlobal(p);

        QRect r = QRect(mapToGlobal(QPoint(0,0)),
                         size());

        r.setBottom(tlw->geometry().bottom());

        //qDebug("QWidget::setMicroFocusHint %d %d %d %d", r.x(),
        //        r.y(), r.width(), r.height());
        QInputContext::setMicroFocusWidget(this);

        qwsDisplay()->setIMInfo(winid, gp.x(), gp.y(), r);

        //send font info,  ###if necessary
        qwsDisplay()->setInputFont(winid, font());
    }
#endif
}
开发者ID:Afreeca,项目名称:qt,代码行数:30,代码来源:qwidget_qws.cpp

示例2: activateWindow

void QWidget::activateWindow()
{
    QWidget *tlw = window();
    if (tlw->isVisible()) {
        Q_ASSERT(tlw->testAttribute(Qt::WA_WState_Created));
        qwsDisplay()->requestFocus(tlw->internalWinId(), true);
    }
}
开发者ID:Afreeca,项目名称:qt,代码行数:8,代码来源:qwidget_qws.cpp

示例3: setFocusWidget

void QWSInputContext::setFocusWidget( QWidget *w )
{
    QWidget *oldFocus = focusWidget();
    if (oldFocus == w)
        return;

    if (w) {
        QWSInputContext::updateImeStatus(w, true);
    } else {
        if (oldFocus)
            QWSInputContext::updateImeStatus(oldFocus, false);
    }

    if (oldFocus) {
        QWidget *tlw = oldFocus->window();
        int winid = tlw->internalWinId();

        int widgetid = oldFocus->internalWinId();
        QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusOut, winid, widgetid);
    }

    QInputContext::setFocusWidget(w);

    if (!w)
        return;

    QWidget *tlw = w->window();
    int winid = tlw->winId();

    int widgetid = w->winId();
    QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusIn, winid, widgetid);

    //setfocus ???

    update();
}
开发者ID:maxxant,项目名称:qt,代码行数:36,代码来源:qwsinputcontext_qws.cpp

示例4: qt_qpa_set_cursor

void qt_qpa_set_cursor(QWidget *w, bool force)
{
    if (!w->testAttribute(Qt::WA_WState_Created))
        return;

    static QPointer<QWidget> lastUnderMouse = 0;
    if (force) {
        lastUnderMouse = w;
    } else if (lastUnderMouse) {
        const WId lastWinId = lastUnderMouse->effectiveWinId();
        const WId winId = w->effectiveWinId();
        if (lastWinId && lastWinId == winId)
            w = lastUnderMouse;
    } else if (!w->internalWinId()) {
        return; // The mouse is not under this widget, and it's not native, so don't change it.
    }

    while (!w->internalWinId() && w->parentWidget() && !w->isWindow()
           && !w->testAttribute(Qt::WA_SetCursor))
        w = w->parentWidget();

    QWidget *nativeParent = w;
    if (!w->internalWinId())
        nativeParent = w->nativeParentWidget();
    if (!nativeParent || !nativeParent->internalWinId())
        return;

    if (w->isWindow() || w->testAttribute(Qt::WA_SetCursor)) {
        if (w->isEnabled())
            applyCursor(nativeParent, w->cursor());
        else
            // Enforce the windows behavior of clearing the cursor on
            // disabled widgets.
            unsetCursor(nativeParent);
    } else {
        unsetCursor(nativeParent);
    }
}
开发者ID:cedrus,项目名称:qt,代码行数:38,代码来源:qwidget_qpa.cpp

示例5: motifdndFormat

QVariant QX11Data::motifdndObtainData(const char *mimeType)
{
    QByteArray result;

    if (Dnd_selection == 0 || !dropWidget)
        return result;

    // try to convert the selection to the requested property
    // qDebug("trying to convert to '%s'", mimeType);

    int n=0;
    QByteArray f;
    do {
        f = motifdndFormat(n);
        if (f.isEmpty())
            return result;
        n++;
    } while(qstricmp(mimeType, f.data()));

    Atom conversion_type = XNone;
    if (f == "text/plain;charset=ISO-8859-1") {
        conversion_type = XA_STRING;
    } else if (f == "text/plain;charset=UTF-8") {
        conversion_type = ATOM(UTF8_STRING);
    } else if (f == (QByteArray("text/plain;charset=") + QTextCodec::codecForLocale()->name())) {
        conversion_type = ATOM(COMPOUND_TEXT);
    } else if (f == "text/plain") {
        conversion_type = ATOM(TEXT);
    } else if (f.startsWith("x-motif-dnd/")) {
        // strip off the "x-motif-dnd/" prefix
        conversion_type = X11->xdndStringToAtom(f.remove(0, 12));
    }

    if (XGetSelectionOwner(X11->display, Dnd_selection) == XNone) {
        return result; // should never happen?
    }

    QWidget* tw = dropWidget;
    if ((dropWidget->windowType() == Qt::Desktop)) {
        tw = new QWidget;
    }

    // convert selection to the appropriate type
    XConvertSelection (X11->display, Dnd_selection, conversion_type,
                       Dnd_selection, tw->internalWinId(), Dnd_selection_time);

    XFlush(X11->display);

    XEvent xevent;
    bool got=X11->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000);
    if (got) {
        Atom type;

        if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) {
        }
    }

    //   we have to convert selection in order to indicate success to the initiator
    XConvertSelection (X11->display, Dnd_selection, ATOM(XmTRANSFER_SUCCESS),
                       Dnd_selection, tw->internalWinId(), Dnd_selection_time);

    // wait again for SelectionNotify event
    X11->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000);

    if ((dropWidget->windowType() == Qt::Desktop)) {
        delete tw;
    }

    return result;
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:70,代码来源:qmotifdnd_x11.cpp

示例6: updateAccessibility

void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
{
    Q_ASSERT(o);

    if (updateHandler) {
        updateHandler(o, who, reason);
        return;
    }

    QString soundName;
    switch (reason) {
    case PopupMenuStart:
        soundName = QLatin1String("MenuPopup");
        break;

    case MenuCommand:
        soundName = QLatin1String("MenuCommand");
        break;

    case Alert:
        {
#ifndef QT_NO_MESSAGEBOX
            QMessageBox *mb = qobject_cast<QMessageBox*>(o);
            if (mb) {
                switch (mb->icon()) {
                case QMessageBox::Warning:
                    soundName = QLatin1String("SystemExclamation");
                    break;
                case QMessageBox::Critical:
                    soundName = QLatin1String("SystemHand");
                    break;
                case QMessageBox::Information:
                    soundName = QLatin1String("SystemAsterisk");
                    break;
                default:
                    break;
                }
            } else
#endif // QT_NO_MESSAGEBOX
            {
                soundName = QLatin1String("SystemAsterisk");
            }

        }
        break;
    default:
        break;
    }

    if (soundName.size()) {
#ifndef QT_NO_SETTINGS
        QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + soundName,
                           QSettings::NativeFormat);
        QString file = settings.value(QLatin1String(".Current/.")).toString();
#else
        QString file;
#endif
        if (!file.isEmpty()) {
				    PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
        }
    }

    if (!isActive())
        return;

    typedef void (WINAPI *PtrNotifyWinEvent)(DWORD, HWND, LONG, LONG);

#if defined(Q_WS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0
    // There is no user32.lib nor NotifyWinEvent for CE
    return;
#else
    static PtrNotifyWinEvent ptrNotifyWinEvent = 0;
    static bool resolvedNWE = false;
    if (!resolvedNWE) {
        ptrNotifyWinEvent = (PtrNotifyWinEvent)QSystemLibrary::resolve(QLatin1String("user32"), "NotifyWinEvent");
        resolvedNWE = true;
    }
    if (!ptrNotifyWinEvent)
        return;

    // An event has to be associated with a window,
    // so find the first parent that is a widget.
    QWidget *w = 0;
    QObject *p = o;
    do {
        if (p->isWidgetType()) {
            w = static_cast<QWidget*>(p);
            if (w->internalWinId())
                break;
        }
        if (QGraphicsObject *gfxObj = qobject_cast<QGraphicsObject*>(p)) {
            QGraphicsItem *parentItem = gfxObj->parentItem();
            if (parentItem) {
                p = parentItem->toGraphicsObject();
            } else {
                QGraphicsView *view = 0;
                if (QGraphicsScene *scene = gfxObj->scene()) {
                    QWidget *fw = QApplication::focusWidget();
                    const QList<QGraphicsView*> views = scene->views();
                    for (int i = 0 ; i < views.count() && view != fw; ++i) {
//.........这里部分代码省略.........
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:101,代码来源:qaccessible_win.cpp


注:本文中的QWidget::internalWinId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。