Questions tagged [qtwidgets]

Questions related to the QtWidgets module in Qt 5 that provides a set of UI elements to create classic desktop-style user interfaces.

The widget set of UI elements was put into its own module to keep Qt Gui modularized and less cluttered for GUI application using Qt Quick and so on.

The official documentation of this module can be found here.

Tagging recommendation:

You will often see questions tagged specifically as for QWidget, et cetera because the question is Qt 4 related even though it is about widget classes. From Qt 5 onwards, please try to use this tag for those cases. Make sure that you only tag questions with that contain questions about the core part of Qt Gui.

228 questions
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
84
votes
5 answers

Qt Quick vs. Qt Widget

I am new to Qt and don't quite understand the difference between a Qt Quick Project and a Qt Widget Project. I am hoping to create a program that draws a lattice of hexagons that the user can rotate and shear, as well as pan around and zoom in and…
Anthony
  • 7,940
  • 2
  • 30
  • 45
84
votes
1 answer

Issues when attaching and detaching external app from QDockWidget

Consider this little piece of code: import subprocess import win32gui import win32con import time import sys from PyQt5.Qt import * # noqa class Mcve(QMainWindow): def __init__(self, path_exe): super().__init__() menu =…
BPL
  • 9,807
  • 7
  • 37
  • 90
21
votes
2 answers

What is parent for in Qt?

Almost every QtWidgets class can have parent. And usually it's optional to set parent at object initialization. For example,If I create a class that inherits QWidget class, I will do the following on the constructor: Widget::Widget(QWidget* parent):…
Mas Bagol
  • 3,597
  • 7
  • 34
  • 63
18
votes
1 answer

When starting off with Qt Framework, what to choose - Widgets or QT Quick?

I have a project in mind and want to take on it and have chosen QT as the preferred framework to begin with. I have been trying to figure out how to start and have Qt package (SDK and Qt Creator) installed. The problem is - I am not able to figure…
Vaibhav Kaushal
  • 340
  • 1
  • 5
  • 16
14
votes
3 answers

cmake does not find qt 5.1.1

I just installed the Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL) and tried to add it to my cmake. But CMake just does not want to find it and i dont know why. What am i missing? Do i need to set an environment variable or something? Here is my…
Amazonasmann
  • 816
  • 1
  • 13
  • 26
12
votes
2 answers

Implementing resize handles on QRubberband? Is QSizeGrip relevant?

I'd like to make my QRubberband instance user resizeable. I've seen this question here but there isn't a solution. The use case is that the user can drag out a selection marquee over a photo and then make fine adjustments by dragging on the…
spring
  • 16,486
  • 15
  • 74
  • 148
10
votes
2 answers

Change default application font

I have a Qt application that parses some JSON files and outputs its contents. I want the output to be in a monospaced font and the simplest way to do that is changing the default font of the entire application to a monospace. How do I do that in Qt?
Romário
  • 1,234
  • 1
  • 16
  • 27
9
votes
1 answer

improper scaling of Qt Desktop application in windows 10

I'm writing a simple Qt (Widgets) Gui application for windows 10. I'm using the 5.6.0 beta version of Qt. The problem I'm having is that it isn't scaling right to the screen of my surfacebook at all: It's a bit hard to tell because SO scales the…
Nicolas Holthaus
  • 6,800
  • 3
  • 39
  • 79
8
votes
1 answer

QtWidgets.QFileDialog.getOpenFileName returns a Tuple

I've recently updated to the new version of Qt5 for Python. In doing so, I've been having to alter my code in accordance to some of the notable changes that have occurred. I wanted to get some insight into this line of code that I've created. It…
tisaconundrum
  • 1,584
  • 1
  • 19
  • 28
7
votes
1 answer

QWidget in QTreeWidgetItem disappearing after reordering the QTreeWidgetItem

I have subclassed QTreeWidget (called it ToolsSelectorWidget) and enabled reordering in it by overriding QTreeWidget::dropEvent() void ToolsSelectorWidget::dropEvent(QDropEvent *event) { QModelIndex droppedIndex = indexAt(event->pos()); if(…
aalimian
  • 2,552
  • 1
  • 20
  • 42
7
votes
1 answer

pyQt: How do I update a label?

I created this simple UI with qtDesigner and I want to update my label every 10 seconds with the value of a function, but I have no idea how to do this.I've tried different things but nothing worked. def example(): ... return text UI: class…
T.T.
  • 73
  • 1
  • 1
  • 3
7
votes
2 answers

Why it failed without import in python

I am a newbie and am just starting to learn Python programming: import sys from PyQt5 import QtWidgets if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) mainWindow = QtWidgets.QMainWindow() mainWindow.show() …
Anudorannador
  • 149
  • 1
  • 1
  • 10
7
votes
4 answers

Qt 5.3. QtWidgets: No such file or directory #include

I want to compile Qt example. I get error QtWidgets: No such file or directory #include greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - does not help QT += widgets - does not help INCLUDEPATH +=…
Ufx
  • 2,147
  • 11
  • 36
  • 65
6
votes
2 answers

QT High DPI Support on Windows

According to documentation here http://doc.qt.io/qt-5/highdpi.html QT 5.4+ introduces high DPI support. However, either I’m missing something fundamental or the current support is still in very early stages. I’m writing a brand new application so I…
pullo_van
  • 629
  • 6
  • 16
1
2 3
15 16