Skip to main content

Questions tagged [qt]

Qt is a cross-platform application development framework widely used for the development of application software that can be run on various software and hardware platforms with little or no change in the underlying codebase, while having the power and speed of native applications. Qt is available with both commercial and open source licenses.

60 votes
5 answers
30k views

How to execute a functor or a lambda in a given thread in Qt, GCD-style?

In ObjC with GCD, there is a way of executing a lambda in any of the threads that spin an event loop. For example: dispatch_sync(dispatch_get_main_queue(), ^{ /* do sth */ }); or: dispatch_async(...
Albert's user avatar
  • 67.3k
128 votes
8 answers
251k views

Adding external library into Qt Creator project

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib to be added in the project to build.
Donotalo's user avatar
  • 12.9k
99 votes
6 answers
97k views

Passing an argument to a slot

I want to override mouseReleaseEvent with a bunch of QActions and QMenus... connect(action1, SIGNAL(triggered()), this, SLOT(onStepIncreased())); connect(action5, SIGNAL(triggered()), this, SLOT(...
Fatih Arslan's user avatar
  • 1,094
42 votes
2 answers
6k views

In a templated derived class, why do I need to qualify base class member names with "this->" inside a member function?

While I investigate source code of Qt I saw that trolltech guys explicitly use this keyword to access a field on destructor. inline ~QScopedPointer() { T *oldD = this->d; Cleanup::cleanup(...
useraged's user avatar
  • 1,716
3 votes
2 answers
9k views

QLabel does not display in QWidget

I have the following hierarchy in my Qt Application: QMainWindow > QWidget (centralWidget) > QWidget (subclassed) > QLabel Initialization code in my QMainWindow code: centralWidget = new QWidget(); ...
Laurent Crivello's user avatar
81 votes
7 answers
110k views

Qt static linking and deployment

I am trying to deploy(release to public) a simple qt application I made recently, but got stuck at static linking qt libs. I followed the guide on qt docs to re-build qt and my app statically. But ...
user avatar
15 votes
1 answer
9k views

In PyQt, what is the best way to share data between the main window and a thread

I'm in the process of writing my very first GUI application with PyQt4 and I've come upon a question that seems very basic, yet I don't seem to find a good answer: I'm using a thread to continuously ...
Emil's user avatar
  • 261
168 votes
4 answers
82k 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
12 votes
2 answers
7k views

Sending a sequence of commands and wait for response

I have to update firmware and settings on a device connected to a serial port. Since this is done by a sequence of commands, I send a command and wait until I recive an answer. Inside the answere (...
silversircel's user avatar
71 votes
9 answers
47k views

Qt Linker Error: "undefined reference to vtable" [duplicate]

This is my header: #ifndef BARELYSOCKET_H #define BARELYSOCKET_H #include <QObject> //! The First Draw of the BarelySocket! class BarelySocket: public QObject { Q_OBJECT public: ...
Thomas's user avatar
  • 1,565
9 votes
1 answer
7k views

How to create a generic object model for use in QML?

I would like to know if there is any macro or way how to register Qt model as property of QObject. For example, I have AnimalModel (http://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html#...
Ludek Vodicka's user avatar
145 votes
6 answers
49k views

Detect if stdin is a terminal or pipe?

When I execute "python" from the terminal with no arguments it brings up the Python interactive shell. When I execute "cat | python" from the terminal it doesn't launch the interactive mode. Somehow, ...
Mike McQuaid's user avatar
  • 9,754
66 votes
1 answer
21k views

How to use the Qt's PIMPL idiom?

PIMPL stands for Pointer to IMPLementation. The implementation stands for "implementation detail": something that the users of the class need not to be concerned with. Qt's own class implementations ...
Kuba hasn't forgotten Monica's user avatar
69 votes
6 answers
35k views

How to make item view render rich (html) text in Qt

Suppose my model has items with the following string for Qt::DisplayRole <span>blah-blah <b>some text</b> other blah</span> I want QTreeView (actually, any item view) to ...
Anthony Serdyukov's user avatar
37 votes
3 answers
31k views

My signal / slot connection does not work

I repeatedly see people having problems with slots not being called. I would like to collect some of the most common reasons. So maybe I can help people and avoid a lot of redundant questions. What ...
Silicomancer's user avatar
  • 8,976

15 30 50 per page
1
2 3 4 5
630