Home > other >  How to operate the controls of QBoxLayout layout
How to operate the controls of QBoxLayout layout

Time:11-27

AddButton=QPushButton (self. Rom_frame)
AddButton. Resize (5, 2)
AddButton. SetObjectName (' add Button ')
AddButton. SetText () '+'
AddButton. SetStatusTip (' Click to add the source select ')
AddButton. Clicked. Connect (self add_file_select)

Def add_file_select (self) :
Self. Layout_count +=1
If (self. Layout_count & gt; 8) :
Return
Tab_lay_add=QBoxLayout (QBoxLayout LeftToRight)

Text='SRC % d % (self. Layout_count)
Output_title_add=QLabel (text, the self. Rom_frame)
Output_file_add=QLineEdit (self. Rom_frame)
DirButton_add=QPushButton (self. Rom_frame)
DirButton_add. SetObjectName (' query Button ')
DirButton_add. SetText ('... ')
DirButton_add. SetStatusTip (' Click to select the source file ')
DirButton_add. Clicked. Connect (self file_select)
Combo_add=QComboBox (self. Rom_frame)

Tab_lay_add. AddWidget (output_title_add, 1)
Tab_lay_add. AddWidget (output_file_add, 20)
Tab_lay_add. AddWidget (DirButton_add, 1)
Tab_lay_add. AddWidget (combo_add, 1)

# self. Layout1. AddWidget (QLabel (' both please select the source file '))
# self. Layout1. AddLayout (tab_lay_add)
# # the self. The layout1. AddStretch (1) set up the space between the top and bottom spacing

Self. Layout_list. Append (tab_lay_add)

For I in range (len (self. Layout_list)) :
The self. The layout1. AddLayout (self layout_list [I])
The self. The layout1. SetStretch (2 * I, 0)
Self. Layout1. AddStretch # (1) set up the space between the top and bottom spacing

Self. Rom_frame. The update ()

I through the way of binding key event, dynamically add QBoxLayout layout, but how to get each item in the operating space, for example, want to layout the LineEdit written text display, how to operate?
  • Related