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
29
votes
3 answers

Qt Designer - How to get a widget to span columns?

I created a simple form. I added a PushButton in the bottom right, and then a TabWidget above that. I highlighted the main window, and chose Grid Layout. The PushButton was stretched, so I added a spacer to the left of it. Now, my Tab Widget only…
esac
  • 24,099
  • 38
  • 122
  • 179
29
votes
2 answers

QTableView has unwanted checkboxes in every cell

I'm just getting started with Qt programming, and I'm trying to make a simple tabular data layout using a QTableView control with a model class of my own creation inheriting from QAbstractTableModel. For some reason, my table view ends up looking…
Tyler McHenry
  • 74,820
  • 18
  • 121
  • 166
29
votes
2 answers

How can I simulate user interaction (key press event) in Qt?

I need to simulate "Enter" key event in Qt. How can I do this?
Andersson83
  • 441
  • 1
  • 8
  • 12
29
votes
2 answers

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 } unix { SOURCES += hellounix.cpp } I…
CCC
  • 2,164
  • 8
  • 27
  • 47
29
votes
5 answers

URL for multiple markers in Google Maps

In a desktop Qt application, I have some GPS coordinates that I'd like to show on a map. My plan is to construct an URL with the coordinates and let a web browser and Google maps or a similar service do the heavy lifting. After reading some…
Joakim Rosqvist
  • 417
  • 1
  • 4
  • 5
29
votes
2 answers

Qt foreach loop ordering vs. for loop for QList

When iterating through a QList with a foreach loop, in the tests I conducted the items are returned in the same order as they are with a standard for loop. My question is, will the foreach always return items in numerical order by index like…
Freedom_Ben
  • 11,247
  • 10
  • 69
  • 89
29
votes
5 answers

How to integrate Boost.Asio main loop in GUI framework like Qt4 or GTK

Is there any way to integrate Boost.Asio with Qt4 (preferred) or GTK main loop? GTK provides poll(2) like API so technically is should be possible. Qt provides its own networking layer, however I prefer to use existing code written for Boost.Asio. I…
Artyom
  • 31,019
  • 21
  • 127
  • 215
28
votes
4 answers

How to determine the platform Qt is running on at runtime?

Is there a (Qt) way to determine the platform a Qt application is running on at runtime?
andreas buykx
  • 12,608
  • 10
  • 62
  • 76
28
votes
4 answers

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, this is what I would like to do: QT_VERSION = 5 …
Pietro
  • 12,086
  • 26
  • 100
  • 193
28
votes
1 answer

How change the background color for a blank cell in QTableWidget

If a cell have some data, using tableWidget->item(8,0)->setBackgroundColor(Qt::red); to change the background color will work, but if a cell is blank it will fail.
spy8888
  • 315
  • 1
  • 5
  • 9
28
votes
2 answers

Detect if qt is running a debug build at runtime

How can I detect from within a QObject at runtime whether or not the Qt it's linked against is a debug build or release build? I know about the QT_NO_DEBUG macro, but that is resolved at build time for Qt. Example 1 of when this would be useful: I…
troy.unrau
  • 1,142
  • 2
  • 12
  • 26
27
votes
2 answers

Converting QString to char*

Possible Duplicate: QString to char conversion I have a function (fopen in STL) that gives a char* argument as a path in my computer, but I must use QString in that place so it doesn't work. How can I convert QString to char* to solve this…
amiref
  • 3,181
  • 7
  • 38
  • 62
27
votes
4 answers

Invoke slot method without connection?

I have a live object implemented in the following way. It is used to execute long tasks in background. The main thread invoke the tasks by sending a signal to the public slots (i.e. doTask). Here is a stripped down example (not tested). class MyTask…
chmike
  • 20,922
  • 21
  • 83
  • 106
27
votes
5 answers

How to overload operator<< for qDebug

I'm trying to create more useful debug messages for my class where store data. My code is looking something like this #include #include /** * Model for storing data. */ class DataModel : public…
izidor
  • 4,068
  • 5
  • 33
  • 43
27
votes
4 answers

Make QWidget transparent

I have a QWidget-based overlay widget which should paint some text and take place over the central widget of my application. The problem is that I can't set background of overlay widget to be transparent. What I already…
sorush-r
  • 10,490
  • 17
  • 89
  • 173