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 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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

      • Login

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