The code below creates a dialog window with three widgets: QLabel, QComboBox and QButton.
I want QLabel and QComboBox to be sitting on a same line. That is why both of these widgets are assigned to the same horizontal layout.
Resizing the dialog creates a huge empty space between the Label and ComboBox. How to assure that the left side of the Combo sticks to the right side of Label when dialog is resizing?
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
app = QApplication([])
class Dialog(QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self.setLayout(QVBoxLayout())
h_layout = QHBoxLayout()
self.layout().addLayout(h_layout)
label = QLabel(self)
label.setText('Month:')
combo = QComboBox(self)
h_layout.addWidget(label)
h_layout.addWidget(combo)
button = QPushButton('Ok')
self.layout().addWidget(button)
self.resize(200, 50)
self.show()
dialog = Dialog()
app.exec_()
You have to establish the size policy through QSizePolicy, in your case you must set the policy QSizePolicy::Expanding in the horizontal component of the QComboBox:
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
app = QApplication(sys.argv)
class Dialog(QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self.setLayout(QVBoxLayout())
h_layout = QHBoxLayout()
self.layout().addLayout(h_layout)
label = QLabel(self)
label.setText('Month:')
combo = QComboBox(self)
policy = combo.sizePolicy()
policy.setHorizontalPolicy(QSizePolicy.Expanding)
combo.setSizePolicy(policy)
h_layout.addWidget(label)
h_layout.addWidget(combo)
button = QPushButton('Ok')
self.layout().addWidget(button)
self.resize(200, 50)
self.show()
dialog = Dialog()
sys.exit(app.exec_())
Shorter and better solution is add parameter stretch=1 to addWidget() function:
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
app = QApplication([])
class Dialog(QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self.setLayout(QVBoxLayout())
h_layout = QHBoxLayout()
self.layout().addLayout(h_layout)
label = QLabel(self)
label.setText('Month:')
combo = QComboBox(self)
h_layout.addWidget(label)
h_layout.addWidget(combo, stretch=1)
button = QPushButton('Ok')
self.layout().addWidget(button)
self.resize(200, 50)
self.show()
dialog = Dialog()
app.exec_()
Related
This question already has answers here:
How do I assert the identity of a PyQt5 signal?
(2 answers)
Closed 2 years ago.
I've created a search engine in PyQt5, using the code below:
import sys
from PyQt5.QtWidgets import (
QWidget, QLineEdit, QLabel, QScrollArea, QMainWindow,
QApplication, QHBoxLayout, QVBoxLayout, QSpacerItem, QSizePolicy, QCompleter, QPushButton
)
from PyQt5 import QtCore
from PyQt5.QtCore import Qt
tlist = ['thing1', 'thing2', 'thing3', 'thing4']
class Label(QWidget):
def __init__(self, name):
super(Label, self).__init__()
self.name = name
self.lbl = QLabel(self.name)
self.lbl.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.btn = QPushButton("Preview")
self.btn.setMaximumSize(QtCore.QSize(100,100))
self.btn.clicked.connect(self.printsignal)
self.hbox = QHBoxLayout()
self.hbox.addWidget(self.lbl)
self.hbox.addWidget(self.btn)
self.setLayout(self.hbox)
def show(self):
for labels in [self, self.lbl]:
labels.setVisible(True)
def hide(self):
for labels in [self, self.lbl]:
labels.setVisible(False)
def printsignal(self):
print("clicked")
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__()
self.controls = QWidget()
self.controlsLayout = QVBoxLayout()
self.widgets = []
for name in tlist:
item = Label(name)
self.controlsLayout.addWidget(item)
self.widgets.append(item)
spacer = QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.controlsLayout.addItem(spacer)
self.controls.setLayout(self.controlsLayout)
self.scroll = QScrollArea()
self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scroll.setWidgetResizable(True)
self.scroll.setWidget(self.controls)
self.searchbar = QLineEdit()
self.searchbar.textChanged.connect(self.update_display)
self.completer = QCompleter(tlist)
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.searchbar.setCompleter(self.completer)
container = QWidget()
containerLayout = QVBoxLayout()
containerLayout.addWidget(self.searchbar)
containerLayout.addWidget(self.scroll)
container.setLayout(containerLayout)
self.setCentralWidget(container)
self.setGeometry(600, 100, 800, 600)
self.setWindowTitle('Search Engine')
def update_display(self, text):
for widget in self.widgets:
if text.lower() in widget.name.lower():
widget.show()
else:
widget.hide()
app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())
The problem I have is, all the buttons share the same function and I don't know how to make them have different signals, as they are generated automatically. Basically, if I run the code it will show up like
this:
and when I press any of the buttons, it will print "clicked" (as in printsignal function). What I want is a different function for each button. Is there a way to do that?
Normally you can use self.sender().text() to get text from QButton which generated signal.
But because you create own widget Label with QButton and QLabel and you want text from label so you can get directly self.name
def printsignal(self):
print("clicked", self.name)
eventually self.lbl.text()
def printsignal(self):
print("clicked", self.lbl.text())
Working code.
I removed show(), hide() because you don't need it
import sys
from PyQt5.QtWidgets import (
QWidget, QLineEdit, QLabel, QScrollArea, QMainWindow,
QApplication, QHBoxLayout, QVBoxLayout, QSpacerItem, QSizePolicy, QCompleter, QPushButton
)
from PyQt5 import QtCore
from PyQt5.QtCore import Qt
tlist = ['thing1', 'thing2', 'thing3', 'thing4']
class Label(QWidget):
def __init__(self, name):
super().__init__()
self.name = name
self.lbl = QLabel(self.name)
self.lbl.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.btn = QPushButton("Preview")
self.btn.setMaximumSize(QtCore.QSize(100,100))
self.btn.clicked.connect(self.printsignal)
self.hbox = QHBoxLayout()
self.hbox.addWidget(self.lbl)
self.hbox.addWidget(self.btn)
self.setLayout(self.hbox)
def printsignal(self):
print("clicked", self.name)
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__()
self.controls = QWidget()
self.controlsLayout = QVBoxLayout()
self.widgets = []
for name in tlist:
item = Label(name)
self.controlsLayout.addWidget(item)
self.widgets.append(item)
spacer = QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.controlsLayout.addItem(spacer)
self.controls.setLayout(self.controlsLayout)
self.scroll = QScrollArea()
self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scroll.setWidgetResizable(True)
self.scroll.setWidget(self.controls)
self.searchbar = QLineEdit()
self.searchbar.textChanged.connect(self.update_display)
self.completer = QCompleter(tlist)
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.searchbar.setCompleter(self.completer)
container = QWidget()
containerLayout = QVBoxLayout()
containerLayout.addWidget(self.searchbar)
containerLayout.addWidget(self.scroll)
container.setLayout(containerLayout)
self.setCentralWidget(container)
self.setGeometry(600, 100, 800, 600)
self.setWindowTitle('Search Engine')
def update_display(self, text):
for widget in self.widgets:
if text.lower() in widget.name.lower():
widget.show()
else:
widget.hide()
app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())
I'm trying to write a Python program using PyQt5 that will display a window in each iteration of the for loop. I would like to close after incrementing and displaying the next window. However, I do not know how to stop the loop every iteration and at the moment I am getting 6 windows at once.
main.py
import sys
from PyQt5.QtWidgets import (QLineEdit, QVBoxLayout, QMainWindow,
QWidget, QDesktopWidget, QApplication, QPushButton, QLabel,
QComboBox, QFileDialog, QRadioButton)
from PyQt5.QtCore import pyqtSlot, QByteArray
from alert import Window2
from test import test
class SG(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.resize(300, 150)
self.setWindowTitle('TEST')
self.resultsGen = QPushButton('TEST', self)
self.resultsGen.clicked.connect(lambda: self.on_click())
self.show()
#pyqtSlot()
def on_click(self):
test(self)
if __name__ == '__main__':
app = QApplication(sys.argv)
sg = SG()
sys.exit(app.exec_())
alert.py
from PyQt5.QtWidgets import (QLineEdit, QVBoxLayout, QMainWindow,
QWidget, QDesktopWidget, QApplication, QPushButton, QLabel,
QComboBox, QFileDialog, QRadioButton)
from PyQt5.QtCore import pyqtSlot, QByteArray
from PyQt5.QtGui import QPixmap
from PyQt5 import QtGui, QtCore
class Window2(QMainWindow):
def __init__(self):
super().__init__()
self.initPopup()
def initPopup(self):
self.resize(500, 500)
self.setWindowTitle("Window22222")
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
lay = QVBoxLayout(self.central_widget)
label = QLabel(self)
pixmap = QPixmap('cropped/8.png')
label.setPixmap(pixmap)
self.resize(pixmap.width(), pixmap.height())
lay.addWidget(label)
self.textbox = QLineEdit(self)
self.textbox.move(20, 20)
self.textbox.resize(280, 40)
# Create a button in the window
self.button = QPushButton('Show text', self)
self.button.move(20, 80)
# connect button to function on_click
self.button.clicked.connect(lambda: self.on_clickX())
self.show()
#pyqtSlot()
def on_clickX(self):
textboxValue = self.textbox.text()
print(textboxValue)
self.textbox.setText("")
self.hide()
test.py
from alert import Window2
def test(self):
for x in range(6):
w = Window2()
As soon as you run the for cycle, all the code of the initialization will be executed, which includes the show() call you used at the end of initPopup().
A simple solution is to create a new signal that is emitted whenever you hide a window, and connect that signal to a function that creates a new one until it reaches the maximum number.
main.py:
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton
from alert import Window2
class SG(QWidget):
def __init__(self):
super().__init__()
self.initUI()
self.alerts = []
def initUI(self):
self.resize(300, 150)
self.setWindowTitle('TEST')
self.resultsGen = QPushButton('TEST', self)
self.resultsGen.clicked.connect(self.nextAlert)
self.show()
def nextAlert(self):
if len(self.alerts) >= 6:
return
alert = Window2()
self.alerts.append(alert)
alert.setWindowTitle('Window {}'.format(len(self.alerts)))
alert.closed.connect(self.nextAlert)
alert.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
sg = SG()
sys.exit(app.exec_())
alert.py:
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class Window2(QMainWindow):
closed = pyqtSignal()
def __init__(self):
super().__init__()
self.initPopup()
def initPopup(self):
self.resize(500, 500)
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
lay = QVBoxLayout(self.central_widget)
label = QLabel(self)
pixmap = QPixmap('cropped/8.png')
label.setPixmap(pixmap)
self.resize(pixmap.width(), pixmap.height())
lay.addWidget(label)
self.textbox = QLineEdit(self)
lay.addWidget(self.textbox)
# Create a button in the window
self.button = QPushButton('Show text', self)
lay.addWidget(self.button)
# connect button to function on_click
self.button.clicked.connect(lambda: self.on_clickX())
self.show()
#pyqtSlot()
def on_clickX(self):
textboxValue = self.textbox.text()
print(textboxValue)
self.textbox.setText("")
self.hide()
self.closed.emit()
Just note that with this very simplified example the user might click on the button of the "SG" widget even if an "alert" window is visibile. You might prefer to use a QDialog instead of a QMainWindow and make the main widget a parent of that dialog.
main.py:
class SG(QWidget):
# ...
def nextAlert(self):
if len(self.alerts) >= 6:
return
alert = Window2(self)
# ...
alert.py:
class Window2(QDialog):
closed = pyqtSignal()
def __init__(self, parent):
super().__init__()
self.initPopup()
def initPopup(self):
self.resize(500, 500)
# a QDialog doesn't need a central widget
lay = QVBoxLayout(self)
# ...
Also, if an alert window is closed using the "X" button the new one will not be shown automatically. To avoid that, you can implement the "closeEvent" and ignore the event, so that the user will not be able to close the window until the button is clicked. As QDialogs can close themself when pressing the escape key, I'm also ignoring that situation.
alert.py:
class Window2(QMainWindow):
# ...
def closeEvent(self, event):
event.ignore()
def keyPressEvent(self, event):
if event.key() != Qt.Key_Escape:
super().keyPressEvent(event)
I know this question has been asked many times but every time i see different case .
1st problem:
I can't open new window (Window2) having grid layout.
I am trying to open a new window (Window2) in pyqt , this window(Window2) has grid layout .
To make grid layout work , Window2 has parent(QWidget)
and to make it open Window2 has another parent(QMainWindow)
but those two parents conflict each other means:
on having QWidget only as a parent ,Window2 doesn't open at all
on having QMainWindow only as a parent ,Window2 opens but with no grid layout
on having both as parents ,Window2 opens but with no grid layout
and i don't know how to open the window correctly while still having the grid layout
Edit: i have found question about multiple inheritance but i couldn't understand how it works Multiple inheritance
2nd problem:
i am having a global variable numberofholes which value is changed in the class "Window" and is used then in the class "Window2"
so this variable is changed in class"Window" correctly , but is either not defined or its value is not changed in the class "Window2"
so how is the value being global not defined in the class"Window2"
Part of the Code:
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
#######global variables#####################################
global memorysize
global numberofholes
####################################################################
class Window(QWidget):
def __init__(self,parent=None):
super(Window,self).__init__(parent)
self.setWindowTitle("Memory")
self.setGeometry(50,50,500,300)
self.home()
def home(self):
self.grid=QGridLayout()
self.setLayout(self.grid)
self.memory=QLabel(self)
self.memory.setText("Total Memory size")
self.grid.addWidget(self.memory,0,0)
self.memoryinput=QLineEdit(self)
self.grid.addWidget(self.memoryinput,0,20)
self.holes=QLabel(self)
self.holes.setText("Number of holes")
self.grid.addWidget(self.holes,5,0)
self.inputholes=QLineEdit(self)
self.grid.addWidget(self.inputholes,5,20)
self.submit=QPushButton("OK",self)
self.grid.addWidget(self.submit,10,0)
#################Action on clicking submit###########################
self.submit.clicked.connect(self.getholes)
def getholes(self):
memorysize=float(self.memoryinput.text())
numberofholes=int(self.inputholes.text())
self.close()
self.window2=Window2(self)
##############second window for holes input##########################
class Window2(QMainWindow,QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.setWindowTitle("Memory")
self.setGeometry(50,50,500,300)
self.home()
self.show()
def home(self):
self.grid=QGridLayout()
self.setLayout(self.grid)
#print(numberofholes)
for n in range (numberofholes):
self.start_add=QLabel(self)
self.start_add.setText("Starting Address")
self.inputstart=QLineEdit(self)
self.size=QLabel(self)
self.size.setText("Size")
self.inputsize=QLineEdit(self)
self.grid.addWidget(self.start_add,2*n+1,0)
self.grid.addWidget(self.inputstart,2*n+1,1)
self.grid.addWidget(self.size,2*n+1,2)
self.grid.addWidget(self.inputsize,2*n+1,3)
def main():
app = QApplication(sys.argv)
main = Window()
main.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Try it:
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
### global variables
# global memorysize # ---
# global numberofholes # ---
###
class Window(QWidget):
def __init__(self,parent=None):
super(Window,self).__init__(parent)
self.setWindowTitle("Memory 1")
self.setGeometry(50, 50, 500, 300)
self.home()
def home(self):
self.grid = QGridLayout()
self.setLayout(self.grid)
self.memory = QLabel(self)
self.memory.setText("Total Memory size")
self.grid.addWidget(self.memory, 0, 0)
self.memoryinput = QLineEdit(self)
self.grid.addWidget(self.memoryinput, 0, 20)
self.holes = QLabel(self)
self.holes.setText("Number of holes")
self.grid.addWidget(self.holes, 5, 0)
self.inputholes = QLineEdit(self)
self.grid.addWidget(self.inputholes, 5, 20)
self.submit = QPushButton("OK", self)
self.grid.addWidget(self.submit, 10, 0)
# Action on clicking submit
self.submit.clicked.connect(self.getholes)
def getholes(self):
memorysize = float(self.memoryinput.text())
numberofholes = int(self.inputholes.text())
self.hide() # --- close()
self.window2 = Window2(memorysize, numberofholes) # --- self
self.window2.show()
# second window for holes input
class Window2(QWidget): # --- QMainWindow,
def __init__(self, memorysize, numberofholes, parent=None):
super().__init__(parent)
self.memorysize, self.numberofholes = memorysize, numberofholes
print("memorysize=`{}`,\nnumberofholes=`{}`".format(self.memorysize, self.numberofholes))
self.setWindowTitle("Memory 2")
self.setGeometry(50,50,500,300)
self.home()
self.show()
def home(self):
self.grid = QGridLayout()
self.setLayout(self.grid)
print(self.numberofholes)
for n in range (2):
self.start_add = QLabel(self)
self.start_add.setText("Starting Address")
self.inputstart = QLineEdit(self)
self.size = QLabel(self)
self.size.setText("Size")
self.inputsize = QLineEdit(self)
self.grid.addWidget(self.start_add, 2*n+1, 0)
self.grid.addWidget(self.inputstart,2*n+1, 1)
self.grid.addWidget(self.size, 2*n+1, 2)
self.grid.addWidget(self.inputsize, 2*n+1, 3)
if __name__ == '__main__':
app = QApplication(sys.argv)
main = Window()
main.show()
sys.exit(app.exec_())
I would like to set a QListWidget in PyQt5 to check or uncheck the check boxes when I swipe.
Here is my interface:
And my code:
import sys
from PyQt5.QtCore import QDate, QSize, Qt
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class VerifyDialog(QDialog):
def __init__(self, parent=None):
super(VerifyDialog, self).__init__(parent)
self.listWidget = QListWidget()
for i in range(100):
item = QListWidgetItem("Item %i" % i)
# could be Qt.Unchecked; setting it makes the check appear
item.setCheckState(Qt.Checked)
self.listWidget.addItem(item)
runButton = QPushButton("Run")
runButton.clicked.connect(self.exec)
cancelButton = QPushButton("Cancel")
cancelButton.clicked.connect(self.close)
horizontalLayout = QHBoxLayout()
horizontalLayout.addWidget(self.listWidget, 1)
buttonsLayout = QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(runButton)
buttonsLayout.addWidget(cancelButton)
mainLayout = QVBoxLayout()
mainLayout.addLayout(horizontalLayout)
mainLayout.addSpacing(12)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
self.setWindowTitle("Config Dialog")
self.show()
if __name__=="__main__":
app = QApplication(sys.argv)
dialog = VerifyDialog()
sys.exit(app.exec_())
I want to click on Item 4 and have it uncheck (it's easier than clicking the box), and then I want to drag down and have lots of other items uncheck.
You must use the itemEntered signal that sends you the object under the mouse.
self.listWidget.itemEntered.connect(lambda item: item.setCheckState(Qt.Checked if item.checkState()==Qt.Unchecked else Qt.Unchecked))
Complete code:
import sys
from PyQt5.QtCore import QDate, QSize, Qt
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class VerifyDialog(QDialog):
def __init__(self, parent=None):
super(VerifyDialog, self).__init__(parent)
self.listWidget = QListWidget()
self.listWidget.itemEntered.connect(lambda item: item.setCheckState(Qt.Checked if item.checkState()==Qt.Unchecked else Qt.Unchecked))
for i in range(100):
item = QListWidgetItem("Item %i" % i)
# could be Qt.Unchecked; setting it makes the check appear
item.setCheckState(Qt.Checked)
self.listWidget.addItem(item)
runButton = QPushButton("Run")
runButton.clicked.connect(self.exec)
cancelButton = QPushButton("Cancel")
cancelButton.clicked.connect(self.close)
horizontalLayout = QHBoxLayout()
horizontalLayout.addWidget(self.listWidget, 1)
buttonsLayout = QHBoxLayout()
buttonsLayout.addStretch(1)
buttonsLayout.addWidget(runButton)
buttonsLayout.addWidget(cancelButton)
mainLayout = QVBoxLayout()
mainLayout.addLayout(horizontalLayout)
mainLayout.addSpacing(12)
mainLayout.addLayout(buttonsLayout)
self.setLayout(mainLayout)
self.setWindowTitle("Config Dialog")
self.show()
if __name__=="__main__":
app = QApplication(sys.argv)
dialog = VerifyDialog()
sys.exit(app.exec_())
I'm trying to create a Application form by PySide, and i follow some tutorial , but i have a problem that is a space between QLabel and QCombobox.
This is my code
import sys
from PySide import QtCore, QtGui
from PySide.QtGui import *
from PySide.QtCore import *
class Window(QtGui.QWidget):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.setMinimumHeight(660)
self.setMinimumWidth(700)
self.setMaximumHeight(660)
self.setMaximumWidth(900)
grid = QtGui.QGridLayout()
grid.addWidget(self.First(), 0,0,2,0)
self.setLayout(grid)
self.setWindowTitle("Library")
self.resize(700, 660)
def First(self):
groupBox = QtGui.QFrame()
groupBox.setMaximumWidth(230)
groupBox.setMaximumHeight(700)
lbFile = QtGui.QLabel("File :",self)
lbFolders = QtGui.QLabel("Folders :",self)
cbFile = QtGui.QComboBox(self)
cbFile.addItem("File 1")
cbFile.addItem("File 2")
lvFolders = QtGui.QListView(self)
lvFolders.setMaximumWidth(220)
lvFolders.setMaximumHeight(500)
vbox = QtGui.QGridLayout()
vbox.addWidget(lbFile,0,0)
vbox.addWidget(cbFile,0,1)
vbox.addWidget(lbFolders,2,0)
vbox.addWidget(lvFolders,3,0,1,2)
groupBox.setLayout(vbox)
return groupBox
app = QApplication.instance()
if app is None:
app = QApplication(sys.argv)
clock = Window()
clock.show()
app.exec_()
and this is my Form :
I dont know how to delete the space between QLabel "File" and QCombobox "File 1"
Adjust the stretch factor for the second column of the layout, and possibly also make the folders label span both columns:
vbox = QtGui.QGridLayout()
vbox.addWidget(lbFile,0,0)
vbox.addWidget(cbFile,0,1)
vbox.addWidget(lbFolders,2,0,1,2)
vbox.addWidget(lvFolders,3,0,1,2)
vbox.setColumnStretch(1, 1)