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.

300 questions
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
  • 189
  • 1
  • 1
  • 11
7
votes
1 answer

How to activate centralWidget in QT Designer

I was looking at this article How to make a Qt Widget grow with the window size? but when i got to the answer I got stuck on "activating" the central widget. I notice an icon with a red circle so I guess that means its disabled. I've been…
alex simon
  • 71
  • 1
  • 2
6
votes
1 answer

How to use custom widget with model/view/delegates in Qt5?

In the proprietary code base I'm currently working with, there is a custom list view (derived form QListView). Currently it has an issue when lots of items (>10000) make the main thread freeze. Every item in the view is a custom widget designed in…
Inline
  • 2,566
  • 1
  • 16
  • 32
6
votes
3 answers

How to remove QTreeView indentation

I want to have a QTreeView without an indentation on the left side increasing at each nesting level. I tried setting QTreeView::setIndentation(0). It removes the indentations just as I want, however it also hides the tree arrows. Default…
John Doe
  • 555
  • 6
  • 17
6
votes
4 answers

How to add two label-field pair as one row to QFormLayout?

So I have QFormLayout that manages my QLabel-QLineEdit pairs just fine. Problem is, that I need to achive something like this: Horizontal border/tittle isn't a problem, but "Street"-"Apartment"/"Post code"-"City" pairs are. So my question is: how…
rsht
  • 1,522
  • 12
  • 27
5
votes
3 answers

Hide label text for Qt tabs without setting text to empty string

I need a QTabWidget with icons only: How can I hide the label text of a tab in Qt? I cannot set the text to an empty string (""), as I am using docked widgets ( QDockWidget ) and the label text is set automatically (and I need it if the widget is…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
4
votes
1 answer

Scaling QPolygon on its origin

I'm trying to scale a QPolygonF that is on a QGraphicsScene's QGraphicsView on its origin. However, even after translating the polygon (poly_2) to its origin (using QPolygon.translate() and the center coordinates of the polygon received via…
4
votes
2 answers

Virtual keyboard or onscreen keyboard for QtWidgets applications?

I'm going to deploy the qtvirtualkeyboard in my widget-based application like so: #include int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QApplication app(argc, argv); …
4
votes
0 answers

How to create a High-DPI aware custom widget in QT?

There are many situations while creating a custom widget in QT where it's not possible to use relative sizes: Height of a button Default width of a vertical scroll-bar etc.. Several approach could be used for this: Using the screen DPI value:…
Adrian Maire
  • 14,354
  • 9
  • 45
  • 85
4
votes
1 answer

How to update QGridLayout row/column count depending on the layout size?

This thing seems really basic to me, though I could not find any information on how to implement it. I have some sort of QGridLayout that contains equally-sized widgets. I would like to update its row/column count based on the layout size. For…
bashis
  • 1,200
  • 1
  • 16
  • 35
4
votes
2 answers

qmake does not add widgets

i have a simple program. my program is: #include #include int main(int argc, char *argv[]) { int rc ; QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!"); label->show(); rc =…
Bilal Yasar
  • 947
  • 2
  • 11
  • 24
4
votes
0 answers

Arbitrarily dockable windows / widgets in Qt

Qt 5.2 or later, widget based GUI (no QML) Dockable widgets in Qt are possible (example). However, usually one can dock a widget in a dockable area of a larger surrounding parent frame. I wonder whether there is a way to attach floating windows with…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
3
votes
1 answer

How to show google map in my QtGui using PyQt5.QWebkitWidgets

I am currently trying to embed the google map on the PyQt5 based GUI. My environment includes Ubuntu 16.04 LTS and python 2.7. Basically, I am trying to combine the following two python scripts(map.py and gui.py) into one script(gui.py) and I would…
Sunghun Jung
  • 33
  • 1
  • 5
3
votes
1 answer

How to create a QPushbutton with one side curved inward and other side flat in Qt

QPushButton { border: 2px solid red; height:24px; width:100px; border-top-left-radius: 50px; border-bottom-left-radius: 50px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; } which gives me rounded…
Rubina
  • 123
  • 1
  • 17
3
votes
0 answers

Reason: Incompatible library version: QtWidgets.so requires version 5.10.0 or later, but QtWidgets provides version 5.7.0

I'm a complete newbie when it comes to Python programming and I would like to dive myself into Python GUI application programming and have been trying to get Pyforms to work on my Macbook 12" 2017 running macOS High Sierra 10.13.3 I followed the…
blue2609
  • 841
  • 2
  • 10
  • 25
1
2
3
19 20