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
22
votes
1 answer

replacing layout on a QWidget with another layout

I have a widget which changes when an option is toggled. This invalidates all layouts and widgets. I keep list of all layouts, so I can delete them using something similar to this answer: class MyWidget(QFrame): # ... def reLayout(self): …
eudoxos
  • 18,545
  • 10
  • 61
  • 110
21
votes
3 answers

Set widget in center in QDesigner

Is it possible to set widget in center of dialog or windows in QDesigner, say I have a widget contain 3 line edits and labels and I want to set this widget in center of window.
SIFE
  • 5,567
  • 7
  • 32
  • 46
21
votes
3 answers

Create UTF-8 file in Qt

I'm trying to create a UTF-8 coded file in Qt. #include int main() { QString unicodeString = "Some Unicode string"; QFile fileOut("D:\\Temp\\qt_unicode.txt"); if (!fileOut.open(QIODevice::WriteOnly | QIODevice::Text)) { …
Ondrej Vencovsky
  • 3,188
  • 9
  • 28
  • 34
21
votes
7 answers

QMainWindow with only QDockWidgets and no central widget

We have a window with several components in QDockWidgets. Ideally, we'd like to have all components dockable, but there is one component that will likely always be visible. So we made that the central widget. However, this does not allow us to…
Ivo
  • 3,481
  • 1
  • 25
  • 29
21
votes
2 answers

Removing index numbers in QTablewidget

How can I remove the column with index numbers in QTableWidget ?
Sijith
  • 3,740
  • 17
  • 61
  • 101
21
votes
7 answers

How to restart Linux from inside a C++ program?

I have a Qt 4 GUI where I need to have a option in a drop-down menu that allows the user to choose to restart the computer. I realize this might seem redunant with the ability to restart the computer in other ways, but the choice needs to stay…
Dave K
  • 211
  • 1
  • 2
  • 3
21
votes
10 answers

How do I create a custom slot in qt4 designer?

Whenever I use the signal/slot editor dialog box, I have to choose from the existing list of slots. So the question is how do I create a custom named slot?
user24560
  • 898
  • 2
  • 12
  • 16
21
votes
4 answers

What is the advantage of using the native C++ Qt over PyQt

I want to develop in Qt, and I already know Python. I am learning C++, so what are the advantages of programming Qt in C++ over Python? C++ seems more complicated, and seems like there is not much gain.
Orcris
  • 3,135
  • 6
  • 24
  • 24
20
votes
3 answers

QGroupBox border

After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added: border: 2px solid gray; but there are a couple of problems. 1) Everything inside the groupbox also inherits this…
David Doria
  • 9,873
  • 17
  • 85
  • 147
20
votes
7 answers

Syntax error: word unexpected (expecting ")")

Problem in short - In Linux, whenever we get the following error "Syntax error: word unexpected (expecting ")")", what does it generally mean? Problem in details - I have been trying to cross-compile Qt 4.6 as per the Sourcery tool chain on…
20
votes
2 answers

How to encode URL parameters in QT?

I have the following URL QString url = "http://www.gigacooldomainname.com/" + setName + "/" + fileName + ".jpg" where setName and fileName are QString variables. I wish to have the following: QString url = "http://www.gigacooldomainname.com/" +…
Gad D Lord
  • 6,620
  • 12
  • 60
  • 106
20
votes
2 answers

Is it important to declare the namespace with QT_BEGIN_NAMESPACE .. QT_END_NAMESPACE

What is the effect of QT_BEGIN_NAMESPACE? QT_BEGIN_NAMESPACE class QLineEdit; QT_END_NAMESPACE If I don't use the class declaration like that, will any problem occur?
zibib
  • 2,035
  • 3
  • 17
  • 15
20
votes
4 answers

Using QTDesigner with PyQT and Python 2.6

I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6 I just downloaded the whole PyQT/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to…
PyNewbie27
  • 205
  • 1
  • 2
  • 5
20
votes
1 answer

' /usr/lib/i386-linux-gnu/qt5/bin/lrelease: not found WARNING: TARGET is empty' Error when trying to compile Feathercoin from source

I am following this tip on installing feathercoin from source. I have followed all the instructions up to: qmake 'USE_UPNP=-` make That is where I get the following error: 1: /usr/lib/i386-linux-gnu/qt5/bin/lrelease: not found WARNING: TARGET is…
Blue_Hat
  • 327
  • 1
  • 2
  • 9
20
votes
1 answer

Hiding a QWidget on a QToolbar?

I have directly added some QWidgets to a QToolbar but simply going widget->setVisible(false) did not work. Can someone please give me an example of how to show and hide a widget that is on a QToolbar? Thanks!
James
  • 3,682
  • 3
  • 22
  • 21