PDA

View Full Version : how to resize top level widget in mainwindow .....



mouni
16th August 2016, 07:12
m_pCameraWidget = new CameraWidget(this); // was declared in main application constructuor // Qwidget class name as m_pCameraWidget i has given.....


// in camera Qwidget i has given
void CameraWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
if(!isMaximized())
{
showMaximized();
}
else
{
showNormal();
}

}

m_pCameraWidget = new CameraWidget(this); //how to resize camerawidget is the top level widget where (this) is mainwindow

anda_skoa
16th August 2016, 07:16
m_pCameraWidget = new CameraWidget(this); //how to resize camerawidget is the top level widget where (this) is mainwindow

A top level widget, like any other widget, can be resized by calling resize() or setGeometry().

The rest of the posting looks like you have accidentally copied&pasted content of one of your earlier postings.

Cheers,
_

mouni
16th August 2016, 11:21
i called set geometry it is not resizing...


when we remove (this) then it is resizing.....


can anybody tell why it is not resizing


camerawidget is frameless widget.....

mouni
17th August 2016, 08:38
Hi Freinds,

can any body give some code for mouse double click...

First when i click mousedouble click it should resize to (800,800)..

again i mouse doubleclick it should set to (320,240)....

can any body give some solution with code i am learner i am enable to write code for that...


plz help me...

anda_skoa
17th August 2016, 18:50
Did you add the widget to a layout?

Cheers,
_

anda_skoa
17th August 2016, 18:54
This is extremely borderline to a multi post, please don't do that.

And you yourself have already posted code that reacts to mouse double click, just call resize instead of what you did in those code snippets.

Cheers,
_

mouni
18th August 2016, 06:03
no i am not added to layout it is seperate widget for that widget i added layout

mouni
18th August 2016, 06:05
gave resize but it is not resizing that widget inherited to mainwindow and widget is frameless widget..... that is seperate widget

anda_skoa
18th August 2016, 09:10
You write that "this" is a QMainWindow.

Where in the main window do you put the child widget?
The only child widget a developer is supposed to add directly is the central widget, because the main window has a rather complex layout.
What is the child derived from? Is it a window or an embedded widget?

There is really no point of spreading bits of information over several threads, this just makes it more complicated to follow.
I'll merge the threads.

Cheers,
_