Questions tagged [qt5]

Questions specifically for version 5.x of the Qt library. If your question applies to other versions of Qt, use the tag [tag:qt4] or [tag:qt3]. It is recommended to use with the tag [tag:qt].

qt5
Filter by
Sorted by
Tagged with
168 votes
4 answers
80k views

Connecting overloaded signals and slots in Qt 5

I'm having trouble getting to grips with the new signal/slot syntax (using pointer to member function) in Qt 5, as described in New Signal Slot Syntax. I tried changing this: QObject::connect(spinBox,...
dtruby's user avatar
  • 1,815
86 votes
7 answers
66k views

Project ERROR: Unknown module(s) in QT: webkitwidgets

I am porting code from qt4 to qt5. I added the following line to my .pro file, as suggested: QT += webkitwidgets However, when I run qmake, I get the this error: Project ERROR: Unknown module(s) in ...
user1251007's user avatar
  • 16.3k
74 votes
4 answers
139k views

How to create/read/write JSON files in Qt5

Qt5 has a new JSON parser and I want to use it. The problem is that it isn't too clear about what the functions do in layman's terms and how to write code with it. That or I could be reading it wrong. ...
Jim Kieger's user avatar
67 votes
3 answers
60k views

Is there a tutorial specifically for PyQt5? [closed]

I am looking for a PyQt5 tutorial. It is rather complicated to start GUI development with Python for the first time without a tutorial. I only found some PyQt4 tutorials so far, and since something ...
WeGi's user avatar
  • 1,906
65 votes
4 answers
39k views

Building Qt 5 on Linux, for Windows

I wanted to migrate my Qt 4 app to use Qt 5 instead. These instructions failed, due to some differences with how MXE builds Qt 5, including the fact that it uses modularised Qt tarballs, instead of ...
tshepang's user avatar
  • 12.3k
65 votes
4 answers
3k views

How to generate video file from QImage sequence using QMediaRecorder in Qt5 C++

Basically what I want is to encode a video using QMediaRecorder by supplying as a source a sequence of QImages that I generate in custom code at run-time. So far I have found no easy way to do this, ...
Mr. Developerdude's user avatar
60 votes
2 answers
20k views

Is there any difference between QRegularExpression and QRegExp?

I see there is a new class for regular expressions - QRegularExpression. Is it just a typedef for QRegExp, or a new class, or what? And why do we need it, we already have QRegExp?
sashoalm's user avatar
  • 77.1k
58 votes
3 answers
32k views

Qt Creator, ptrace: Operation not permitted. What is the permanent solution?

While debugging C++ code in Qt creator I get the following error ptrace: Operation not permitted. Could not attach to the process. Make sure no other debugger traces this process. Check the settings ...
Indra's user avatar
  • 1,338
57 votes
1 answer
49k views

QTextEdit vs QPlainTextEdit

What's the difference between QTextEdit and QPlainTextEdit, why use one over the other? I'm coding a text editor as an exercice to learn Qt5, and now I'm wondering whether to use QTextEdit or ...
Markus Meskanen's user avatar
52 votes
6 answers
96k views

How to find the Qt5 CMake module on Windows

I'm trying to make a very basic Qt5 application using CMake on Windows. I used the documentation of Qt5 to use CMake, and my main.cpp file just contains a main function. My CMakeLists.txt is exactly: ...
dzada's user avatar
  • 5,574
50 votes
5 answers
69k views

Building Qt5 with Visual Studio 2012 / Visual Studio 2013, and integrating with the IDE

How do you get Qt5 to download and integrate with Visual Studio 2012? What are some of the problems you will encounter, and how do you solve those problems? UPDATE re. Visual Studio 2013 Successes ...
MirroredFate's user avatar
  • 12.6k
50 votes
1 answer
900 views

Qt5 VideoOverview example does not work. Any solution?

