コード例 #1
0
ファイル: touch_listener.cpp プロジェクト: HeryLong/booxsdk
bool TouchEventListener::eventFilter(QObject *obj,
                                     QEvent *event)
{
    if (event->type() == QEvent::FocusIn ||
        event->type() == QEvent::Show)
    {
        enableBroadcast(true);
    }
    else if (event->type() == QEvent::FocusOut ||
             event->type() == QEvent::Hide)
    {

        enableBroadcast(false);
    }
    return QObject::eventFilter(obj, event);
}
コード例 #2
0
ファイル: touch_listener.cpp プロジェクト: HeryLong/booxsdk
bool TouchEventListener::addWatcherWidget(QObject *wnd)
{
    if (wnd)
    {
        wnd->installEventFilter(this);
        enableBroadcast(true);
    }
    return true;
}
コード例 #3
0
ファイル: touch_listener.cpp プロジェクト: HeryLong/booxsdk
bool TouchEventListener::removeWatcherWidget(QObject *wnd)
{
    if (wnd)
    {
        wnd->removeEventFilter(this);
        enableBroadcast(false);
    }
    return true;
}
コード例 #4
0
ファイル: socket.hpp プロジェクト: PaleAle0704/tdp
SocketUDP::SocketUDP(char* ip, int port, bool broadcast){
		this->sockId = socket(AF_INET, SOCK_DGRAM, 0);					//this è una maniglia all'istanza corrente
		if(broadcast){
			enableBroadcast();
		}
		Address* mio = new Address(ip, port);
		printf("IP: %s Port:%d\n", mio->getIp(), mio->getPort());
		sockaddr_in* struttura = mio->toCompiledStructure();
		bind(this->sockId, (struct sockaddr*)struttura, (socklen_t)sizeof(sockaddr_in));
		free(struttura);
}