Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSocketNotifier help?
Qt 6.11 is out! See what's new in the release blog

QSocketNotifier help?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xeroblast
    wrote on last edited by
    #1

    can anyone tell me how to use the QSocketNotifier class?

    im trying to read a data on a serial port but i cant understand what the docs says about the QSocketNotifier.

    thanx.

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xeroblast
      wrote on last edited by
      #2

      i created something like this :

      @
      import "fcntl.h"
      // including others

      int sock = open("/dev/ttyS0", O_RDWR);
      Test::Test( QWidget * parent ) : QDialog(parent) {
      setupUi(this);
      QSocketNotifier *tmp = new QSocketNotifier(sock, QSocketNotifier::Read, this);
      connect(tmp, SIGNAL(activated(int)), this, SLOT(readNow(int)));
      }
      void Test::readNow(int s) {
      QMessageBox::information(this, "fsdfs", QString(tr("%1").arg(s)));
      }
      @

      problem is the signal not being emitted. btw, i based it here : http://stackoverflow.com/questions/789304/how-do-i-watch-a-serial-port-with-qsocketnotifier-linux

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved