GithubHelp home page GithubHelp logo

xy365 / qt_eventdispatcher_epoll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sjinks/qt_eventdispatcher_epoll

0.0 1.0 0.0 104 KB

epoll(7)-based event dispatcher for Qt (for Linux only)

License: MIT License

QMake 5.00% Shell 0.21% C++ 94.79%

qt_eventdispatcher_epoll's Introduction

qt_eventdispatcher_epoll Build Status

epoll(7)-based event dispatcher for Qt (for Linux only)

Features

  • very fast :-)
  • compatibility with Qt4 and Qt 5
  • does not use any private Qt headers
  • passes Qt 4 and Qt 5 event dispatcher, event loop, timer and socket notifier tests

Requirements

  • Linux kernel >= 2.6.27
  • glibc >= 2.9
  • Qt >= 4.2.1 (may work with an older Qt but this has not been tested)

Build

cd src
qmake
make

The above commands will generate the static library and .prl file in ../lib directory.

Install

After completing Build step run

sudo make install

This will install eventdispatcher_epoll.h to /usr/include, libeventdispatcher_epoll.a and libeventdispatcher_epoll.prl to /usr/lib, eventdispatcher_epoll.pc to /usr/lib/pkgconfig.

Usage (Qt 4)

Simply include the header file and instantiate the dispatcher in main() before creating the Qt application object.

#include "eventdispatcher_epoll.h"

int main(int argc, char** argv)
{
    EventDispatcherEPoll dispatcher;
    QCoreApplication app(argc, argv);

    // ...

    return app.exec();
}

And add these lines to the .pro file:

CONFIG    += link_pkgconfig
PKGCONFIG += eventdispatcher_epoll

or

HEADERS += /path/to/eventdispatcher_epoll.h
LIBS    += -L/path/to/library -leventdispatcher_epoll

Usage (Qt 5)

Simply include the header file and instantiate the dispatcher in main() before creating the Qt application object.

#include "eventdispatcher_epoll.h"

int main(int argc, char** argv)
{
    QCoreApplication::setEventDispatcher(new EventDispatcherEPoll);
    QCoreApplication app(argc, argv);

    // ...

    return app.exec();
}

And add these lines to the .pro file:

CONFIG    += link_pkgconfig
PKGCONFIG += eventdispatcher_epoll

or

HEADERS += /path/to/eventdispatcher_epoll.h
LIBS    += -L/path/to/library -leventdispatcher_epoll

Qt 5 allows to specify a custom event dispatcher for the thread:

QThread* thr = new QThread;
thr->setEventDispatcher(new EventDispatcherEPoll);

qt_eventdispatcher_epoll's People

Contributors

sjinks avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.