Custom Layout in Qt Designer - c++

Is there anyway that we can have Custom Layouts e.g. as defined at
https://doc.qt.io/archives/qt-4.7/examples-layouts.html
inside the Qt Designer ?
What would be the process to add such custom layouts in the Qt Designer? Can anyone guide about the steps involved for such custom enhancement in Qt Designer.

You can't create custom layout right inside QtDesigner. Instead you can write your layout as a plugin for QtDesigner. After this you can open QtDesigner and just drop your own layout to the form as any other widget in the Qt collection.
See this quide to find out how to write your own plugin for Qt. It's not so difficult.

Related

Creating tabbed document interfaces in Qt Designer?

I am trying to write a program that will use a tabbed document interface (TDI) like seen in Notepad++ or most web browsers. I know how to build GUIs using Qt Designer, and code in Qt C++ (after a few days of playing around).
I have created an example of what each page widget will look like using Designer, and now I want to add the ability to create and testroy tabs at runtime, each containing a unique instance of the page widget. However, I have no idea how to do this without adding a class that extends QWidget, and building the page widget with code. I could go down this route, but I'm sure there must be a better way of creating a TDI; but I can't find any tutorials or examples of how to do this.
Does anyone have any suggestions?
For creating tab interfaces you should look into QTabWidget.
It is a container widget included in Qt Designer which automatically handles operations on tabs. It has several build in methods for manipulating its tabs and theirs contents.
Each page of QTabWidget is handled separately and can have different layouts and functionality.
If you want to include several different objects to one page assign a layout to it and then assign the objects to the layout.

How to create a Multi widgets Qt application

Is it possible to develop an application with a multitude of interfaces (widgets), where each widget has its own .cpp and .h file? If so, can you suggest a way to do that?
I am aware of the stacked widget way but this method doesn't allow me to separate the code of each page from the others.
I need to have the general structure of my application to be similar to an android application developed in Eclipse.
You can create widgets separately, then, dynamically construct QStackedWidget and add widgets to it using addWidget method
PS. you can also use widget promotion, to have QStackedWidget be created by QtDesigner and filled with your widgets
http://doc.qt.digia.com/stable/designer-using-custom-widgets.html

Qt - ComboBox automatically in TableView?

So in my project, I had a TableView and i edited some of its info's in the Qt Editor itself. I also implemented all the codes for it and when I ran before, I could see a comboBox in a place of int. But for some reasons I had to replace that TableView with a new one. All the codes are the same, but I don't see any comboBox now. So does that mean the comboBox appeared for something done in the Editor?
If you replaced your TableView in the qt designer and gave it the same name as before it shouldn't do anything to your c++ implementation of your class. The settings you enter in the qt designer will be deleted when you delete the TableView and you have to re-enter the ones you had before. So you can still use your previous c++ implementation of your class.
I usually design my gui in qt designer and then create a class that sets up signals/slots and initializes the widgets to my liking. So if you had setup your widgets from your class constructor you wouldn't have to worry about any of this.
Good luck!

Extract a portion of a Qt .ui file into its own .ui file

We have a designer creating a user interface for an application. The main window has several QStackedWidgets used for in place panel switching. What I'd like to be able to do is extract each individual panel that makes up each page of the QStackedWidget into it its own .ui file.
Is there an easy way to accomplish this from within Qt Designer, or are there any other tools to help accomplish this task short of redesigning all of the panels in their own .ui files?
You can cut/paste each panel into a blank QWidget (created with File > New), and save these widgets in their own .ui file.
When you copy a widget(lets call it widgetA) that contains other widgets(calling them miniWidgets) then the miniWidgets should still be layed out. WidgetA still needs a relayout and in that case its very easy to add a layout since you can practically use any layout you want (i suggest vertical or horizontal). Just right click on the widget containing widgetA then select Layout->horizontal Layout and that should do the trick.
If there is more than one widget than needs relayout then you are not copying the panel correctly and should copy one that englobes more of the panel.

How do I add controls other than buttons/actions to toolbars in Qt, such as text boxes and combo boxes?

From the screenshot featured on this page http://www.kde.gr.jp/~ichi/qt/designer-manual-3.html it seems like this functionality was available in Qt3. Was it removed in Qt4?
I don't believe you can do so from within Designer. You can add other widgets programmatically using QToolBar::addWidget().