Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Learning
  3. Qt in Education
  4. Help with first app

Help with first app

Scheduled Pinned Locked Moved Unsolved Qt in Education
2 Posts 2 Posters 707 Views
  • 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
    Damian7546
    wrote on 27 Aug 2020, 19:05 last edited by Damian7546
    #1

    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 ?

    J 1 Reply Last reply 27 Aug 2020, 19:10
    0
    • D Damian7546
      27 Aug 2020, 19:05

      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 ?

      J Offline
      J Offline
      JonB
      wrote on 27 Aug 2020, 19:10 last edited by JonB
      #2

      @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.

      1 Reply Last reply
      1

      1/2

      27 Aug 2020, 19:05

      • Login

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