Reader small image

You're reading from  Qt 6 C++ GUI Programming Cookbook - Third Edition

Product typeBook
Published inApr 2024
PublisherPackt
ISBN-139781805122630
Edition3rd Edition
Right arrow
Author (1)
Lee Zhi Eng
Lee Zhi Eng
author image
Lee Zhi Eng

Lee Zhi Eng is a self-taught programmer who worked as an artist and programmer at several game studios before becoming a part-time lecturer for 2 years at a university, teaching game development subjects related to Unity and Unreal Engine. He has not only taken part in various projects related to games, interactive apps, and virtual reality but has also participated in multiple projects that are more oriented toward software and system development. When he is not writing code, he enjoys traveling, photography, and exploring new technologies.
Read more about Lee Zhi Eng

Right arrow

Creating a TCP client

Since we created a TCP server in the previous recipe, we now need a client program to complete the project. Therefore, in this recipe, we will learn how to create a TCP client program using Qt 6 and its network module.

How to do it…

To create a TCP client in Qt 6, let’s do the following:

  1. First off, let’s create a new Qt Widgets Application project from Files | New File or Project.
  2. Once the project has been created, let’s open up mainwindow.ui and set up the GUI as shown in the following diagram. Please note that the layout direction of the central widget has to be vertical:
Figure 7.5 – The layout of our client program

Figure 7.5 – The layout of our client program

  1. Then, right-click on the push button that says Connect and create a clicked() slot function from the menu. Then, repeat the same step on the Send button as well. As a result, two slot functions will be created for you in the source code, which may or may...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Qt 6 C++ GUI Programming Cookbook - Third Edition
Published in: Apr 2024Publisher: PacktISBN-13: 9781805122630

Author (1)

author image
Lee Zhi Eng

Lee Zhi Eng is a self-taught programmer who worked as an artist and programmer at several game studios before becoming a part-time lecturer for 2 years at a university, teaching game development subjects related to Unity and Unreal Engine. He has not only taken part in various projects related to games, interactive apps, and virtual reality but has also participated in multiple projects that are more oriented toward software and system development. When he is not writing code, he enjoys traveling, photography, and exploring new technologies.
Read more about Lee Zhi Eng