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

Modality of QMainWindow. Why Qt::WindowModal doesn't work as what I thought?

I met some problem when using Qt window and set window modality to WindowModal, really appreciate if someone can help me solving this problem I have a window called A, it's parent of 3 windows B1, B2, and B3 (they are same class and generated in…
Claire Huang
  • 961
  • 1
  • 18
  • 30
0
votes
1 answer

How to focus or show menu bar item in Qt

I'm working in my thesis project, I need to know if it's possible to "open" automatically a menu item in my QMainWindow. I mean, if my menu bar is: File Help -Open -About... -Close -Manual ... ... How…
Hermandroid
  • 2,120
  • 4
  • 29
  • 35
0
votes
1 answer

Wierd DockWidgets effect

Using the QMainWindow I have added 3 DockWidgets and set centralWidget to 0, so now the DockAreas can take up all the space. Have a look: This looks the way I want and behaves even more so. But There is one effect that breaks it all. When I rip…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
1 answer

QtDesigner layout confusion

I've been playing around with QtDesigner for some time now, but I can't find a real solution for my desired layout. Here's what I'm aiming for, kind of an Eclipse RCP-like layout: Five drag&dropable widgets which can be rearranged and whatnot (so…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
1 answer

PyQt4 QMainWindow with different view's as QWidget

I am new to PyQt4 and i try to make a QMainWindow in which I can change the views. I use the QtDesigner plugin for eclipse. I make a QMainWindow with some space for a view. The view is a QWidget made in QtDesigner, too. So how can i show my QWidget…
Chris
  • 159
  • 3
  • 14
0
votes
1 answer

Qt QMainWindow difference between closing by user and abort via system

Could you tell me how can I determine between QMainWindow close event initiated by user and abonormal termination by SIG_KILL in Linux or TerminateProcess() in Windows? That's because the difference in urgency exists. I can refuse closing by user or…
0
votes
2 answers

Qt/C++ – How to differentiate between closing main window from an external app and clicking close button click from title bar?

I currently have a QMessageBox appear on exiting from MainWindow, asksing "Are you sure?". While updating the app through InnoSetup installer file, the installer tries to close the MainWindow, however, the "Are you sure?" button still appears, which…
0
votes
0 answers

QThread does not work or if i define callback function in __init__ phase it worked callback function but does not thread work

i new on stackoverflow, so i tried to make Thread from MainWindow, but it does not work when callback function i put in run(self):. below is part of code from PyQt5 import QtCore, QtGui, QtWidgets, uic from PyQt5.QtWidgets import QWidget from…
Dav Mar
  • 1
  • 1
0
votes
1 answer

When I used a custom Widget as the CentralWidget for QMainWindow in PyQt6, there was a gap between the CentralWidget and the QMainWindow

When I used a custom Widget as the CentralWidget for QMainWindow in PyQt6, there was a gap between the CentralWidget and the QMainWindow? I wonder why that is.Here's my code: from PyQt6.QtWidgets import QApplication, QWidget, QMainWindow, QLabel,…
poison
  • 3
  • 2
0
votes
1 answer

How can I emit a signal from QMainWindow to QThread in PyQt5?

how to pass data(variable) from QMainWindow to Qthread? I am trying to create a save function that takes user's input but the function itself is in QMainWindow class and savepath in Qthread class. How do I emit a signal from QMainWindow to Qthread…
D121
  • 1
0
votes
1 answer

QMainDialog become modal if has modal QDialog as parent on Mac OS X

I create QMainWindow with parent widget which is modal QDialog. QMainWindow created as modl window ontop of dialog and doesn't has active close, minimize buttons and has grayed(unaccessable) menu. I suppose access to QMainWindow's menu restricted…
andrey.s
  • 789
  • 10
  • 28
0
votes
0 answers

How can QPixmaps get auto-resized in PyQt6 when the Mainwindow is resized?

I'm playing around with QPixmaps in PyQt. I want to make them resize while maintaining the same aspect ratio when the window resizes, but when I try, I can only make the window bigger, never smaller. Why is this, and is there a workaround? Here is…
Gregorick
  • 61
  • 1
  • 1
  • 4
0
votes
0 answers

PYQt5 GUI refreshes only when pressed

i am working on a program that has a GUI table widget using PYQT5 on pycharm. I preset the table before executing the GUI, but start entering the contents after the execution, as the program goes. The problem is that the graphic itself doesn't show…
0
votes
0 answers

pyqt6 change font size on MainWindow resize

I'm new to pyqt and trying to make a degrees converter application. Now I want to make the text resizable, when I resize MainWindow. The code: from PyQt6 import QtCore, QtGui, QtWidgets class Ui_MainWindow(QtWidgets.QMainWindow): def…
ploqop
  • 1
0
votes
0 answers

pyqgis plugin change QDialog to QMainWindow

I have a plugin window is QDialog, but I want to add QMenubar or QStatusBar I have tried to find a way to convert QDialog to QMainWindow, but there is no result, So I try to add QMenubar in QDialog again and everything works fine Until the position…
Eason
  • 1
  • 1