I am stuck for a month with a video example given in Qt Video Overview. I tried that code, but I only got a blank square (QWidget). I am using GStreamer0.10 for media playback over Qt5. I also played ...
user avatar
46 votes
7 answers
94k views

Dark theme for Qt widgets?

Background I'm building a PyQt5 application, that I'd like to have a dark theme for. Previously I've worked with Android development where there was a dark theme that I could set for a whole ...
sunyata's user avatar
  • 1,921
45 votes
8 answers
29k views

Image rounded corners in QML

To my surprise, the Image component has no radius property. I tried emulating the rounded corners by putting the image in a rounded Rectangle, but it does not clip the corners. Rectangle { ...
Tamás Szelei's user avatar
45 votes
4 answers
21k views

Disconnecting lambda functions in Qt5

Is it possible to disconnect a lambda function? And if "yes", how? According to https://qt-project.org/wiki/New_Signal_Slot_Syntax I need to use a QMetaObject::Connection which is returned from the ...
alexandernst's user avatar
  • 14.8k
40 votes
5 answers
32k views

Qt5. Embed QWidget object in QML

I am using Qt5 beta and trying to embed a QWidget-based object into QML. The goal is to use QML as much as possible, and only use QWidget objects where QML does not do what I need. I found a link ...
eatyourgreens's user avatar
39 votes
4 answers
27k views

How to update component in Qt 5.2.1+?

I see this message: at least one valid and enable repository required for this action to succeed whenever I try to update components in Qt 5.2.1. I know it is a reported bug (take a look here ...
Baso's user avatar
  • 1,354
39 votes
1 answer
34k views

CMake cannot find Qt5LinguistTools in Docker / Ubuntu 18.04

My simple Dockerfile: FROM ubuntu:18.04 RUN apt update && apt upgrade -y RUN apt install build-essential cmake qt5-default -y RUN apt install qttools5-dev-tools -y When I check linguist ...
juzzlin's user avatar
  • 46.4k
38 votes
12 answers
22k views

Qt5 Target conditionals not found

I just updated to the latest version of command line tools in OS X Mavericks and now when compiling my (previously-working) code it throws the following error > clang: warning: no such sysroot ...
BRabbit27's user avatar
  • 6,463
38 votes
1 answer
22k views

What is the difference between a QWindow and QWidget

The Qt 5.0 provides a new QWindow class. While the documentation on this class is quite comprehensive, I am failing to see how exactly the QWindow is different from the QWidget class, and in which ...
Yellow's user avatar
  • 4,015
37 votes
2 answers
40k views

What is the signal for when a widget loses focus?

In a dialog, when the tab key is pressed, the focus changes to another widget. In Qt, is there any signal for when a widget loses its focus? Can I use it to check if the input is valid or not? If not, ...
user1899020's user avatar
  • 13.4k
36 votes
6 answers
45k views

Do I have to include all these Qt dlls with my application?

I'm totally new in using Qt and I don't know a lot of stuff. As a test I created a simple application using Visual Studio 2012 and Qt-VS-Add-in based on the newest Qt5.1 After I compiled the ...
Alaa Salah's user avatar
35 votes
6 answers
32k views

QML: List all object members/properties in console

Is there any way to list all object members/properties in QML & Qt 5.1? Such as: var obj=myQObject; console.log(obj) // expected output: // obj { x:123..... } This would be very helpful for ...
ZXco's user avatar
  • 823
35 votes
5 answers
53k views

Get HWND on windows with Qt5 (from WId)

I am trying to convert a Qt4 Application to Qt5. The only thing I couldn't figure out is how to get the HWND of a Widget. The program uses EcWin7 to show the progress on the taskbar icon on win 7+ but ...
Josef's user avatar
  • 1,477
33 votes
10 answers
87k views

Qt5 Static Build yields Failed to load platform plugin "windows"

I am writing a Qt application on Windows using Visual Studio 2012. Using the Qt Add-in and a custom built static distribution of Qt 5.0.2. I am running into the dreaded "Failed to load platform ...
Dave's user avatar
  • 7,373
33 votes
5 answers
53k views

Qt5 QML module is not installed

I'm confused about modules in Qt QML. I've read all the docs, but it doesn't make clear some basic ideas. I understand that i can put a bunch of QML files into a directory and add a qmldir file to ...
jkj yuio's user avatar
  • 2,593
33 votes
1 answer
21k views

Range slider in Qt (two handles in a QSlider)

I need a range selection using QSlider. Is it possible to get two handles, if not, is there any piece of code available to handle that smartly? Below is an image illustrating what I need.
Sivam's user avatar
  • 1,099
32 votes
9 answers
40k views

Accessing C++ QLists from QML

If I've got a list of things in C++, how do I expose that to QML (in Qt5 / QtQuick 2)? It seems like QML can only understand QObject-derived classes, which is an issue because QObjects can't be put in ...
Timmmm's user avatar
  • 92.2k
32 votes
8 answers
28k views

Application deployed with QT5 libraries does not start on Windows 7

Recently we have been migrating our QT based application on Windows from QT 4.8 to QT 5, and we have run into a issue with deployment. Note that our app has not changed, we have only built it with new ...
Aki's user avatar
  • 3,769
32 votes
4 answers
70k views

How do I use Qt in my Visual Studio 2015 projects?

We have large project that used .NET Framework for showing forms/windows. Recently I decided to deprecate CLR dependency and move to Qt. While learning Qt, we've migrated from Visual studio 2013 to ...
Croll's user avatar
  • 3,711
32 votes
2 answers
23k views

C++ Qt where's the std::unique_ptr Qt version?

So when programming in Qt I like to go with the Qt implementation as far as possible. As far as I've seen there's no Qt version of the std::unique_ptr or is there? What would be the alternatives that ...
deW1's user avatar
  • 5,612
32 votes
3 answers
37k views

QWebView or QWebEngineView

Are there any functional differences between QWebView and QWebEngineView? If I understand correctly, QWebView is webkit, while QWebEngineView is blink. Are there any differences to the programmer? ...
graywolf's user avatar
  • 7,272
31 votes
7 answers
97k views

CMAKE_PREFIX_PATH doesn't help CMake in finding Qt5

From here: https://stackoverflow.com/a/28327499/462608 I tried this: cmake_minimum_required(VERSION 2.8.12) project(qtquick_hello_cmake) set(CMAKE_PREFIX_PATH "/opt/Qt5.9.1/5.9.1/") set(...
Aquarius_Girl's user avatar
31 votes
2 answers
45k views

Remove selected items from listWidget

How to remove selected items from a QListWidget? I have tried write the following code, but it does not work. QList<QListWidgetItem*> items = ui->listWidget->selectedItems(); foreach(...
Lion King's user avatar
  • 33.4k
30 votes
4 answers
41k views

No default repositories in Qt Maintenance Tool

I recently installed Qt 5.5 and its MaintenanceTool (MaintenanceTool.exe). The default repositories were working, but after one day, my MaintenanceTool suddenly reported that no repositories were set. ...
Ralf Wickum's user avatar
  • 3,062
30 votes
2 answers
21k views

How to specify Mac platform in qmake (QtCreator)

I would like to set some configurations for Mac OS in pro file via QtCreator. I read the document, and found it supports Windows and Unix, like the following, win32 { SOURCES += hellowin.cpp }...
CCC's user avatar
  • 2,192
30 votes
4 answers
18k views

How to include child mouse hover events in the parent MouseArea using QML?

I want to implement the following scenario in QML. Here is a sample/simplified delegate for ListView element: Component { Item { id: container MouseArea { anchors....
S.M.Mousavi's user avatar
  • 5,138
28 votes
2 answers
28k views

How to insert QChartView in form with Qt Designer?

I want to add QChart to the form. But I can't find it in the Widget Box. So I created it in the code. How can I insert it in QWidget or QFrame or something else? I want to set area of that widget ...
Ufx's user avatar
  • 2,665
28 votes
4 answers
29k views

How to check the selected version of Qt in a .pro file?

I have multiple versions of Qt installed, and I need to compile my project with all of them. Using a pro file, I could not find in the documentation how to do a conditional compilation. Ideally, ...
Pietro's user avatar
  • 12.5k
28 votes
3 answers
44k views

How to catch exceptions in Qt?

try { // `count()` throws exception connect(thread, SIGNAL(started()), engine, SLOT(count())); } catch(const X& e) {} As of Qt-5, I get following error: Qt has caught an exception thrown ...
smallB's user avatar
  • 16.8k
27 votes
2 answers
12k views

How to override just one property:value pair in Qt StyleSheet

I am writing newbie Qt5 code on OSX Mavericks and would like to override just one property:value pair of the StyleSheet for a given widget. If I run the following self-contained demonstration code: ...
lcikgl's user avatar
  • 759
26 votes
1 answer
2k views

Why does FlowLayout behave differently in Qt 5.2, compared to Qt 4.8?

I've just ported my application from Qt 4.8.4 to Qt 5.2.1. I have an issue with the FlowLayout class as provided in the FlowLayout example code in the Qt docs. I have a QMainWindow with a QDockWidget ...
c_k's user avatar
  • 1,766
25 votes
7 answers
115k views

Qt5 - setting background color to QPushButton and QCheckBox

I'm trying to change the background color of a QAbstractButton (either a QPushButton or QCheckBox) in Qt5 and having zero luck. This does nothing: pButton->setAutoFillBackground(true); QPalette ...
Betty Crokker's user avatar
25 votes
4 answers
23k views

Qt 5 build error: extra characters after test expression

I am trying to learn Qt 5.3, and this is my first program (hello world). When I try to build, it displays this error: extra characters after test expression. I cannot understand at all why this ...
Sham's user avatar
  • 414
25 votes
3 answers
15k views

Deploying Qt5 on Windows without Hardware Acceleration

Qt5 can use the OpenGL driver or the DirectX Driver by using ANGLE. As we cannot depend on an installed OpenGL driver, we need to use the ANGLE backend. Unfortunately, this doesn't solve all ...
Sebastian Wagner's user avatar
24 votes
8 answers
15k views

QList vs QVector revisited

My question is basically when to choose QVector and when to choose QList as your Qt container. What I already know: Qt docs: QList class For most purposes, QList is the right class to use. Its ...
demonplus's user avatar
  • 5,701
24 votes
3 answers
36k views

What is the use of various Qt platform plugins?

I was doing some cross compiling of a Qt5.2 application for an ARM based target (TI AM335x EVM) and it was failing to display anything on my platform. After doing some google’ing I found that if I ...
Mike's user avatar
  • 48.3k
24 votes
4 answers
33k views

How to declare list property in QML

How do I declare a list property in QML (for use with Qt.labs.settings in my case): Settings { property list recentFiles: [] } Does not work. I've tried many other options: list<string>, ...
Timmmm's user avatar
  • 92.2k
24 votes
1 answer
14k views

In Qt 5, what's the right way to show multi-monitor full screen QWidget windows?

I have a Windows & Mac program that switches into full-screen mode on multiple monitors. In Qt 4, it seems (I can't find explicit documentation on how to do this) like the 'correct' way to go ...
Ted Middleton's user avatar
24 votes
1 answer
5k views

Qt5 new signal to lambda connections memory leak

The new Qt5 signals and slots syntax allows us to connect signals not only to slots, but also to plain old functions and functors/lambdas. Now the problem is, that lambdas are essentialy objects with (...
Sigil's user avatar
  • 243

1
2 3 4 5
176