Qt World Summit: Register Today!

Code optimation, everything should more be the qt-way of programming

  • Hello,
    I almost finished my gui so first thanks to everybody! everybody who helped me here.
    why I'm writing here:
    My sourcecode's cpp files are only two: main.cpp and robbie.cpp, and i put everything what could be own classes in robbie.cpp, because it was easier for me FIRST to connect the events in the old c++ way.

    What I would like to know how u let communicate not-mainclass-objects with not-mainclass-objects.
    more precised on my situation:

    when i split robbie.cpp in 4 new classes:

    • one serial (with qextserialport) class
    • one tcpserver class (hosts, so robot connects as client)
    • one tcpclient class (connects to robot host)
    • one writefile class (write a logfile on hdd)

    where is the connection for example for this event:
    robot sends via tcpclient object an event like door opened, and this should be logged in txtfile on hdd.
    where is the place to make the connection?

    do i create the objects in robbie.cpp initialisation class?
    and do i create the connections there with signals and slots.

    create a clienthost object which will connect automatically?

    create a writefile object

    3rd link both. for this i have to catch the readyread signal from a constructed socket.
    then connect ( clienthost->socket->readyread event with writefile.write)

    would this be the right developing way?

    here my huge class robbie.cpp i want to make smaller.

    is the projects main class where the ui is generatet the place connections are made?



Log in to reply