Table Element support
This commit is contained in:
parent
17642e154d
commit
5f8b316e28
|
@ -7,8 +7,9 @@ import pickle
|
||||||
import calendar
|
import calendar
|
||||||
from PySide2.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QComboBox, QFormLayout, QVBoxLayout, QHBoxLayout, QListWidget, QDial
|
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 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
|
||||||
|
from PySide2.QtWidgets import QTableWidgetItem
|
||||||
from PySide2.QtCore import Qt,QProcess, QEvent
|
from PySide2.QtCore import Qt,QProcess, QEvent
|
||||||
import PySide2.QtGui as QtGui
|
import PySide2.QtGui as QtGui
|
||||||
import PySide2.QtCore as QtCore
|
import PySide2.QtCore as QtCore
|
||||||
|
@ -4002,7 +4003,29 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
qt_row_layout.addStretch(1)
|
qt_row_layout.addStretch(1)
|
||||||
# ------------------------- TABLE element ------------------------- #
|
# ------------------------- TABLE element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_TABLE:
|
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 ------------------------- #
|
# ------------------------- Tree element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_TREE:
|
elif element_type == ELEM_TYPE_TREE:
|
||||||
element.QT_QGraphicsLineItem = QtWidgets.QGraphicsLineItem
|
element.QT_QGraphicsLineItem = QtWidgets.QGraphicsLineItem
|
||||||
|
|
Loading…
Reference in New Issue