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

How to set QMainWindow as the modal one?

I am using QMainWindow for GUI development of my project..One problem I am Stuck with is blocking all other visible windows from getting input, while one is in operation. I can not use QDialog.Because rich features of QMainWindow is required. How…
manmatha.roy
  • 577
  • 1
  • 9
  • 22
3
votes
0 answers

When is an active QMainWindow window not really active?

I have a Windows Qt application that creates a QMainWindow, dismisses (closes and deletes) it, and then creates a new QMainWindow. The new QMainWindow needs to do some setup whenever it is the 'active' window in the system, and needs to do some…
Ted Middleton
  • 6,859
  • 10
  • 51
  • 71
3
votes
3 answers

Make two QDockWidgets mutual execlusive at the same position

I have two QDockWidget's, only one of them is visible at the time, I manage that by toggleViewAction(). What I need to do is that I want the two QDockWidget's to be in the same location, with the same size and docked at the same dockWidgetArea with…
Mahmoud Hassan
  • 598
  • 1
  • 3
  • 15
3
votes
3 answers

QMainWindow stops receiving QEvent::UpdateRequest when user opens menu or resizes window

MyWindow which inherits from QMainWindow. MyWindow contains a QGLWidget that displays an animation. The problem is that the animation pauses whenever I open a menu or resize the window. The animation is implemented by calling…
jlstrecker
  • 4,953
  • 3
  • 46
  • 60
3
votes
1 answer

How to set focus to a QWidget, on a different window

I have created two QPushButton on two different QMainWindow. I am assigning focus to them randomly at a specific interval.Here is the code. int main(int argc, char **argv){ QApplication a(argc, argv); QMainWindow *win1= new…
manmatha.roy
  • 577
  • 1
  • 9
  • 22
3
votes
1 answer

How to set the desired size of a QMainWindow with QScrollArea?

I am working on a project where I have to display a pretty large (vertically) main Widget. In the initial Version of my GUI it was just added as the central Widget of a QMainWindow, which caused the Problem that on small screen resolutions the…
Andreas Wilkes
  • 993
  • 9
  • 16
3
votes
1 answer

Making Qt Widgets Stretch and Scale w/ Main Window

I'm wondering if there is a way to make Qt widgets within a QMainWindow widget stretch and scale as the size of the main window is stretched and shrunk. Basically, I'd like the entire window and it's contents to have the same appearance except for…
sj755
  • 3,944
  • 14
  • 59
  • 79
3
votes
1 answer

Inheriting a MainWindow class from QMainWindow and Ui_MainWindow

I am learning Qt, Qt 5. When I start Qt Creator and create a project with ALL the default settings, I get these 2 files generated, (I am excluding main.cpp and the .pro file) mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include…
Shravan
  • 2,809
  • 2
  • 18
  • 39
3
votes
1 answer

Application window on Multi monitor screen and centre placement

I've a QMainWindow, which is launched by another application. The problem is, in a multimonitor setup, the application launching my QMainWindow, might reside on the 3rd screen, but my window will always launch on the first. I worked around this in…
user1173240
  • 1,455
  • 2
  • 23
  • 50
3
votes
1 answer

How to rezise the contents of a QMainWindow according to window size

I have a QMainWIndow with several widgets, one of which is a QTableView. The Main WIndow is resizable. How do I resize the contents of the window automatically, the font and everything, i.e. when the window is resized, its contents should also get…
user1173240
  • 1,455
  • 2
  • 23
  • 50
3
votes
1 answer

Can I have a Qt project without mainwindow?

I'm starting a new Qt project. Is it mandatory to have a mainwindow in my project? I only have qdialogs and qwidgetsas I don't need a toolbar.
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
3
votes
3 answers

Detect end of movement of QMainWindow / QDialog (Qt 4.8)

I’m using Qt 4.8.3 on X11. I need to know when the user ends with dragging a window around the screen, this in order to read the final position and eventually start an animation to adjust the window position to an “allowed” one. I noticed that the…
Matteo Murgida
  • 161
  • 2
  • 7
3
votes
1 answer

Can't move QDockWidget

I want to create a widget that contains several QDockWidgets on purpose of putting it into a QMainWindow. Problem is that if I add QDockWidgets to my QWidget class with layout->addWidget(dockWidget);(I don't know any other way of doing it) and then…
user1433602
2
votes
2 answers

PyQT4 - Replacing widgets on main window

I`m new in PyQT4 and I've faced the problem below. Some application must collect users' data on one screen and show next screen on button click. main.py app = QtGui.QApplication(sys.argv) #here I create main window with inherited class w =…
user3777
  • 41
  • 4
2
votes
0 answers

How can I inherit the parant class' function in Qt model?

When I try this code, the child class(addwindow) can't recorgnize self.load_region(). How can I inherit the parant class's load_region() function? class MainWindow(QMainWindow, main_ui): def __init__(self): super().__init__() …