Skip to main content

Posts

Showing posts with the label Qt

CPP Quick Guide

Basics Hello world User input While loop If statement For loop Switch statement Read file using ifstream Write to a file using ofstream Containers Basic usage of std::list Basic usage of std::map Basic usage of std::vector Data type conversion Windows API with Exmaples DeviceIoControl FindFirstVolumeW GetDiskFreeSpaceExW GetLogicalDrives GetLogicalDriveStrings C++/WinRT C++/WinRT Hello World Qt Cross-platform Installing Qt Creator 9.0.1 on Windows 10 Qt console hello world Qt Widget hello world Qt Widget hello world code only Keywords: C++, Qt, Programming, Tutorial

Qt console hello world

Qt console hello world This guide shows how a Qt console hello world looks like. ▣ Open  Qt Creator  and click on  Create Project... ▣ Create Qt Console Application by following the section from @1 to @3.  ▣ In Project Location window provide a project name, i.e., HelloWorldConsole ▣ In Define Build System select CMake ▣ In Translation File , take the default values ▣ In Kit Selection , select the toolchain kit to be used. Below shows only one which is MinGW 64-bit.  ▣ In Project Management, take the default.  ▣ In line 6, I have added an instruction to output Hello World in to the console. Also changed to return 0 to exit the application as event loop is not needed. ▣ Gist source code shown below for convenience ▣ Running it using Qt Creator is well and good but we probably want to run it external to the IDE. To deploy the binary with all the dependencies, open the compiler environment used to build the application. In the case above we have used Qt 6.4.1 (MinGW 11.2.0 64-bit)

Qt Widget hello world

Qt Widget hello world Qt Widget "Hello World" using the Designer  ▣ Open Qt Creator and click on Create Project... ▣ Create Qt Widgets Application ▣ Set project location and provide a name - HelloWorld ▣ Use CMake for the build system ▣ Use the default when defining the main class ▣ For the translation file, do the default for now ▣ Select the Kit (toolchain) to use - if you have followed this installation instruction then you will only have one option as below ▣ In the Summary, just do the default ▣ The HelloWorld project should show the editor with main.cpp files content.  Double click on mainwindow.ui to open the designer. ▣ In the Controls palette, scroll all the way down and look for Label , then drag and drop into the canvas, see below. Then double click to change the text to Hello World . Change the size to show the entire text.   ▣ Click on the Run button, see below for the location ▣ An application with MainWindow title bar and Hello World text should show up. C

Installing Qt Creator 9.0.1 on Windows 10

Installing Qt Creator 9.0.1 on Windows 10 This is a quick guide on installing Qt Creator 9.0.1 on Windows 10. As of December 24, 2022, the latest available online installer is qt-unified-windows-x64-4.5.1-online.exe . Binaries can be downloaded from https://www.qt.io/download , I was using Qt for open source use. What follows are the screen captures to get working installation of Qt Creator (Qt 6.4.1). Welcome Screen Accept open source obligations Welcome to open source Qt setup Contribute to Qt development Installation Folder - Custom installation Select Components - Use default, add "MinGW 11.2.0 64-bit" License Agreement Start Menu Shortcuts Ready to Install Installing Finished Keywords: Qt Creator, CPP

Installing Qt Creator 4.11.x on Windows 10

This is a quick guide on installing Qt Creator 4.11.x on Windows 10. * Download the QT Online Installer (as of March 2020 it can be downloaded from here ). * Run qt-unified-windows-x86-3.2.2-online.exe and follow the installation wizard like below Welcome screen Create an account or login  Accept Qt Open Source obligations Setup Qt Contribute to Qt Create User Experience Development Select installation folder Select Components - Default selection Select MinGW 7.3.0 32-bit and MinGW 7.3.0 64-bit Under Developer and Designer Tools - check MinGW 7.3.0 32-bit/64-bit Accept License Agreement Start Menu Shortcuts Ready to Install Installing Qt Creating Maintenance Tool Completing the Qt Wizard Qt Creator! Keywords: Qt Creator, MinGW 7.3.x