Questions tagged [qwidget]

QWidget is key part of the Qt C++ classes. QWidget is the base class of all the user interface elements in the Qt framework.

The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a Z-order. A widget is clipped by its parent and by the widgets in front of it.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

1466 questions
75
votes
9 answers

How to make an expandable/collapsable section widget in Qt

I would like to create a custom widget in Qt with the following features: It is a container It may be populated with any Qt layout It may be inside any Qt layout A button allows to collapse/fold vertically the content, so only the button is…
Adrian Maire
  • 14,354
  • 9
  • 45
  • 85
40
votes
6 answers

QVision Widget Error upon compile

Only one error to go until I get to use this for my research! Warning: Z-order assignment: " is not a valid widget. FILE: qvvideoreaderblockwidget.ui There's no line number that came with it. I tried finding but, failed to see an open-ended part.…
Rek
  • 571
  • 1
  • 6
  • 14
38
votes
5 answers

Qt5. Embed QWidget object in QML

I am using Qt5 beta and trying to embed a QWidget-based object into QML. The goal is to use QML as much as possible, and only use QWidget objects where QML does not do what I need. I found a link explaining how to do this for Qt4.7, but I have not…
eatyourgreens
  • 1,053
  • 1
  • 12
  • 16
37
votes
1 answer

What is the difference between a QWindow and QWidget

The Qt 5.0 provides a new QWindow class. While the documentation on this class is quite comprehensive, I am failing to see how exactly the QWindow is different from the QWidget class, and in which cases you would prefer the former. Both provide a…
Yellow
  • 3,955
  • 6
  • 45
  • 74
35
votes
4 answers

How to set QWidget width?

How to set QWidget width? I know setGeometry(QRect& rect) function to do that, but in that case I should use geometry() function to get former parameters of my QWidget, then I should increment the width and use setGeometry(..). Is there any direct…
Narek
  • 38,779
  • 79
  • 233
  • 389
32
votes
1 answer

QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout

I want to create some tabs, and I read this answer: How to add a tab in PySide I use the code in the answer and made some changes. Cause my code has to read some files and get the name of my tabs from those file, so that I add a for loop in my code.…
EricBkc
  • 369
  • 2
  • 4
  • 12
26
votes
4 answers

Qt Hide Taskbar Item

I have a custom QWidget and I simple don't want it to show up in the taskbar. I have a QSystemTrayIcon for managing exiting/minimizing etc.
user372743
26
votes
3 answers

How to assign callback when the user resizes a QMainWindow?

Neither I could find a tutorial-like scheme for a resize event on QMainWindow, nor I did see any option for adding resize event in the drop-down menu at the Qt design window. I am new to Qt. I'd like to write a slot function for a QMainWindow…
Barney Szabolcs
  • 11,846
  • 12
  • 66
  • 91
25
votes
2 answers

Qt Increase QTabWidget's QTabBar size

I need to make the tabs that I have oriented at the bottom of my QTabWidget larger. We'll be using a touch-screen, so the default sizes are a little too small. I see no easy way to do this (currently seeing no good way to even do it at all. The only…
San Jacinto
  • 8,774
  • 5
  • 43
  • 58
23
votes
5 answers

How to Clear all the Widgets in Parent Widgets?

I am using the constructor QWidget(QWidget *parent). This parent widget contains a lot of child widgets. I need to clear all the child widgets from the parent at runtime. How can I do this?
saravanan
  • 1,605
  • 6
  • 20
  • 25
23
votes
2 answers

How to set user data for a QWidget?

I would like to set an integer number to be stored in a QWidget, and I think the setUserData member function would do the trick but I can't find any documentation. Any hints?
Barney Szabolcs
  • 11,846
  • 12
  • 66
  • 91
19
votes
6 answers

How to remove QWidgets from QSplitter

In my app have a window splitted by a QSplitter, and I need to remove an widget. How can I do that? I can't find useful methods
JuanDeLosMuertos
  • 4,532
  • 15
  • 55
  • 87
18
votes
1 answer

Why is QWidget's destructor not virtual?

Looking at qwidget.h, I found the destructor as below: ~QWidget(); I was wondering why this is not declared as virtual
S B
  • 8,134
  • 10
  • 54
  • 108
16
votes
3 answers

Need something like a finished-signal from QWidget

I'm searching for something like the finished-signal from QDialog, only for QWidget. The reason is, I disable my toolbar once the widget pops up (which isn't a problem at all) and I want the toolbar to be enabled again, once the widget is closed. I…
LarissaGodzilla
  • 620
  • 2
  • 10
  • 21
16
votes
1 answer

Duplicate a QWidget

I need to be able to copy a Qwidget so I can duplicate a window because it will change during runtime. is this possible? void Duplicate(QWidget * Show) { //I tried... Qwidget Shw = *Show; //but operator= is private //and the copy constructor (I…
Geore Shg
  • 1,299
  • 5
  • 23
  • 38
1
2 3
97 98