Should the ng-zorro-antd Modal inherit providers from the parent?
I'm using the NzModalService to create the modal.
declare the provider in the parent component.
declare the service in the child modal component constructor.
The service in the child modal component is a new instance of the service. Should it not have been inherited from the parent?
Now the child component's NzModalService gets the parent component's NzModalService instance by #SkipSelf(), thus some properties are inherited from the parent.
Related
I have a Qt parent widget that displays a child widget.
I need to delete the parent widget.
I might (or not) later attach the child to a different parent and display it inside the new container.
I do not have access to the second parent at the time I delete the first parent.
How do I do this?
First hide the child widget using hide() or setVisible(false) methods of QWidget. Then make the child widget have no parent using setParent(nullptr), which makes it a top level window, which is why you needed to hide it first.
To later re-use the widget, add it to appropriate new layout, which also sets it parent. You need to call its show() or setVisible(true) method for it too, or it will stay hidden.
I am making a child button component that will open an included modal in that same component. Right now, since the modal is nested within the root element (of the child component), it is rendering inside the parent component's b-dropdown (Bootstrap Vue). I aim to have the modal remain in the child component, but to render in the middle of the window like all my other modals.
Here's the call from my parent component (which uses Pug):
b-dropdown(right text='Reports')
ExportItemsToPDF(:item_ids=`selectedItems`)
And here's the portion from the ExportItemsToPDF component:
.export_items_to_pdf
b-dropdown-item(#click.prevent='openModal()') {{buttonTitle}}
modal(name='export_items_to_pdf' height='auto' width='70%')
form.modal-container(#submit.prevent='submit')
h1 TEST
If there's any other supporting info needed, please let me know and I'll provide.
Thanks.
I don't think you can do it without any custom Javascript to manipulate the modal. If you are trying to benefit from a shared component that you can drop into other components (to keep your code DRY etc), you will have to split the modal into its own component, then in the parent component do something like...
ExportItemsToPDFModal
b-dropdown(right text='Reports')
ExportItemsToPDFDropdownItem(:item_ids=`selectedItems`)
...so that the modal is a sibling (or possibly higher, like an aunt/uncle or great-aunt/great-uncle) of the b-dropdown instead of a child element.
I have some widgets, QToolButtons to be exactly, and I initialize them like this:
QFrame *frmBackground = new QFrame(ui->centralWidget);
QToolButton *btnMenueExit = new QToolButton(frmBackground);
But now my problem. When I call frmBackground->setVisible(false), the child should disappear too, but thats not the case. The children are still visible and I would have to call setVisible(false) for every child. It's not like I can't do this, but I think I miss something essential about the concept of parent and child.
All of the widgets are organized in the same QGridLayout.
What concerns me is, that if I make the child<-->parent relationship in the designer, with dropping the child into the parent widget, the child is disappearing when I call parent->setVisible(false);
Are there some other parameters I have to set to make these properties to be passed to the child, like a property binding?
QLayout takes ownership of the widget, when you add one with addWidget(). Using parent argument in widget constructor is not necessary.
Setting one widget to be direct parent of another is not a good practice, you should always use layouts.
If you want to use a QWidget to hold child widgets you will usually want to add a layout to the parent QWidget.
setVisible() propagates to all children. If it doesn't work for child widgets then the widget is not their parent (anymore).
I retrieved a fine component for drawing in flex. It uses some floating toolpalette like:
toolBox = PopUpManager.createPopUp( this, ToolPalette ) as ToolPalette;
I tried to integrate that component into a new flex MXML component like a tileWindow:
Works fine except that these tools palette are OUTSIDE the component.
Is there a way to constrain the toolBox created with PopupManager to stay within its parent container ?
regards
I used createPopUp when the popup component was "titleWindow". But when I want a Canvas component added in the popup, I created a titleWindow and added the Canvas component as a child to the TitleWindow.
var titleWindow:TitleWindow;
titleWindow=new ResizableTitleWindow();
titleWindow.showCloseButton=true;
//Canvas Component
var toolPalette:ToolPalette=new ToolPalette();
// Add the Canvas component to the Titlewindow
titleWindow.addChild(toolPalette);
PopUpManager.addPopUp(titleWindow, this, true);
Set the modal property when you call the createPopup method to true.
createPopUp(this, toolPalette, true, null)
By deffinition on adobes site no you can not constrain
createPopUp -- Creates a top-level
window and places it above other
windows in the z-order.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/managers/PopUpManager.html#addPopUp%28%29
Thats' not saying you couldn't try to create a mask of some sort
What is the nonInheritingStyles property for on the UIComponent?
Is this a list of styles that the component does not inherit from the container?
Or is this a list of styles that have been set inline or in code so the component is just telling me that they are NOT inheriting from the container?
If it's the first why are their values set for this properties?
"Is this a list of styles that the component does not inherit from the container?"
YES