QFileInfo exists () and isFile () error


I'm trying to check if the path provided exists and if it's a file. So I wrote this code: #include #include bool Tool::checkPath(const QString &path){ QFileInfo fileInfo(QFile(path)); return (fileInfo.exists() && fileInfo.isFile()); } #include

The owner and group QFileInfo are empty


Here is my location: void MainWindow::writeOnFile(const QString &path) { // Get info files : QFileInfo fileInfo(path); QString name = fileInfo.fileName(); QString lastModif = fileInfo.lastModified().toString(); QString owner = fileInfo.owner(); QStri

Test for QFileInfo built by default


I want to use an optional QFileInfo argument. What is the canonical way to test whether the caller provided a value or whether the default value was used? // declaration void foo(QFileInfo fi = QFileInfo()); // definition void foo(QFileInfo fi) { if

QFile atEnd: how to reset "atEnd"?


After opening a text file, I read everything with: QFile MyFile("myfile.txt);; QTextStream in (&MyFile); while (!in.atEnd()) { (do something); } MyFile.close(); When I remember my function, the "while" l

QDir :: setCurrent vs QFileInfo ::


I encountered an anomaly in Qt (v4.8.4) when reassigning a new path to a pre-existing QDir object. Here is a small example demonstrating this: QString path1("F:/"); //Path must exist... QString path2("F:/Some/Valid/Path/For/You/"); //P

QFileInfo :: absoluteFilePath () does not work?


I use Qt 4.7.4. I have a relative file path that I store as QString and I then want to convert it to an absolute file path. However, when I create a QFileInfo object from QString and call absoluteFilePath (), the path is not yet absolute. For example

Is there a Windows EQ of QFileinfo :: Owner ()?


I ask the above question as every time I use this to determine the person who saved a file for the last time it returns a blank string. Am I doing it wrong or is there a library / equivalent method that will do this for me? Forget to add my code. It

How to check if a folder is accessible via Qt


I'm trying to check if a folder is writable so I can open an error dialog box. I try this: QFileDevice::Permissions permissions_list = QFile( folderName ).permissions(); if ( permissions_list && QFileDevice::WriteUser ) { } but it does not work. T

Signal and Slot in Qt4 - does not work


I use Qt4 and Qt Creator. I can not write a custom location in a progress bar in the UI. How to write a custom location for a specific widget in the ui file? In my scenario, the signal does not originate from the element ui. the code below produces a

Updating a QProgress bar for a different thread


I developed my own hybrid stream encryption and for the GUI, I use Qt. Initially, I wrote it on a single thread, but it was a stream encryption that made the GUI dysfunctional when it operated on large files. So I moved the encryption / decryption to

How to add "member" to the MainWindow class in Qt


So I started to learn Qt, and I got the hand on Qt5 C ++ GUI Programming Cookbook. I wanted to make a simple video converter, and there is an example on how to do it in the book. But the code execution of the book gives me an error: 'Ui::MainWindow'

Qt toBase64 and Linux base64 differ


Subj. Why can it be? I tried all the flags for Qt toBase64 but nothing changed. Hit: cat Invader_1.png | base64 Exit: iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz AAALEwAACxMBAJqcGAAAA0JJREFUeJzt3MFt20AURdHnQIWoFLoSq5S

The QSettings subclass has no keys


I am working on the project by adding to the existing Java application. This Java application has its configuration file, like this: screen.600800=false payment.commerceid= machine.printer=printer\:(Default),receipt paper.standard.mediasizename=A4 ma

Using ui PyQt and Qt files


I'm new to PyQt and I'm trying to work with ui files directly from my PyQt script. I have two files ui, mainwindow.ui and landing.ui. By clicking on a button 'push button' on the main window, open the landing window. However, clicking the button does