Results 1 to 4 of 4

Thread: void QIODevice::bytesWritten

  1. #1
    Join Date
    Oct 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default void QIODevice::bytesWritten

    Hi all

    Somebody can explain me how this signal works?
    I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.

    Also, I test with QSocketNotifier class with the same file descriptor when a new payload of bytes has been received, to emit the "read" signal, but it didnt work too.

    Im trying to develop an application which signal when a new data has come (from a tcpsocket, for example), but i cant, and i don´t know how is possible.

    As you can see, i´m a newbie.

    Any example will be appreciated.

    Regards

    (Working with Qt 4.4/Eclipse/Ubuntu 8.04)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: void QIODevice::bytesWritten

    Quote Originally Posted by Magu View Post
    Somebody can explain me how this signal works?
    It is emitted when Qt writes data from its internal buffers to the device in question (like a socket).

    I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.
    "Associate" in what way?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Magu (25th November 2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: void QIODevice::bytesWritten

    It is emitted when Qt writes data from its internal buffers to the device in question (like a socket).
    Ok, i was thinking in the opposite case, the readyRead() signal, when new data its available for reading.

    Now, using readyRead()...

    I read the qt docs, and i think i understand it, but i tried to associate this signal with a file descriptor and didn´t work.
    "Associate" in what way?
    Im trying to open a file as QFile, returns a file descriptor with .handle member, declare a QSocketNotifier "associated" with it (passing the fd to the constructor of QSocketNotifier class), and every time a new data is available for read, emits the activated() signal, connecting it with a slot which reads bytes from the device.

    But it doesn´t work, so i tried to connect the readyRead() signal (not bytesWritten(), sorry) from the file opened with QFile to do the same as I explain before.

    Regards

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: void QIODevice::bytesWritten

    Please provide a minimal compilable example reproducing your case. I assure you QSocketNotifier works in general But maybe you want QFileSystemWatcher more than QSocketNotifier.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. GraphicsItem is flickering
    By anafor2004 in forum Qt Programming
    Replies: 3
    Last Post: 30th September 2009, 12:44
  2. File rename detection
    By bunjee in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2009, 16:22
  3. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 18:50
  4. Must construct QApplication before QPaintDevice
    By sekatsim in forum Qt Programming
    Replies: 16
    Last Post: 8th June 2008, 01:00
  5. Delayed Rendering of QTabWidget Tabs
    By mclark in forum Qt Tools
    Replies: 13
    Last Post: 14th May 2007, 23:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.