add libusb library to Qt project - qt

I am trying to add libusb library from https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z
to my qt project can anyone help me ,I can't figure out how to add this library to my project

Open terminal:
sudo apt-get install libusb-1.0-0-dev
Edit file.pro:
LIBS += -lusb-1.0
Edit your source fileHeader.h:
#include <libusb-1.0/libusb.h>

Related

QML module not found (QtGStreamer)

I have been trying to install gstreamer on my ubuntu 18.04 and to integrate it into a Qt 5.14.1 project. (Quick heads-up: I am not a pro in things Qt and Linux.)
These are the installation steps I followed in order to install gstreamer:
git clone git://anongit.freedesktop.org/gstreamer/qt-gstreamer
cd qt-gstreamer
mkdir build && cd build
cmake QtGstreamer
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) -DCMAKE_INSTALL_INCLUDEDIR=include -DQT_VERSION=5 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++11
make -j6 && sudo make install
Which installed a bunch of files under /usr/lib/x86_64-linux-gnu/ and /usr/include/Qt5GStreamer/.
I extended the PKGCONFIG in the .pro file like so:
PKGCONFIG += gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0
PKGCONFIG += Qt5GLib-2.0 Qt5GStreamer-1.0 Qt5GStreamerQuick-1.0 Qt5GStreamerUtils-1.0
In my QML file I try to import it like so:
import QtGStreamer 1.0
Which results in an error.
QML module not found. (QtGSteamer)
I would really appreciate on this matter.
Looks like the module is not found in mldule search path. Did you update pro file as described in Build system integration|qmake?
Did you check if this module exists on file system?

How can I install a Qt Module and use it in my project

I'm trying to use the QtContacts module. I'm using ubuntu artful and qt 5.10
I've tried this:
sudo apt-get install qml-module-qtcontacts
and this:
sudo apt-get install qtdeclarative5-qtcontacts-plugin
I put in the .pro file: QT += androidextras contacts, but I get the message: Project ERROR: Unknown module(s) in QT: contacts
I also tried this answer: How to install a missing Qt module?
But the module doesn't appear in the modules list:
What did I miss?
QtVersion:
I downloaded the qt-unified-linux-x64-3.0.2-online.run in this link: https://www.qt.io/download
I would try fetching from here, and install with configure/make/make install.
Looking at this documentation, it seems that there is a Contacts API, and a Contacts QML plugin.
Looking at the pro file in this example, there is no contact module appended to QT, but a CONFIG entry like this:
CONFIG += mobility
MOBILITY = contacts

link GLFW and GLEW to QT-Creator

I wanted to learn OpenGl with Cpp using QT-Creator but it seems that i didn't linked my GLFW lib right.
I used
sudo apt-get install libglfw3 libglfw3-dev libglfw3-doc
and
sudo apt-get install libglew-dbg libglew-dev libglew1.13
to install them and afterwards, the QT_Creator "showed" me
//GLEW
#include "GL/glew.h"
//GLFW
#include "GLFW/glfw3.h"
so I thought, I could use them, but i got an "undifened reference to ...".
I already looked at this question, but it doesn't seem to work. And I never worked with CMake or qmake before, so i can't see my mistake.
I can provide my enviroment setup notes for you, or you can read it from my sites, But prevent my site url from invalid someday, I rewrite it here.
Install glfw
First. we need to install dependencies on ubuntu
sudo apt-get install xorg-dev
sudo apt-get install libglu1-mesa-dev
Install glew
Then download source package at official
Extract your package and open your terminal, then cd to what your package location which you just extracted.
Do following commnad to install
make extension
make
sudo make install
sudo make clean
Open QT project and set opengl settings
Open a console project in QT
Add following settings in your .pro file anywhere.
LIBS +=-lGLEW -lglfw3 -lGL -lX11 -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -lm -pthread
Try a simple test.
#define GLEW_STATIC
#include <GL/glew.h>
#include<GLFW/glfw3.h>
int main(int argc, char *argv[])
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
return 0;
}
Enjoy it
If you have purpose only learn openGL without help library like glfw or glew you can use QOpenglWidget or QOpenglWindow with QOpenglGLFunctions. Qt give wrapper for all openGL functions, however you can use functions from raw opengl. You can not even use QOpenglWindow or QOpengGlWidget. Qt provides a lot of examples, for instance
http://doc.qt.io/qt-5/qtopengl-cube-example.html
http://doc.qt.io/qt-5/qtgui-openglwindow-example.html
I stumbled on the same problem. I followed Tokenyet answer but I also added also -ldl to the end of LIBS in .pro file and it worked.
I have had the same problem, while trying to develop a a console application project using Qt. I fixed the problem using
-lglfw (not -lglfw3)
it seems like lglfw3 (.so or .a file or whatever) does not exist in the Lib folder unless you compile it your self (video)
*More over libglm-dev is needed for projects that include glm header files. So lanch ubuntu software center to install it or lanch
sudo apt-get install libglm-dev

How To Compile QFtp Example in Qt 5?

I have application which uses QFtp class.I have made in Qt 4 version.
But now i want to complie QFtp classe in Qt5 but it's showing some error like:
'QFtp' doesn't name and type.
how to resolve this issue. I don't want to use QNetworkAccessManager. is there any way to this?
Thank you
For the sake of completeness, the steps to use the add-ons are:
Download the sources for the add-on from https://github.com/qt/qtftp
Extract the sources somewhere (e.g. Qt5.x.y/Src/qtmyaddon)
Open a console in that folder
Read readme.txt and run the appropriate commands with the latest QT version
Run qmake
Run make (or nmake or mingw32-make or whatever)
Run sudo make install (nmake install, mingw32-make install, ...)
In the .pro file of your project, add "QT += myaddon" (e.g. "QT += ftp")
Run qmake on your project
Compile your project

Qt 5 Unknown module(s) in QT: uitools

I just started to use Qt today and I don't know if I did something wrong when I installed it but I can't use QFormBuilder.
Linux Xubuntu 64b
what I did:
I clone this repo : git#gitorious.org:qt/qt5.git
init_repository >> ./configure >> make >> sudo make install
I downloaded qt-creator http://qt-project.org/downloads#qt-creator
I created a new project and when I try to include QFormBuilder he tell me that he doesn't know this file.
So, I saw somewhere someone who says that I need to add QT += uitools to the project file, but now when I try to use qmake, I am getting Unknown module(s) in QT: uitools.
Sorry for my english and thank you for your help.
If you get
Project ERROR: Unknown module(s) in QT: designer
you are missing qttools5-dev package.
To add to the answer by #svlasov, on RHEL or CentOS based systems (7.x or 8.x, etc.) you need to install:
yum install qt5-qttools-devel
Depending on the project you are building, you may also need to install qt5-qttools-static.
Have you actually read the documentation?
It writes this at the beginning:
The QFormBuilder class is used to dynamically construct user interfaces from UI files at run-time. More...
Header: #include
qmake: QT += designer
Inherits: QAbstractFormBuilder.
So, just follow that and put this into your qmake project file:
QT += designer
or you can invoke qmake like this:
qmake QT += designer
Of course, you need to make sure that you have the designer installed properly for this. You will need to install a package like libqt5designer5 on your Ubuntu, or if you had installed Qt manually, you will need to install the designer manually as well.
I am not that familiar with Ubuntu. You may need to install some corresponding development package as well. Either way, the point is that the library and headers need to be installed properly on your system which you seem to lack when getting Project ERROR: Unknown module(s) in QT: designer after either of the aforementioned solutions.
Read the documentation, it says to add the designer module to the .pro file:
QT += designer

Resources