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
4
votes
2 answers

Why doesn't menu get added?

I'm clearly missing something here; why doesn't the File menu get added in this little example app? import sys from PySide.QtGui import * class Window(QMainWindow): def __init__(self): super(Window, self).__init__() …
Daniel
  • 2,032
  • 5
  • 21
  • 27
3
votes
1 answer

Qt Dialog in Main Window, make the background dimmed

I am trying to create a dynamic custom dialog class. That takes the central widget as a parameter and that centralwidget will be the main widget of this custom dialog. (for dynamic) When It will show itself, it will make the background…
Dream59
  • 101
  • 6
3
votes
1 answer

More efficient central widget in a QMainWindow: QGLWidget VS QGraphicsView

I am using a QMainWindow for my app and want to do some openGL rendering. 2 approaches: 1) set as central widget a QGLWidget and do all the rendering there, OR 2) set as central widget a QGraphicsView, set the viewport to my QGLWidget to create…
Sassa
  • 3,294
  • 2
  • 28
  • 42
3
votes
1 answer

How to avoid bringing QMainWindow to the front when clicking on independent QWidget

I am working on Qt app. There I have QMainWindow and QWidget which is displayed independently and out of the window. I want to achieve that if I click on that QWidget, the window doesn't come to the front. I.e if it is behind another app, it should…
RuLoViC
  • 825
  • 7
  • 23
3
votes
1 answer

Troubleshooting Crash within PyQt5 Application (QDialog -> QMainWindow)

I am currently trying to troubleshoot an issue I am running into with a Qt application I am developing in Python. I only have a simple Main Window and a modal QDialog setup to collect user input after triggering a menu action on the Main Window. The…
soprano82
  • 33
  • 4
3
votes
1 answer

How to access QstatusBar in QMainWindows from a widget class?

I'm trying to change the text of a Qstatusbar created in a mainwindows Class from another class I've try several thing for the web but didn't find the answer ... class MainWindow(QMainWindow): def __init__(self, widget): …
Mamquam
  • 37
  • 6
3
votes
3 answers

Show QMainwindow in the middle of the screen

I want show my project main window in the middle of the screen . when i call "self.show()" then the window show in the middle of the screen .
Arjun Jain
  • 401
  • 1
  • 8
  • 20
3
votes
1 answer

Can a QToolbar be added to a QDockWidget?

I have setup my app to have various dock windows within the main window. I am also able to add a toolbar to the main window. However, I would ideally like to add the QToolBar inside one of the QDockWindow instances (or the QWidget that it houses) as…
Alan Spark
  • 8,152
  • 8
  • 56
  • 91
3
votes
1 answer

Set priority between vertical and horizontal QToolBar positioning

I've searched for quite a long time, but I haven't managed to find a solution to this problem: In QtCreator, I have a main window with 2 QToolBars, one vertical (Qt::LeftToolBarArea) and one horizontal (Qt::BottomToolBarArea). The idea is to have a…
3
votes
2 answers

How to create a menu-bar in a QMainWindow

I am writing a small application using PyQT. I am trying to create a menu bar at the top of the application containing the usual options ("File", "Edit", "Options" etc.) but my toolbar is not appearing when I try to add it to my QMainWindow class. I…
Thalamus
  • 167
  • 2
  • 10
3
votes
1 answer

PyQt5 set Mainwindow background transparent

I am attempting to make the top border of my app semi transparent (rounded edges) by using the partially transparent PNG below: This does not work and ends up having the corners filled in when the app is launched. A simplified code is below: from…
Kermit
  • 329
  • 6
  • 19
3
votes
1 answer

Opening a new QMainWindow crash after destructor

A first MainWindow is open in the main ,then when I try to open a second window the program crashes with a SIGABRT . The debugger shows the following lines: double free or corruption (out): 0x00007fffffffe340 *** RTTI symbol not found for class…
3
votes
2 answers

PyCharm showing wrong parameter info for PyQt methods

I don't do a lot of work in GUI's, but I've decided to move from occasionally using PyQt4 to PyQt5. My IDE is giving me warnings about some of the __init__ functions, particularly QWidget and QMainWindow. If you look at the IntelliSense'd…
Goodies
  • 4,439
  • 3
  • 31
  • 57
3
votes
1 answer

QDockWidget in QMdiArea subwindow not dockable on top and bottom

In my current project, I implemented a Qt application with several MDI forms that are containing several QDockWidgets. The application looks roughly like that: Here is the code snippet: #include #include #include…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
3
votes
1 answer

Qt5 linux how to set window icon image

I have a UI I have designed in Qt designer and have written the code in c++. I am using catkin, which is just cmake, to build my project. Currently when the program is launched, the application icon looks like, .I would like to have that be an image…
jlack
  • 305
  • 2
  • 13