Using the code below, i have created a form to hold different questions to be used to select and add to a test. I wanted to know how i would add data (Questions) to the form (the top box) (Assuming that i wanted to add a single question which is a named variable 'Question') how would i go about doing this??? Also, although i know how to add data (by data i mean text) to the bottom box, Is there some sort of a way where i could select a piece of text in the top box and view an expansion of the text/variable in the bottom box without having to click on any button???
The code is as follows:
import sys, random, time, math, re
from PyQt4 import QtGui, QtCore
class AddTst(QtGui.QWidget):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(464, 409)
self.verticalLayout_2 = QtGui.QVBoxLayout(Form)
self.horizontalLayout = QtGui.QHBoxLayout()
self.listView = QtGui.QListView(Form)
self.horizontalLayout.addWidget(self.listView)
self.verticalLayout = QtGui.QVBoxLayout()
self.EditButton = QtGui.QPushButton(Form)
self.verticalLayout.addWidget(self.EditButton)
self.DeleteButton = QtGui.QPushButton(Form)
self.verticalLayout.addWidget(self.DeleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.AddButton = QtGui.QPushButton(Form)
self.verticalLayout.addWidget(self.AddButton)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.textBrowser = QtGui.QTextBrowser(Form)
self.verticalLayout_2.addWidget(self.textBrowser)
self.textBrowser.setPlainText('Hello')
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
self.EditButton.setText(QtGui.QApplication.translate("Form", "Edit", None, QtGui.QApplication.UnicodeUTF8))
self.DeleteButton.setText(QtGui.QApplication.translate("Form", "Delete", None, QtGui.QApplication.UnicodeUTF8))
self.AddButton.setText(QtGui.QApplication.translate("Form", "Add", None, QtGui.QApplication.UnicodeUTF8))
class AddTest(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = AddTst()
self.ui.setupUi(self)
def execute_event(self):
pass
def execute_all_event(self):
pass
def reload_event(self):
pass
def main():
app = QtGui.QApplication(sys.argv)
ex = AddTest()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()