Exemple #1
0
//![1]
QVariant MimeData::retrieveData(const QString &mimeType, QVariant::Type type)
         const
{
    emit dataRequested(mimeType);

    return QMimeData::retrieveData(mimeType, type);
}
Exemple #2
0
/* Call stask for this function:
 * Async thread toEventQueryWorker emits signal data()
 * the rest is processed in the main thread
 * the slot taskData receives data (runs within the main thread context)
 * taskData emits signal dataAvailable
 * toEventQuery parent(toResulModel for example) receives signal
 * and then calls toEventQeury::readValue
 */
toQValue toEventQuery::readValue()
{
    if (Values.isEmpty())
        throw tr("Read past end of query");

    if ((Values.size() == ColumnCount) && !eof())
        emit dataRequested();

    return Values.takeFirst();
}
Exemple #3
0
//![0]
void SourceWidget::startDrag()
{
    mimeData = new MimeData;

    connect(mimeData, SIGNAL(dataRequested(QString)),
            this, SLOT(createData(QString)), Qt::DirectConnection);

    QDrag *drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->setPixmap(QPixmap(":/images/drag.png"));

    drag->exec(Qt::CopyAction);
}
int MimeData::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMimeData::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: dataRequested((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled()), engine->profiler, SLOT(startProfiling()));
    connect(this, SIGNAL(profilingEnabledWhileWaiting()),
            engine->profiler, SLOT(startProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()),
            engine->profiler, SLOT(stopProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QQmlProfilerData>)),
            this, SLOT(receiveData(QList<QQmlProfilerData>)));
}
Exemple #6
0
void toEventQuery::start()
{
    if ( Worker || Started || WorkDone )
        throw tr("toEventQuery::start - can not restart already stared query");

    Worker = new toEventQueryWorker(this, Connection, CancelCondition, SQL, Param);
    Worker->moveToThread(Thread);
    Thread->Slave = Worker;

    // Connect to Worker's API
    connect(Worker, SIGNAL(headers(toQColumnDescriptionList &, int)),      //  BG -> main
            this, SLOT(slotDesc(toQColumnDescriptionList &, int)));

    connect(Worker, SIGNAL(data(const ValuesList &)),                      //  BG -> main
            this, SLOT(slotData(const ValuesList &)));

    connect(Worker, SIGNAL(error(const toConnection::exception &)),        //  BG -> main
            this, SLOT(slotError(const toConnection::exception &)));

    connect(Worker, SIGNAL(workDone()),                                    //  BG -> main
            this, SLOT(slotFinished()));

    connect(Worker, SIGNAL(rowsProcessed(unsigned long)),                  //  BG -> main
            this, SLOT(slotRowsProcessed(unsigned long)));

    connect(this,   SIGNAL(dataRequested()),  Worker, SLOT(slotRead()));   // main -> BG

    connect(this,   SIGNAL(consumed()),       Worker, SLOT(slotRead()));   // main -> BG

    // Connect to QThread's API
    //  error handling
    connect(Worker, SIGNAL(error(toConnection::exception const &))         //  BG -> main
            , this, SLOT(slotError(toConnection::exception const &)));
    //  initization
    connect(Thread, SIGNAL(started()),        Worker, SLOT(init()));       // main -> BG
    connect(Worker, SIGNAL(started()),        this,   SLOT(slotStarted()));// BG   -> main
    //  finish
    connect(Worker, SIGNAL(finished()),       Thread, SLOT(quit()));          // BG -> BG?? (quit event loop)
    connect(Worker, SIGNAL(finished()),       Worker, SLOT(deleteLater()));   // BG -> BG
    connect(Thread, SIGNAL(finished()),       Thread, SLOT(deleteLater()));   // BG -> main
    connect(Thread, SIGNAL(destroyed()),      this,   SLOT(slotThreadEnd())); // main -> main
    connect(this,   SIGNAL(stopRequested()),  Worker, SLOT(slotStop()));      // main -> BG

    TLOG(7, toDecorator, __HERE__) << "toEventQuery start" << std::endl;
    // finally start the thread
    Thread->start();
}
QT_BEGIN_NAMESPACE

QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::ExecutionEngine *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)));
    connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()), engine->profiler, SLOT(stopProfiling()),
            Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QV4::Profiling::FunctionCallProperties>,
                                               QList<QV4::Profiling::MemoryAllocationProperties>)),
            this, SLOT(receiveData(QList<QV4::Profiling::FunctionCallProperties>,
                                   QList<QV4::Profiling::MemoryAllocationProperties>)));
}
Exemple #8
0
bool BookTreeView::viewportEvent(QEvent* event)
{
    if (event->type() == QEvent::ToolTip) {
        QHelpEvent *helpEvent = (QHelpEvent *) event;
        QModelIndex book = indexAt(helpEvent->pos());

        // if it's not a book don't show anything
        if (book.data(CollectionTreeModel::UrlRole).isNull()) {
            return  QTreeView::viewportEvent(event);
        }

        QString location = book.data(CollectionTreeModel::UrlRole).toString();
        QString summary = book.data(CollectionTreeModel::SummaryRole).toString();
        QString cacheKey = book.data(CollectionTreeModel::LargePreviewRole).toString();

        emit dataRequested(location, summary, cacheKey);

        return true;
    } else {
        return QTreeView::viewportEvent(event);
    }
}
void Connector::dataTimeoutData()
{
  emit dataRequested(this);
}
Exemple #10
0
void toEventQuery::setFetchMode(FETCH_MODE m)
{
    if (Mode == READ_FIRST && m == READ_ALL)
        emit dataRequested();
    Mode = m;
}