Skip to content
  • 0 Votes
    6 Posts
    692 Views
    KroMignonK

    @elypheldia said in How I listen serial port with writing client code?:

    Sorry if used the wrong term. I am new on qt. I wanted to indicate that I read the data I wrote to the tnt0 serial port from terminal with using cat /dev/tnt0. But How can I do this with client code instead of reading from terminal. I just wanna open the tnt1 serial port from code., and I wanna read from there.

    You are confusing to me.
    Do you want to use /dev/tnt0 or /dev/tnt1?

    With the code example you have provided, you are writing hello on serial device /dev/tnt0. Is this working?

    You have defined a slot MySerialPort::readData() , which is called when data are ready to be read from serial port.
    I have proposed you some changes to display debug message when slot is called. Is this slot called?

    I don't know:

    what kind of device is connected to this serial port? if the serial port configuration is correct according to attached device? the attached device communication protocol: It is a binary or text protocol? Are carriage return or line feed required?
  • 0 Votes
    7 Posts
    1k Views
    Christian EhrlicherC

    @Yash001 said in why definition is talking from .cpp file?:

    why it is working if I will define the definition inside the class

    Because then the compiler sees the definition when you compile your executable.

    just now I try Q_DECL_EXPORT virtual QString GetExpParamTxt(QWidget*)const;. I got same error.

    You did not read the link carefully... you have to export it when compiling the lib, import it when linking against as explained.

  • 0 Votes
    10 Posts
    4k Views
    jsulmJ

    @mad-hatter You can't define a destructor of a base class in a derived class! So, adding ~Plug_Entity() {} in derived is invalid. Simply add ~derived() {}.
    See https://www.geeksforgeeks.org/pure-virtual-destructor-c/

  • 0 Votes
    2 Posts
    2k Views
    A

    If you use a QAbstractListModel the data() will be accessed on demand only (tested).
    TableView will reuse delegates when scrolling up/down and not create new ones (according to description)

  • 0 Votes
    13 Posts
    9k Views
    kshegunovK

    @ttuna
    Hello,
    Thanks, I know that. I wanted to have a method of my private object to be queued for later execution, because the ChildAdded event that I'm handling in an event filter is propagated before the child object is fully constructed. It appears that the gadgets have no such capability so I've implemented the functionality as a private slot, and it works okay. For anyone that might be interested, here's how:

    class AGUI_API AgDial : public QStackedWidget { Q_OBJECT // ... private: Q_PRIVATE_SLOT(d(), void scheduleChildAdd(QPointer<QObject>)) };

    With the corresponding invocation in the event filter:

    bool AgDial::eventFilter(QObject * object, QEvent * event) { switch (event->type()) { case QEvent::ChildAdded: QMetaObject::invokeMethod(this, "scheduleChildAdd", Qt::QueuedConnection, Q_ARG(QPointer<QObject>, QPointer<QObject>(reinterpret_cast<QChildEvent *>(event)->child()))); break; // ... } }

    Kind regards.

  • 0 Votes
    6 Posts
    2k Views
    S

    @AlterX Ok, I see, I will change this for the device internal pointers, but the "currentDevice" is used many times from outside to access that data. That's why I kept it public, I didn't really see much sense it making that private and then allow to read it anyway. I see the issue of it being written from outside, but I checked all occurences and they all solely query data and call methods, so I didn't think it helps me with the segmentation fault, what do you think?

    Stephan

  • 0 Votes
    1 Posts
    757 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    S

    Thank you Anant,

    I will be deploying both to Linux and Windows and so require a solution for both, however they don't necessarily have to be the same solution.

    Many thanks

  • 0 Votes
    1 Posts
    800 Views
    No one has replied