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

Close method does not close window pyqt5

A basic example, where I'm trying to call the close() method to close the main window, doesn't close the window, I have to close it manually. from PyQt5 import QtWidgets import sys class MainWindow(QtWidgets.QMainWindow): def __init__(self): …
user14094230
0
votes
0 answers

PyQt5 QMainwindow poped but hide

I got a problem with this code: note that i created esquisseUi with Qt Designer and pyuic5 import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox from esquisseUi import * class VueEsquisse(QMainWindow): def…
0
votes
1 answer

How to allow window resize after calling QMainWindow.setFixedSize?

I would like to know how to allow the user to resize the window after calling QMainWindow.setFixedSize ? For example, he click a button, that execute a function that re-enable the window resizement. I checked on the internet, but I didn't found…
PØL1
  • 5
  • 1
  • 6
0
votes
1 answer

How to have a timer in main.cpp in qt creator to update the GUI when a button is clicked?

I am creating a laundry machine simulation with my team for school. I have simulation.cpp where I have functions to control the GUI and main.cpp where I only call one Work() function which is supposed to check whether the user has clicked on a…
Eda
  • 93
  • 9
0
votes
1 answer

How can I detect when one window occludes another in PyQt5?

I'm using PyQt5 to create an app with multiple main windows. I want to be able to allow the user to save and load window sizes and window positions. That's easy with, e.g., QMainWindow.saveGeometry() and QMainWindow.loadGeometry() or the…
TSeymour
  • 729
  • 3
  • 17
0
votes
0 answers

Is there Qt function that allow me to insert QSpinBox to MainWindow?

I am creating SpinBox and then I am trying to make it visible inside my MainWindow. Is it any way to do it? Basically I am creating double array of Spinboxes dynamically in loop like this array=new QSpinBox *[y+1]; and in another loop like…
Mike
  • 1
0
votes
1 answer

Create a dependent window?

I want to create a secondary window which is free-floating in relation to the main window. But I also want it to close when the main window closes. Indeed, I want the application to end completely when the main window closes, and assumed this would…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
0
votes
2 answers

How to Add Items to QComboBox from another class PyQT?

I'm designing this thing on Qt Designer using PyQt. So I have a QMainWindow from where the user can open a QDialog to Input some data I'm saving in a Json file (AddUser function below) What I want is when the AddUser push button is clicked, from the…
Hamouza
  • 356
  • 3
  • 12
0
votes
0 answers

Zoom QMainwindow

Short context: I have a QMainwindow with an mpv player inside. I play videos with mpv, create overlay images with PIL and run it all in the pyqt window. The overlay image is updated more or less every frame of the video. Here is my issue: If the mpv…
jkazan
  • 1,149
  • 12
  • 29
0
votes
2 answers

PyQt5 on MacOs. Custom QMenuBar added to QMainWindow is not clickable

class MenuBarWidget(QMenuBar): sig_new_file = pyqtSignal() sig_open_file = pyqtSignal() sig_save_file = pyqtSignal() sig_page_setup = pyqtSignal() sig_print = pyqtSignal() sig_exit = pyqtSignal() sig_status_bar =…
jihoon
  • 19
  • 5
0
votes
1 answer

QDialog is on top of every Application

we need to execute dialog on top of every windows application. we tried some code below for that but its not working for us. setWindowFlags(Qt::WindowStaysOnTopHint); setModal(true); setWindowModality(Qt::WindowModal); can you Please let us know…
0
votes
0 answers

In PyQt4 does QWidget with QFormLayout not work if called from QMainWindow?

Tried to search for this, but couldn't find an example where anyone is calling up a QWidget with QFormLayout from QMainWindow. I am trying to make an object I can call from my main application to take input from the user, and I want to use…
0
votes
0 answers

QMainWindow disappears when you resize it vertically

if I try to resize my QMainWindow vertically, it quickly goes down the screen until it's no longer visible, but the size will never change, no matter if I enlarge or reduce it. I basically just show it and place several Buttons/VLayouts etc. in it,…
knolperlap
  • 26
  • 5
0
votes
1 answer

How to receive QMainWindow mouseClick events in a parentless QWidget?

I have a QMainWindow application that generates multiple QWidget popups. I would like to know how I can destroy the pop up QWidgets if the user clicks on the main QMainWindow. I am not sure how to proceed with the resolution of this problem. I do…
user3840530
  • 290
  • 1
  • 4
  • 14
0
votes
1 answer

PyQt5: attach button position to the window coordinates

So, I'm trying to experiment a bit with PyQt5. I have created a basic window with two QPushButtons. from PyQt5 import QtWidgets from PyQt5.QtWidgets import QApplication, QMainWindow, QSizePolicy import sys class Okno(QMainWindow): def…
Josh E.
  • 69
  • 1
  • 8