Questions tagged [qt4]

Questions specifically relating to the deprecated version 4.x.x of the Qt C++ GUI library. If your question applies to the current major version of Qt, use the tag [qt].

Qt 4.x is a specific series of releases of the Qt GUI library. Use this tag if your question only applies to Qt 4.x, and not to Qt 3.x or Qt 5.x. If your question applies to Qt in general, use the tag .

Trolltech released Qt 4.0 on June 28, 2005 and introduced five new technologies in the framework:

  • Tulip: A set of template container classes.
  • Interview: A model/view architecture for item views.
  • Arthur: A 2D painting framework.
  • Scribe: A Unicode text renderer with a public API for performing low-level text layout.
  • MainWindow: A modern action-based main window, toolbar, menu, and docking architecture.

The latest official 4.x release is 4.8.6 (April 24, 2014). The major version indicates API compatibility.

It has been noted that, Qt 4.8 is officially supported till "19.12.2015", In order to get official support it is better to port to Qt5

A list of the supported platforms for version 4.8 can be found here

5315 questions
59
votes
4 answers

Get filename from QFile?

eg: QFile f("/home/umanga/Desktop/image.jpg"); How I get only the filename - "image.jpg"?
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
54
votes
1 answer

Serialization with Qt

I am programming a GUI with Qt library. In my GUI I have a huge std::map. "MyType" is a class that has different kinds of fields. I want to serialize the std::map. How can I do that? Does Qt provides us with neccesary features?
Narek
  • 38,779
  • 79
  • 233
  • 389
54
votes
4 answers

Qt undefined reference to vtable

I am a beginner to Qt programming and use codeblocks for my programming. I created 3 files communicate.h,commmunicate.cpp and main.cpp as follows: communicate.h #ifndef COMMUNICATE_H #define COMMUNICATE_H #include #include…
ranger101
  • 1,184
  • 4
  • 12
  • 20
46
votes
3 answers

Qt 4.5 - Is emitting signal a function call, or a thread, and does it blocks?

I am not sure about the nature of the signal/slot mechanism in Qt 4.5. When a signal is emitted, is it a blocking function call or a thread? Say this emit GrabLatestData(); // proceed with latest data Will all the signal/slot chain be resolved…
Extrakun
  • 19,057
  • 21
  • 82
  • 129
44
votes
2 answers

Setting application info in a Qt executable file on Windows

Anyone have an tips on setting the application info (ie. right click on .exe->properties) from Qt? I can add arbitrary version strings to Qt resource file (qrc) and display them. But most Windows installers check the version number and I can't find…
Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
42
votes
2 answers

Triple inheritance causes metaclass conflict... Sometimes

Looks like I stumbled upon a metaclass hell even when I didn't wanted anything to do with it. I'm writing an app in Qt4 using PySide. I want to separate event-driven part from UI definition, which is generated from Qt Designer files. Hence I create…
Red
  • 1,450
  • 2
  • 17
  • 33
41
votes
7 answers

Qt get children from layout

I try to hide all widgets in layout. But looks like findChildren doesn't work for layout. Here's my sample code: QLayout * layout = widget -> findChild (layoutName); QList list = layout -> findChildren (); cout <<…
Alex Ivasyuv
  • 8,585
  • 17
  • 72
  • 90
40
votes
10 answers

How do I remove trailing whitespace from a QString?

I want to remove all the trailing whitespace characters in a QString. I am looking to do what the Python function str.rstrip() with a QString. I did some Googling, and found this:…
Di Zou
  • 4,469
  • 13
  • 59
  • 88
39
votes
14 answers

switch/case statement in C++ with a QString type

I want to use switch-case in my program but the compiler gives me this error: switch expression of type 'QString' is illegal How can I use the switch statement with a QString? My code is as follows: bool isStopWord( QString word ) { bool flag =…
amiref
  • 3,181
  • 7
  • 38
  • 62
38
votes
5 answers

PyQt sending parameter to slot when connecting to a signal

I have a taskbar menu that when clicked is connected to a slot that gets the trigger event. Now the problem is that I want to know which menu item was clicked, but I don't know how to send that information to the function connected to. Here is the…
johannix
  • 29,188
  • 15
  • 39
  • 42
38
votes
3 answers

How can I move file into Recycle Bin / trash on different platforms using PyQt4?

I would like to add the next feature to my cross-platform PyQt4 application: when user selects some file and select "remove" action on it that file will be moved to Recycle Bin folder instead of being permantly removed. I think I can find…
bialix
  • 20,053
  • 8
  • 46
  • 63
37
votes
1 answer

How can I emit a signal from another class?

I have a problem with my Qt application. I'm trying to emit a signal from within another class (it is a nested class of the one in which the signal is placed). I already connected the signal with a slot, which should be fine. But when I try to emit…
lagoru
  • 697
  • 1
  • 12
  • 22
36
votes
5 answers

Identifier for win64 configuration in Qmake

Is there a "win64" identifier in Qmake project files? Qt Qmake advanced documentation does not mention other than unix / macx / win32. So far I've tried using: win32:message("using win32") win64:message("using win64") amd64:message("using…
Tuminoid
  • 9,445
  • 7
  • 36
  • 51
36
votes
2 answers

How to set selected filter on QFileDialog?

I have a open file dialog with three filters: QString fileName = QFileDialog::getOpenFileName( this, title, directory, tr("JPEG (*.jpg *.jpeg);; TIFF (*.tif);; All files (*.*)") ); This displays a dialog with "JPEG"…
Greg K
  • 10,770
  • 10
  • 45
  • 62
35
votes
8 answers

Build Qt in "Release with Debug Info" mode?

Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt. Qt docs has "debug"…
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185