Pyqt - Add a Layout to a QToolBox page - layout

Here is the structure of a QToolBox :
QToolBox
QWidget
Qwidget
...
I know that I can add a Layout before the Toolbox, in a widget, but can we add a Layout to a QToolBox page or is this impossible as QToolBox is a pre-build widget?
Layout
QToolBox
(Layout?)
QWidget
Layout
QWidget
Is it possible to add a Layout where I put the (Layout?)?
Is there any manner that a widget in a toolbox can be layout to the entire toolbox?
Layout
QToolBox
Page1 ( widget )
Layout
widget
widget
...
Page2 ( widget )
...
I tried to add a layout in the page using QtDesigner, that is formatting the widgets, and it is working, but what I can't do, is to have the widgets over the entire Page.
So I thought that if I add a Layout between the Toolbox and the page, it would work.
I tried the setLayout() method of widget, but it wasn't successful

Related

Flutter Web Navigator/Overlay layout issue

When I started my first flutter web business application my goal was to place the MaterialApp navigator just inside the place where I want all pages to be loaded. Therefore I used the MaterialApp builder to accomplish that. This builder gives me the context and navigator and I can return the widget tree I desire.
Everything was great, I created and returned a widget tree that looked like the code below:
Scaffold(
appBar: MyAppBar(),
body: Row(children: [
MySideBar(),
Expanded(
child: navigatorFromTheMaterialAppBuider,
),
]),
)
By doing this way I have a fixed sidebar and appbar, and all pages are loaded without any rebuild on the fixed part.
The problem began when I needed to place some widgets that depends on the Overlay class inside my sidebar. Because sidebar is outside the MaterialApp navigator an overlay can't be found. Another side effect of doing this kind of layout was that any widget placed inside my pages and therefore inside the navigator displayed its overlay entries with the exact offset of the sidebar width and appbar height.
To avoid change that layout structure and make appbar and sidebar part of every page of my web application, I'd like to know if there is a way of placing an Overlay above the navigator (or even above the MaterialApp widget) that can override the MaterialApp navigator overlay for the entire tree of widgets.
I created a dartpad sample code to make it clearer.
https://dartpad.dev/140e1e8a9ca0620301b43d0313e20bdb

Flutter Web : Custom DatePicker inside Widget

Need a Calendar Widget inside Stateful widget.
when i triggered DatePicker widget its show like a Dialog widget (ref below image)
but i need widget inside the stateful instead of overlay popup widget need inside it (ref below image)
can anyone help me out :
i tried using flutter_calendar_carousel plugin but in that plugin changing of year is a Big challenge .

Qt Designer make widget overlap another widget in layout

