What class does an edit interface need to inherit from? - qt

I need to make an edit page as shown in the figure. Which class of QT should I inherit from? QDialog? QWizardPage? Or which class?

Related

Qt Designer custom dialog template

I have created custom dialog class that inherits from QDialog. I would like to use it in a Qt Designer.
However there is a problem, as I do not know how to add it to the templates, that I could pick, when I select File/new.
I also tried to start with QDialog and then promote it to my custom class, however context menu on the form does not give me option to promote or change type of the form.
Is there a solution to this problem which does not include manually tweaking generated .ui file ?

How to load a QtDesigner ui form into a QFrame of another ui form?

I have designed a QWidget based QtDesigner ui form. Lets call it Form1. I added few pushbuttons and labels in it. Now I designed another QWidget based qt ui designer form.Lets call it Form2. I have a QFrame in Form 2 in which I would like to load Form1.
I did some reading and I found that I could right click on QFrame and choose promote to. I put the base class as QFrame. Promoted class name as Form1. Header file as form1.h.
I get errors now saying:
Form1 has no member named 'setFrameShape'
Form1 has no member named 'setFrameShadow'
I changed the base class as QWidget. And it still did not load the Form1 in the QFrame of Form2
Any help is appreciated.
EDIT:
I used base class as QFrame and
I commented out following lines in the ui_form2.h and it worked frame->setFrameShape() and frame->setFrameShadow() and it worked.
If there is better way to do it kindly let me know
Promoting a widget in designer is just a way of saying "I know this looks like <Standard Widget>, but when you generate code I actually want you to create a <More Specialized Widget> here instead." The widget you promote (and the base class for promotion) need to be of a type that is an ancestor of the type you are promoting to.
In your specific case, the base for your promoted widget should be QWidget (instead of QFrame), because that is the type of Form1. You should put a plain QWidget inside your frame and promote that widget instead of the frame.

Visual form inheritance in Qt

I'm newbie in Qt. I came from Delphi IDE. I can't find solution to inherit from form. For example: In Delphi project I had own TBaseForm class with controls created using designer (.dfm-file, similar to .ui in Qt). When create new form, I could select form from project and then new form had all controls from base form. Furthermore, changing controls in base form had affects in all descendants in real time. Can I do something similar in Qt Creator?
Regards.
You can do something like you say, manually.
For example:
Add new form class inherited from QWidget (name it BaseForm).
Add new form class inherited from QWidget (name it ChildForm).
In childform.h/cpp manually change inheritance from QWidget to BaseForm.
In design time, you can't see changes of child when you change parent. But, when execute it, you'll see it.

How to use my treeview subclass in qt designer?

I have a class myTreeView which is a subclass of QTreeView, which I am using in other widget and doing layout manually. now I want to include myTreeView in the new widget using designer so that I can avoid layout code. any suggestions/reference, how to do this ?
Place a QTreeView into your layout in Qt Designer. Right click the QTreeView, click Promote to... add a New Promoted Class definition using the form at the bottom of the dialog.
i.e. specify the base class of your derived class as QTreeView, give the widget a name, and specify where Qt Design can find the header file for your derived class.
That should allow you, at a minimum, to place your widget on the form as you lay it out. It will most likely show up as a grey empty box (much like a QWidget) on the layout however when you compile and build a project using your .ui file your widget will appear.

How to set a UINavigationController's UINavigationBar class programmatically?

I want to add a Custom UINavigationBar Background.
Is there anyway I can do this completely in code? _navigationBarClass seems to be a private property on UINavigationController.
Objective-C: How to change the class of an object at runtime?
While not programmatic it can be done via Storyboards by setting the Navigation Bar class. See https://stackoverflow.com/a/42989418/47281.

Resources