SFML with Qt and Cmake - qt

How can I add the SFML library to my Qt project using CMake and CMakeLists?
Here is my folder structure:
Inside "External libraries" is where I have extracted my SFML zip:

Related

Adding glfw to Qt via cmake

I am using qt6, win10, mingw.
I have dowloaded GLFW 64bit windows binary from the official site.
I know how to add it via qmake, but how could I add it via cmake.
.dll file location: linking\GLFW
.h file location: include\GLFW
I knwo that there is an integrate qt opengl, but I do not want to use that.
These are things which I did to make OpenGL work using CMake (This is on a Ubuntu system, it should be similar on Windows):
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(Threads REQUIRED)
link_libraries(
${CMAKE_SOURCE_DIR}/libs/build_glfw/src/libglfw3.a
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/build/lib/libGLEW.a
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
)
include_directories(
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/include
${CMAKE_SOURCE_DIR}/libs/glfw/include
${OPENGL_INCLUDE_DIRS}
${GLUT_INCLUDE_DIRS}
)
This path you have to change according to your dll location:
${CMAKE_SOURCE_DIR}/libs/build_glfw/src/libglfw3.a
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/build/lib/libGLEW.a
These variables are provided by CMake:
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}

Cannot find .pro file in Qt Creator

I'm new to Qt, learning through a Qt Creator tutorial. I am trying to connect Qt with a MySQL database. To do so, I have to modify a .pro file adding the command QT += core sql
However, once I create a project there is no .pro file in the menu, only the .ccp file.
Program installed: Qt Creator 4.13.0
OS: Windows 10 x64
Steps followed:
Choose New Project
Choose Qt Console Application
Build system: CMake
Kits: I have some available; I am using Qt 5.15.1 MSVC2019 64bit
The menu displayed shows a CMakesList.txt file, and the main.ccp source file. However no .pro file is created.
For new build system you should modify CMakeList.txt file.
Please try to replace
target_link_libraries(myapp Qt5::Gui)
with
target_link_libraries(myapp Qt5::Gui Qt5::Sql)

How to install plugins into Qt Designer?

I have scoured the internet for information regarding the installation process for plugins into Qt Designer and I have found no helpful/relevant information.
The plugin I want to install is the echo plugin.
I have also looked through the Qt Designer program files and found the echoplugin folder but have no idea how to install it. Here is the file location:
C:\Qt\Examples\Qt-5.5\widgets\tools\echoplugin
This holds the following file types; Qt Project Files, C++ Header, C++ Source and JSON
System Information
Windows 10
PyQt4
Qt Designer 5.5.0
Official documentation describes it very well.
To install plugin for Qt Designer or Qt Creator you need to place the plugin to plugins\designer directory.
For Qt Creator it is located in it's bin directory.
Qt Designer is a part of Qt installation so directory will be QTDIR\plugins\designer where QTDIR is Qt installation path (for me it is "E:\DEV\Qt\5.5\msvc2015_desktop_shared" and full plugins path is "E:\DEV\Qt\5.5\msvc2015_desktop_shared\plugins\designer").
One important thing - Qt Designer / Qt Creator and the plugin must be compiled using the same compiler version. You can not install plugin compiled with MSVC 2015 to Qt Designer compiled with MSVC 2013!
Edit:
I am using C++ version of Qt.
It looks like echo plugin is not a plugin for Qt Designer / Qt Creator.

Qt Creator with Cmake

I followed these instructions here : Qt with CMake
so now I can build my project but the problem is, I can't see the project's sources and headers. I have just a CMakeLists.txt on the left and that's it. I don't understand how can I fix this. On Visual Studio, when I used CMake, all sources and headers of my project were appeared.
Thanks you.
Qt Creator shows only files which are listed in your CMakeLists.txt as source files. Add them there and they will show up in the UI.
cmake_minimum_required(VERSION 2.8)
project(MyProject)
add_executable(my_exe main.cpp)
Now main.cpp will be visible in the "Projects" pane in Qt Creator.

Build program with QT 5.0.2 on Windows

I want to build my program(developed with QT 5.0.2) and give it to some friends.
How can I process?
I tried qmake -project and qmake in my folder with the *.cpp files, but it didn't create any exe.
This is my .pro file
#-------------------------------------------------
#
# Project created by QtCreator 2013-08-03T18:53:41
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = target
TEMPLATE = app
SOURCES += main.cpp\
class1.cpp\
class2.cpp\
class3.cpp\
class4.cpp
HEADERS += class1.h\
class2.h\
class3.h\
class4.h
FORMS += class1.ui\
class3.ui
Have you compiled your QtSDK statically? if yes, you can build your project as static linking, either you can't, if your are manually download your Qt repository from qt-project.org, it is a shared version of Qt, you should remove the line contain CONFIG += static and compile your project as shared and add the line below to your .pro file:
QT += core gui
Note:
Use Qt Creator as Qt Framework IDE to manage and build your projects, it's really handy and great tool, another way is use Visual Studio Add-In that integrates with VStudio, if you are professional in Qt architecture, you can use makefile base building of Qt withqmake.
Tutorial for building project on Windows

Resources