Table Element support

This commit is contained in:
MikeTheWatchGuy 2018-11-09 10:08:42 -05:00
parent 17642e154d
commit 5f8b316e28
1 changed files with 25 additions and 2 deletions

View File

@ -7,8 +7,9 @@ import pickle
import calendar
from PySide2.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QComboBox, QFormLayout, QVBoxLayout, QHBoxLayout, QListWidget, QDial
from PySide2.QtWidgets import QSlider, QCheckBox, QRadioButton, QSpinBox, QPushButton, QTextEdit, QMainWindow, QDialog, QAbstractItemView
from PySide2.QtWidgets import QSpacerItem, QFrame, QGroupBox, QTextBrowser, QPlainTextEdit, QButtonGroup, QFileDialog
from PySide2.QtWidgets import QSpacerItem, QFrame, QGroupBox, QTextBrowser, QPlainTextEdit, QButtonGroup, QFileDialog, QTableWidget
# from PySide2.QtWidgets import
from PySide2.QtWidgets import QTableWidgetItem
from PySide2.QtCore import Qt,QProcess, QEvent
import PySide2.QtGui as QtGui
import PySide2.QtCore as QtCore
@ -4002,7 +4003,29 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
qt_row_layout.addStretch(1)
# ------------------------- TABLE element ------------------------- #
elif element_type == ELEM_TYPE_TABLE:
pass
element.QT_TableWidget = QTableWidget()
style = ''
if font is not None:
style += 'font-family: %s;'%font[0]
style += 'font-size: %spt;'%font[1]
if element.TextColor is not None:
style += 'color: %s;' % element.TextColor
if element.BackgroundColor is not None:
style += 'background-color: %s;' % element.BackgroundColor
element.QT_TableWidget.setStyleSheet(style)
element.QT_TableWidget.setRowCount(len(element.Values))
element.QT_TableWidget.setColumnCount(len(element.Values[0]))
for rownum, rows in enumerate(element.Values):
# element.QT_TableWidget.insertRow(rownum)
for colnum, columns in enumerate(rows):
element.QT_TableWidget.setItem(rownum, colnum, QTableWidgetItem(element.Values[rownum][colnum]))
element.QT_TableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
qt_row_layout.addWidget(element.QT_TableWidget)
# ------------------------- Tree element ------------------------- #
elif element_type == ELEM_TYPE_TREE:
element.QT_QGraphicsLineItem = QtWidgets.QGraphicsLineItem