Qt gui creation, widget resizing - qt

I am new to Qt development, even though I have years of MFC programming. I am trying to create a dockable widget and put some controls in the dock widget, a tab widget to be more precise. My problem is that the tab widget inside the dock widget doesn't resize along with the parent.
I'd like the tab widget to fill the entire area of the dock widget. Is it possible to manipulate some property in the same gui designer?

I don't know If I understood your question, but try this: click anywhere the DockWidget (and outside the tab widget) and press the button idicated by the red arrow (it will be blue). Is that it?
This:
Becomes this:

Related

Can't dock a Dock Widget when used inside a Widget

I've insert a Dock Widget inside a widget, and I want to Check the dock Checkbox inside the Designer in order for it to be docked. But this seems impossible to do since it is disabled like shown in the following picture:
I also tried the following line of Code:
ui->dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
But it seems that it has no effect...
The 'dock' property enabled in MainWindow Form
if you are using Widget, change it to MainWindow and dock will work properly

Qt: how to add a close and minimize button to a widget, that is embedded into another widget?

I want to embed some widgets into anothe Qt widget (into docking widget, for example). But I want to let user minimize or close them (just like the widgets on the right half of the picture)
Can you tell me, how can it be done?
You can implement it by using the QMdiArea
Read this blog How to tile widgets in a MDI application
here is Qt example code

Qt: mainwindow application

I would like to build an embedded Qt application. This application shall have a couple of windows which are invoked by button click. I don't know if I understood the concept of using qmainwindow in the right way:
Do I create one QMainWindow class and each other window that should be displayed is a widget placed as central widget or is any new window I call a new QMainWindow?
I do not use qmainwindow's tool, menu or status bar just the dock widgets which surround the central widget, like a header on top and a button bar at the bottom or a widget to the reight like a keyboard. Since the header's label stays the same (only the title and the icon changes) and the bottom bar always holds some button (which should call another central widget or return to the previous one), changing the central widget should be sufficient right?
Have a look at QT Layouts
http://qt-project.org/doc/qt-5.1/qtwidgets/layout.html
Remember you can nest layouts, so you probbaly want a VBoxLayout, and the second entry in that layout will be a HBoxLayout.

How can I add a QLineEdit to Menubar

I am attempting to reclaim some screen real estate in my application. I've got a search bar that is a basic QLineEdit and takes up space. In my menu bar, I easily have enough room to fit this search box, but I can't figure out how to get the LineEdit into the menubar.
Can someone assist me in getting this added to a menubar?
I am using Qt 4.7.
Here is an image of what I am attempting to accomplish. It's fairly basic image, but I'm looking to use the right half of the menubar as a search box.
Use QWidgetAction. QWidgetAction is for inserting custom widgets into action based containers, such as toolbars.
here is an example to add a progressbar to menu bar :
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(new QProgressBar(this));
menubar.addAction(widgetAction);
You could use
void QMenuBar::setCornerWidget ( QWidget * widget, Qt::Corner corner = Qt::TopRightCorner )
to add your widget in the menu.

QDockWidget move problem when using custom title widget

I want to create a dock widget with a custom title widget. That custom title widget has my own icons (maximize, minimize, close etc).
Source code is simply like that:
QDockWidget *dock = new QDockWidget("name", parent);
MyDockTitle * titleWidget = new MyDockTitle(dock);
dock->setTitleBarWidget(titleWidget);
When I run the program, dock widget is shown appropriately but unfortunately I can not move the dock widget (it is in floating state). What can be the problem?
P.S. When I dont use custom title widget, I can move dock widget.
Thanks...
The Qt documentation of setTitleBarWidget() says:
Mouse events that are not explicitly
handled by the title bar widget must
be ignored by calling
QMouseEvent::ignore(). These events
then propagate to the QDockWidget
parent, which handles them in the
usual manner, moving when the title
bar is dragged, docking and undocking
when it is double-clicked, etc.
So I guess you need to add some QMouseEvent::ignore() calls to your MyDockTitle class.

Resources