Questions tagged [qmainwindow]

QMainWindow is a class in Qt library that implements the main window of an application.

As a main window for the application, QMainWindow is different from an ordinary widget. It has a menu bar on the top, a status bar, it can also have toolbars and dock widgets.

It also have a so-called Central Widget, which can be occupied by any other widgets.

Qt also allows one to easily implement single- and multiply-document-interfaces with this class.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

516 questions
0
votes
0 answers

How to forward all MouseEvents from QGraphicsView to its QFrame to its QMainWindow? (C++, Qt5)

I have a widget with this structure: main->QMainWindow->QFrame->QGraphicsView->QScene->QGraphicsPixMapItem->QPixmap I had to do it this way because im not using Qt creator or QML, just widgets. Anyway I added an event filter to my QMainindow to be…
0
votes
0 answers

Cannot Close Spyder with PyQt5

I need your help! I built a GUI with PyQt5 and my IDE is Spyder! When I run PyQt in Spyder I cannot close it. What's the problem? Also when I run it a second time, the menubar disappears... import sys from PyQt5 import QtWidgets from PyQt5.QtWidgets…
chilli93
  • 63
  • 4
0
votes
2 answers

Access widgets in QMainWindow from another class

Although it is a frequently asked question, and I've tried many ways including those from SO, like Trying to access widgets of MainWindow from another class, However I still cannot work out a solution, below is my code which reported error "Unknown…
passiflora
  • 332
  • 1
  • 9
0
votes
1 answer

Child window automatically closed after creation

I'm creating a programm using Python and PyQt5. This is the first time I used PyQt. Actually, when you launch the programm, the main window appears. The user can then choose between two option, showed by two button. When the user choose an option by…
Ju Ctn
  • 33
  • 4
0
votes
1 answer

Trying to split a main window into two in Python

I'm learning Python by trying to build a simple plotting application and would like to have two windows in my main screen. I'm using the QSplitter module but am having no luck so far. I'd like the left portion to be used for inputting information…
0
votes
0 answers

Menu item now showing in PyQT6 GUI

I'm creating a basic pyqt6 application using the QMainWindow Class. My code is basic. I create a basic window, but whenever I execute this code, I do not see any menu: from PyQt6.QtWidgets import QStatusBar, QApplication, QWidget, QMainWindow,…
houba
  • 496
  • 7
  • 20
0
votes
1 answer

Error "bool object has no attribute" python message

I have a getFile function which will get the address of the csv file and print the filename in the command console. When I run the function in the main window, I keep getting "'bool' object has no attribute 'filename'". Why is this…
0
votes
0 answers

How would I customize QMainWindow with central Widget?

I am attempting to customize QMainWindow in my python file browser.py. I am going to try setting things like width = 300px or maybe setting colors like background.color = red later in a CSS file. I didn't know how to customize QMainWindow, so I…
0
votes
0 answers

What is the difference between using QMainWindow from importing and the use of uic.loadUiType?

Both of the following codes are codes that show empty gui. But the code above is QMainWindow From PyQt5.QtWidgets import QApplication, QMainWindow Use this and the code below is uic.loadUiType. If you look on the Internet, you can't see the…
agile
  • 77
  • 5
0
votes
1 answer

Why widgets are not displayed in PyQt6?

I am implementing an app through a class that has a QMainWindow member. I call two functions (create_side_menu, create_mixing_window) that display dynamically added widgets inside a bigger widget, which is added to the QMainWindow. The first…
M04
  • 31
  • 1
  • 1
  • 4
0
votes
0 answers

wrapped C/C++ object of type Aplicacion has been deleted

I'm trying to run this code in Python but this error appears. Does somebody knows why? I'm trying to creat an interface using python and QtDesigner. import sys from Main_window import * from Ventana_Dos import * import conexion from PyQt5.QtWidgets…
0
votes
0 answers

PyQt5 QMainWindow | Returning to Main Window (Dashboard/Home Screen) Using QToolBar Button

I am using a QToolBar for Navigating from page to page. Obviously I am using QMainWindow. The first issue I had was getting QWidgets/layouts on the QMainWindow. I was able to solve this issue with the solution used for this StackOverflow…
grippnault
  • 31
  • 6
0
votes
0 answers

How to add QLabels into QMainWindow in PyQt5?

I am trying to generate an interactive GUI to display dependencies between different systems. My idea was using PyQt5's QPainter to paint ellipses to represent the systems, and to afterwards use a QLabel in order to add the system's name (and some…
0
votes
1 answer

How to add menu bar and toolbar into the qdialog

Exists any solution how to add menu or tool bar into the QWidget dialog? I making something like ERP system. There are many windowses opening from others windowses. It's important that one (parent) window waiting for choices in children window. And…
exo
  • 373
  • 5
  • 22
0
votes
0 answers

Moving window blocks Qt SerialPort data reception

I am currently developing a Qt application which has a window and a serial port module. My problem is that when I press on the window or move it, the reception of the QSerialPort module (with the readyRead() signal) is blocked. The reception only…
Martin Denion
  • 352
  • 1
  • 3
  • 22