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

Why does my toolbar dock to the incorrect location?

I have a weird scenario. I create a QMainWindow that is embedded in a QGraphicsScene. I want to have multiple QMainWindows each with a toolbar inside the scene. I'm simulating an MDI Area, without using the QMdiArea class. Here is the…
0
votes
1 answer

How to fix Qt QMainWindow's Draggable Area Issue with QToolBar in QGraphicsScene

I'm facing a strange issue when trying to add a QMainWindow to a QGraphicsScene. For all intents and purposes, please do not recommend me to use the QMdiArea as the alternative, because that distracts away from the actual issue I am having and it…
Blanky
  • 63
  • 9
0
votes
0 answers

Open QMainwindow from QDialog pyqt

I have a QDialog which is a login window. When the login is successful, I would like to open my MainWindow from QMainWindow class. I have herited my QMainWidnow from a UI_file generated with QtDesigner. To be more specific, I have the…
froz
  • 163
  • 1
  • 12
0
votes
1 answer

How to refresh/update/repaint QMainWindow from QDialog?

I have a QDialog which has some settings, on the basis of which, QTreeView or the whole QMainWindow needs to be updated or repainted or refreshed. QDialog has two buttons: Apply: This button needs to apply the settings to QMainWindow, such as…
mehak
  • 57
  • 7
0
votes
1 answer

qml mainwindow background gradient

I have such an idea. I want to have a gradient instead of a monochrome background in myApp main window. I tested different ways of code, but without success. The result is always the same. Either the background is pure white or the black and white…
exo
  • 373
  • 5
  • 22
0
votes
2 answers

Put a QToolBar in a QWidget instead of QMainWindow

I am trying to put a QToolBar on a layout of a QWidget instead of QMainWindow. On QMainWindow and QWidget is working fine, but when i try to add it on a layout first, is not. Am I doing something wrong? Is it possible? Here is my code: from PyQt4…
ioaniatr
  • 277
  • 4
  • 15
0
votes
1 answer

QLabel changing color when mouse passed over then

sorry for the bad english, this isn't my first language. i need help with QT. i had to make a board, like chess board an 8 by 8 matrix of tiles. so i made a class that inherits of QLabel named as "Casillero" and another one that is the board itself…
Mattii
  • 109
  • 6
0
votes
1 answer

PyQt5 - drawPixmap on QMainWindow with toolbar (can't fit to window)

I have a QMainWindow with a toolbar, and I'm having troubles with fitting the QPixmap to the window, such that it won't tackle with the toolbar. I want to display the picture: And from the code: import sys from PyQt5.QtCore import QRect from…
sheldonzy
  • 5,505
  • 9
  • 48
  • 86
0
votes
2 answers

How to move the central widget in PyQt in python

Im using PyQt5 and I know you can make other things like buttons move to other positions with move() but that isn't working for me in this instance, however it is working when I set up the positions for some of the buttons I made earlier. For some…
ParPro
  • 197
  • 1
  • 6
  • 16
0
votes
0 answers

Qt MainWindow | ui->setupUi(this) error

I keep getting an error when using: ui->setupUi(this) error If anyone knows what the error might be, I would be very grateful. MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // This is…
John Smith
  • 31
  • 1
  • 6
0
votes
0 answers

exporting a member function of application to be called by shared library

How could I export a C++ class function to be used with a shared library in Linux for sending continuous updates I have an application C++ code which has a processing class function called updateFcn, I have to pass in updated structure data every…
user2345
  • 537
  • 1
  • 5
  • 22
0
votes
1 answer

QT: cannot control my QGraphicsPixmapItem with keyboard even after setfocus()

I am making a game requiring qgraphicspixmapitem moving around in the view. Now, I plan to move my QGraphicsPixmapitem up and down with my keyboard. It works perfectly fine initially. But since my scene's and view's size are unequal then, which…
0
votes
1 answer

how to make a mainwindow as a MDI parent in qt

how to make a mainwindow as a MDI parent in Qt creator
0
votes
1 answer

Can't open gui class window with specified options

I'm new to python and pyqt. I'm trying to open a new window after the first screen. My second window opens but without the options I specified, label and pushbutton. from PyQt5 import QtWidgets import sys class…
Reese_E
  • 1
  • 2
0
votes
1 answer

Overloading event on QMainWindow blocks all other events

I want to handle the QEvent::WindowDeactivate and for this I overload this function on my QMainWindow derieved class. class MainWindow : public QMainWindow .... bool event(QEvent * e); .... bool MainWindow::event(QEvent *e) { if(e->type() ==…
3dmodels
  • 103
  • 7