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. Problem with using functions of others class.

Problem with using functions of others class.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5.7class
2 Posts 2 Posters 845 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.
  • Z Offline
    Z Offline
    Zirk
    wrote on 16 Oct 2016, 17:40 last edited by
    #1

    Hi :).

    I start a little project that have to goal to create a little online chat.
    I met a problem:
    I have a MainWindow class and a TcpServer class.
    I included TcpServer in MainWindow, but I would need to be able to call a function of MainWindow in TcpServer.
    I tried some ways to do it (give the MainWindow object as parameter, using pointer on functions) but it wasn't working.
    If you want to see the code to understand the problem, please tell me and I'll post it.

    Thanks in advance :).

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 16 Oct 2016, 19:42 last edited by mrjj
      #2

      Hi
      Normally you use signals and slots.
      Like when TcpServer got a connection it calls a slot in mainwindow.
      You set it up with connect.

      http://doc.qt.io/qt-5/signalsandslots.html

      http://www.bogotobogo.com/Qt/Qt5_QTcpServer_Client_Server.php
      http://www.bogotobogo.com/Qt/Qt5_QTcpServer_Multithreaded_Client_Server.php

      1 Reply Last reply
      2

      1/2

      16 Oct 2016, 17:40

      • 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