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

5305 questions
196
votes
6 answers

QLabel: set color of text and background

How do I set color of text and background of a QLabel ?
Regof
  • 2,487
  • 3
  • 19
  • 20
132
votes
2 answers

What's the difference between QMainWindow, QWidget and QDialog?

What's the difference between QMainWindow, QWidget and QDialog?
zibib
  • 1,775
  • 3
  • 15
  • 15
95
votes
4 answers

How to make a Qt Widget grow with the window size?

I want to have a small QFormLayout that grows to fill its parent widget. I created a new .ui file using the QWidget template in Qt Designer. I put a QFormLayout inside that 'window', then put some controls inside that QFormLayout. This all works…
bastibe
  • 14,886
  • 24
  • 86
  • 118
84
votes
8 answers

How can I hide/delete the "?" help button on the "title bar" of a Qt Dialog?

I am using Qt Dialogs in one of my application. I need to hide/delete the help button. But i am not able to locate where exactly I get the handle to his help button. Not sure if its a particular flag on the Qt window.
AMM
  • 12,892
  • 19
  • 61
  • 74
82
votes
6 answers

Qt: resizing a QLabel containing a QPixmap while keeping its aspect ratio

I use a QLabel to display the content of a bigger, dynamically changing QPixmap to the user. It would be nice to make this label smaller/larger depending on the space available. The screen size is not always as big as the QPixmap. How can I modify…
marvin2k
  • 1,413
  • 2
  • 13
  • 18
72
votes
3 answers

Understanding form layout mechanisms in Qt

Qt has a flexible and powerful layout mechanism to handle view of desktop application's windows. But it is so flexible, that it nearly cannot be understood, when something goes wrong and needs fine tuning. And so powerful, that it can beat anyone in…
Maxim Popravko
  • 3,851
  • 2
  • 27
  • 42
69
votes
4 answers

How to make a column in QTableWidget read only?

I would like to have one column in QTableWidget NOT editable. In forums I have read a lot about some flags but could not manage to implement.
Narek
  • 35,407
  • 69
  • 202
  • 359
67
votes
5 answers

what is the correct way to implement a QThread... (example please...)

The Qt documentation for QThread says to create a class from QThread, and to implement the run method. Below is taken from the 4.7 Qthread documentation... To create your own threads, subclass QThread and reimplement run(). For example: class…
g19fanatic
  • 9,329
  • 6
  • 30
  • 60
65
votes
12 answers

Qt - remove all widgets from layout?

This doesn't seem easy. Basically, I add QPushButtons through a function to a layout, and when the function executes, I want to clear the layout first (removing all QPushButtons and whatever else is in there), because more buttons just get appended…
user375566
63
votes
3 answers

How to get sender widget with a signal/slot mechanism?

It's possible to bind more than one signal to one slot (isn't?). So, is there a way to understand which widget sends the signal? I'm looking for something like sender argument of events in .NET
sorush-r
  • 9,347
  • 14
  • 77
  • 160
60
votes
2 answers

How to run a system command in Qt?

I have to run a system command in Qt. but I have to give an argument for that command. for example opening gedit with a text file. like "gedit /home/oDx/Documents/a.txt" but the path "/home/oDx/Documents/a.txt" will be in a variable like…
defiant
  • 2,489
  • 10
  • 34
  • 55
58
votes
17 answers

Console output in a Qt GUI app?

I have a Qt GUI application running on Windows that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example: int main(int argc, char *argv[]) { QApplication a(argc,…
Rob
  • 70,036
  • 53
  • 151
  • 189
53
votes
6 answers

How do I compile a PyQt script (.py) to a single standalone executable file for windows (.exe) and/or linux?

I started to fiddle with PyQt, and made a "beautiful" script from the pyqt whitepaper example app (pastebin) It works perfectly in Windows and Linux (with qt environment already installed on both). Now my question is: Since I am trying to use Qt…
heltonbiker
  • 23,225
  • 20
  • 121
  • 212
53
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
  • 7,998
  • 19
  • 86
  • 167
53
votes
5 answers

How to "Reveal in Finder" or "Show in Explorer" with Qt

Is it possible to open a folder in Windows Explorer/OS X Finder and then select/highlight one file in that folder, and do it in a cross platform way? Right now, I do something like QDesktopServices::openUrl( QUrl::fromLocalFile( path ) ); where…
nnc
  • 883
  • 2
  • 7
  • 9
1
2 3
99 100