I want to make 3 window button like above picture (similar Google Chrome) use Qt Designer and PyQt.
I want 3 buttons overlap right side of TabWidget.
But I only can overlap the Button on TabWidget when break layout like the picture.
When I set any layout, every widget can not overlap on each other.
So can I overlap when set layout? Thanks.
This is the layout I want
It similar Google Chrome's layout
This cannot be done in creator/designer, and can only be achieved using setCornerWidget() from your code.
Since only one widget can be set for each corner, you have to create a QWidget that acts as a container, then add the buttons to it.
class Test(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
# ...
self.createButtons()
def createButtons(self):
# create the container and its layout
self.buttonContainer = QtWidgets.QWidget()
buttonLayout = QtWidgets.QHBoxLayout(self.buttonContainer)
# remove margins around the layout and set a minimal spacing between
# the children widgets
buttonLayout.setContentsMargins(0, 0, 0, 0)
buttonLayout.setSpacing(1)
# QToolButtons are usually better for this, as QPushButtons tend
# to expand themselves
self.minimizeButton = QtWidgets.QToolButton(text='_')
self.maximizeButton = QtWidgets.QToolButton(text='o')
self.closeButton = QtWidgets.QToolButton(text='x')
buttonLayout.addWidget(self.minimizeButton)
buttonLayout.addWidget(self.maximizeButton)
buttonLayout.addWidget(self.closeButton)
# set the container as the corner widget; as the docs explain,
# despite using "TopRightCorner", only the horizontal element (right
# in this case) will be used
self.tabWidget.setCornerWidget(
self.buttonContainer, QtCore.Qt.TopRightCorner)

Vaadin - which components use to organize layout

I am confused with the possibilities of layouting components in Vaadin 7 - intuition tells to use just layout - however there are also Panels or Components which can be useful.
I need to create view which will have static left menu and top bar (constant size, visible on each page). The only thing that will change the content is middle component - which should be scrollable.
My design therefore is:
Custom component, which assembles everything. Is has absolute size for top and left menu.
Vertical layout for left menu and Horizontal layout for upper menu
Panel for middle component, since Panel is supposed to support scrolling.
Inside of panel I placed CssLayout with content that doesn't fit the page. Expected behaviour is that there would be a scroll bar (preferably on the browser, but i guess it'd be on the panel). But What actually happens is that just the part that fits the screen is visible and the rest is cut. CssLayout is sizeFull and panel default, but I tried also other combinations and nothing has helped.
How can I combine layouts to have middle panel scrollable (if needed) and top and left one with absolute size?
Thanks a lot,
In Vaadin 7 & 8, you generally use one of the Layout implementations to arrange widgets within a UI subclass. For example, VerticalLayout, HorizontalLayout, and GridLayout. For pixel-positioning, use AbsoluteLayout. Of course these can be nested one within another. But don't go crazy with the nesting as it may result in overly complex HTML/CSS at runtime.
The Panel class, as the doc says, is a special container. It contains only a single component, typically another container such as a Layout. The Panel presents itself with a border and a title bar displaying its caption property. This looks something like a sub-window.
As you mentioned, a Panel supports scrolling. But keep in mind that any web page defined with a Layout also supports scrolling, obviously.
Here is a complete example app showing a stack of TextField widgets in a VerticalLayout.
package com.basilbourque.example;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import javax.servlet.annotation.WebServlet;
import java.time.Instant;
/**
* This UI is the application entry point. A UI may either represent a browser window
* (or tab) or some part of an HTML page where a Vaadin application is embedded.
* <p>
* The UI is initialized using {#link #init(VaadinRequest)}. This method is intended to be
* overridden to add component to the user interface and initialize non-component functionality.
*/
#Theme ( "mytheme" )
public class MyUI extends UI {
#Override
protected void init ( VaadinRequest vaadinRequest ) {
final VerticalLayout layout = new VerticalLayout();
for ( int i = 1 ; i <= 100 ; i++ ) {
TextField textField = new TextField( String.format( "%3d" , i ) );
textField.setWidth( 17 , Unit.EM ); // Widen the field to fully display our contents.
textField.setValue( Instant.now().toString() );
layout.addComponents( textField );
}
setContent( layout );
}
#WebServlet ( urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true )
#VaadinServletConfiguration ( ui = MyUI.class, productionMode = false )
public static class MyUIServlet extends VaadinServlet {
}
}
As to your idea of nesting VerticalLayout and HorizontalLayout for nav panels, button/tool bars, and such…
Vaadin 7 & 8: Absolutely proper, and a good idea. Sometimes a GridLayout makes sense for that as well.
Vaadin 10: May also be a good idea. Or you may want to explore using new CSS3 features flexbox and Grid Layout.
As for your problem with CssLayout inside a Panel, I have rarely used either. I suspect the problem would lie in not properly defining a specific width & height of the CssLayout. You did not post details and code, so we can only speculate.

MonoTouch Dialog add a toolbar at the bottom of the dialog

I am trying to add a Toolbar that is anchored to the bottom of a MonoTouch Dialog.
Here is an example:
So as you scroll, the table's contents scroll but the toolbar at the bottom remains in view always. I know how to do this by using the interface builder, but no clue as to how to do this with Mt.D. Please please tell me it can be done!
To do this, it's probably easiest to use the DialogViewController and its View as a child of another UIViewController.
Just create your public class MyViewController : UIViewController class and then create and size your child views in the override ViewDidLoad method.

Resources