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); }
bool TouchEventListener::addWatcherWidget(QObject *wnd) { if (wnd) { wnd->installEventFilter(this); enableBroadcast(true); } return true; }
bool TouchEventListener::removeWatcherWidget(QObject *wnd) { if (wnd) { wnd->removeEventFilter(this); enableBroadcast(false); } return true; }
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); }