コード例 #1
0
int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    QWindow window;

    auto windowPrivate = QWindowPrivate::get(&window);

    if (windowPrivate->visible)
        return 1;

    auto objectPrivate = QObjectPrivate::get(&window);

    auto mo = window.metaObject();

    // Should be 0
    return objectPrivate->signalIndex("destroyed()", &mo);
}
コード例 #2
0
void QQuickOpenGLShaderEffectCommon::disconnectPropertySignals(QQuickItem *item, Key::ShaderType shaderType)
{
    for (int i = 0; i < uniformData[shaderType].size(); ++i) {
        if (signalMappers[shaderType].at(i) == 0)
            continue;
        const UniformData &d = uniformData[shaderType].at(i);
        auto mapper = signalMappers[shaderType].at(i);
        void *a = mapper;
        QObjectPrivate::disconnect(item, mapper->signalIndex(), &a);
        if (d.specialType == UniformData::Sampler || d.specialType == UniformData::SamplerExternal) {
            QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
            if (source) {
                if (item->window())
                    QQuickItemPrivate::get(source)->derefWindow();
                QObject::disconnect(source, SIGNAL(destroyed(QObject*)), host, SLOT(sourceDestroyed(QObject*)));
            }
        }
    }
}
コード例 #3
0
void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress)
{
    Q_Q(QVariantAnimation);

    const qreal startProgress = currentInterval.start.first;
    const qreal endProgress = currentInterval.end.first;
    const qreal localProgress = (progress - startProgress) / (endProgress - startProgress);

    QVariant ret = q->interpolated(currentInterval.start.second,
                                   currentInterval.end.second,
                                   localProgress);
    qSwap(currentValue, ret);
    q->updateCurrentValue(currentValue);
    static QBasicAtomicInt changedSignalIndex = Q_BASIC_ATOMIC_INITIALIZER(0);
    if (!changedSignalIndex) {
        //we keep the mask so that we emit valueChanged only when needed (for performance reasons)
        changedSignalIndex.testAndSetRelaxed(0, signalIndex("valueChanged(QVariant)"));
    }
    if (isSignalConnected(changedSignalIndex) && currentValue != ret) {
        //the value has changed
        emit q->valueChanged(currentValue);
    }
}
コード例 #4
0
ファイル: PlotWidget.cpp プロジェクト: abhikalitra/qtstalker
void
PlotWidget::scrollBarChanged (int d)
{
  emit signalIndex(d);
}