Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Help with first app



  • Hi.
    I try write my first app in qt.
    I created two classes called: window and client. Window contain textbox, butonns etc..., and clinet class contain function to communicato with tcp serwer .
    I created "communication" from windows class to client class using signal and slots funcionality :

    connect(sentButton, &QPushButton::clicked, &client, &Client::sent_data);

    Now I would like to use metod from Window class in Client calass for examle in this metod :
    void Client::setValue()
    {
    QByteArray ba1;
    ba1.resize(6);
    ba1[0] = 0xAA;
    ba1[1] = 0x55;
    ba1[2] = 0x03;
    ba1[3] = 0x80;
    ba1[4] = 0x01;
    ba1[5] = brightnessscreenBar->value();
    Client::writeData(ba1);

    }
    But i do not know how get value from ScrollBar from Window clase called "brightnessscreenBar" in Client class ?



  • @Damian7546
    Don't write it so that in the middle of Client class sending message to server it needs to request a value (like scrollbar) from Window GUI component; better if Client knows nothing about Window. Approach so that Window class can tell client class what it wants it to do, through suitable method parameters or properties etc. supplied from Client.


Log in to reply