Skip to content

Tag: qt

Is it necessary to flush a QTextStream before closing a QFile?

I need to log some text messages to a file with following requirements : Each text messages is written in a new line at the end of the file. Be reasonably sure that each message was correctly written to the file. So far, the function is using QTextStream and QFile: Point 1 is satisfied but i have doubts about…

CMAKE_PREFIX_PATH doesn’t help CMake in finding Qt5

From here: https://stackoverflow.com/a/28327499/462608 I tried this: Here is the output of cmake . This is to show that /opt/Qt5.9.1/ does exist. Here I run the cmake with -DCMAKE option, but the output is still same: Contents of the directory: Answer I installed the following missing packages: Attaching any …

How to compile opencv with gtk 2.x rather than gtk3.x

I’m using tensorflow 1.4 & qt in ubuntu 16.04. The problem is when I include tensorflow(version: 1.4) and opencv (version: 3.2.0) simultaneously, protobuf is conflicted. The error msg is as follows: [libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:79] This program was…

How do I run a Python Qt file in Ubuntu?

Here’s the sample code that I want to run: The file is saved as sample.py. The following command isn’t working: Answer You need to start the Qt event loop by calling app.exec_() once you have initialised the widgets and called show() on your main window.

How to check if process is running on Red Hat Linux?

I’ve been using a modified class I found to check if another instance of the same process is already running, the problem is that the method of checking for the process adds another instance of the same process. When my application starts, a new process ID is created and is visible with: With this I get…

Get disk type in QT

I want to get disk type (SSD or HDD) in QT. I’ve checked QStorageInfo but I could not find anything useful for my purpose. By the way I need a solution that’s work on both Windows and Linux. Answer For linux, you can tell whether the kernel has detected a SSD disk by reading special file For insta…

After installing Qt 5.8 all qt applications stopped working

everyone! I have got a bit of a problem. My OS is Ubuntu 16.04 LTS x64. Apt provide only Qt 5.5.1 as the latest version, but I needed to install Qt above 5.6 (I have gone with Qt 5.8) because I needed to compile one of the in-house tools (which require Qt >=5.6). But after installing Qt 5.8 (unfortunately,…