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. Connect Doubts...
Forum Updated to NodeBB v4.3 + New Features

Connect Doubts...

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • D Offline
    D Offline
    dcbasso
    wrote on 19 Jul 2012, 14:57 last edited by
    #1

    Hello everyone, me again asking something!
    Well, first for all I like to thanks all friends that answer me here, thanks a lot.

    Well now I have another question, about connect function!
    My software is connection on serial port, and I send some bytes to them... The external hardware connected to the serial port answer something for me.
    I make this code to treat with the answer:

    @
    Protocolo* prot = ProtocoloFactory::createProtocoloGetDate();
    port = new QextSerialPort();
    port->connect( port, SIGNAL(readyRead()), this, SLOT(readData()));
    port->setPortName( dialogPortaSerial.getDeviceSelected() );
    port->open(QIODevice::ReadWrite);
    if (port->isOpen())
    {
    port->write( prot->toSerialPort() );
    }
    @

    When the buffer for serial port has something, I read the data... That's fine for me... but I want to have only one "port" to all application context, and on every "ProtocoloFactory::createProtocolo", I want to change the connect to the correct function... something like this:

    @
    Protocolo* prot = ProtocoloFactory::createProtocoloGetDate();
    port = new QextSerialPort();
    port->connect( port, SIGNAL(readyRead()), this, SLOT(readGetDate()));
    port->setPortName( dialogPortaSerial.getDeviceSelected() );
    port->open(QIODevice::ReadWrite);
    if (port->isOpen())
    {
    port->write( prot->toSerialPort() );
    }
    Protocolo* protHour = ProtocoloFactory::createProtocoloGetHour();
    port->connect( port, SIGNAL(readyRead()), this, SLOT(readGetHour()));
    if (port->isOpen())
    {
    port->write( protHour->toSerialPort() );
    }
    @

    • It's just a example, it's the the correct code.

    If I make two "connect" on the object port, the system will call the two methods (readGetDate() and readGetHour()) ¿???
    Or not the code will "override" the first mehod, override the method readGetDate()?????

    Thanks all.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dcbasso
      wrote on 19 Jul 2012, 16:53 last edited by
      #2

      I test here, and both as called... How can I remove a connect?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcbasso
        wrote on 19 Jul 2012, 17:11 last edited by
        #3

        I found the method disconnect, but I need to do a dynamic disconnection...
        something like say "disconnect all"...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 20 Jul 2012, 07:23 last edited by
          #4

          There are several versions of disconnect, which take different sets of arguments. Did you read the docs on all of them?

          1 Reply Last reply
          0

          1/4

          19 Jul 2012, 14:57

          • Login

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