Add multiple columns inside a tableview cell The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceAdd new keys to a dictionary?Catch multiple exceptions in one line (except block)nested classes in PythonSelecting multiple columns in a pandas dataframeRenaming columns in pandasDelete column from pandas DataFrame by column nameSelect rows from a DataFrame based on values in a column in pandasSimple Inherit from class in Python throws errorDerived panel classes in wxpythonwxpython - Erase background erases non-background components
how can a perfect fourth interval be considered either consonant or dissonant?
Make it rain characters
Can the DM override racial traits?
How to grep and cut numbes from a file and sum them
In horse breeding, what is the female equivalent of putting a horse out "to stud"?
He got a vote 80% that of Emmanuel Macron’s
Can a novice safely splice in wire to lengthen 5V charging cable?
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
Was credit for the black hole image misattributed?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
Would it be possible to rearrange a dragon's flight muscle to somewhat circumvent the square-cube law?
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Hopping to infinity along a string of digits
What do you call a plan that's an alternative plan in case your initial plan fails?
Is above average number of years spent on PhD considered a red flag in future academia or industry positions?
Why not take a picture of a closer black hole?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
Is there a writing software that you can sort scenes like slides in PowerPoint?
Does Parliament hold absolute power in the UK?
Can smartphones with the same camera sensor have different image quality?
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
Working through the single responsibility principle (SRP) in Python when calls are expensive
Semisimplicity of the category of coherent sheaves?
Am I ethically obligated to go into work on an off day if the reason is sudden?
Add multiple columns inside a tableview cell
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceAdd new keys to a dictionary?Catch multiple exceptions in one line (except block)nested classes in PythonSelecting multiple columns in a pandas dataframeRenaming columns in pandasDelete column from pandas DataFrame by column nameSelect rows from a DataFrame based on values in a column in pandasSimple Inherit from class in Python throws errorDerived panel classes in wxpythonwxpython - Erase background erases non-background components
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;

I'm trying to create a table that have a column inside a cell. Is there an easy way to implement this design to the table view I'm working with?
This is my code right now:
class ColumnsLayout(QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QTableWidget()
table_row.setColumnCount(3)
table_row.horizontalHeader().setVisible(False)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QHeaderView.Stretch)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
self.setLayout(layout)
self.ui.fields_tableWidget.setCellWidget(self.current_default_total_row, 2, ColumnsLayout())
python pyside pyside2
add a comment |

I'm trying to create a table that have a column inside a cell. Is there an easy way to implement this design to the table view I'm working with?
This is my code right now:
class ColumnsLayout(QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QTableWidget()
table_row.setColumnCount(3)
table_row.horizontalHeader().setVisible(False)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QHeaderView.Stretch)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
self.setLayout(layout)
self.ui.fields_tableWidget.setCellWidget(self.current_default_total_row, 2, ColumnsLayout())
python pyside pyside2
add a comment |

I'm trying to create a table that have a column inside a cell. Is there an easy way to implement this design to the table view I'm working with?
This is my code right now:
class ColumnsLayout(QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QTableWidget()
table_row.setColumnCount(3)
table_row.horizontalHeader().setVisible(False)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QHeaderView.Stretch)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
self.setLayout(layout)
self.ui.fields_tableWidget.setCellWidget(self.current_default_total_row, 2, ColumnsLayout())
python pyside pyside2

I'm trying to create a table that have a column inside a cell. Is there an easy way to implement this design to the table view I'm working with?
This is my code right now:
class ColumnsLayout(QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QTableWidget()
table_row.setColumnCount(3)
table_row.horizontalHeader().setVisible(False)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QHeaderView.Stretch)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
self.setLayout(layout)
self.ui.fields_tableWidget.setCellWidget(self.current_default_total_row, 2, ColumnsLayout())
python pyside pyside2
python pyside pyside2
edited Mar 22 at 6:09
Arci Jeirico Malabanan
asked Mar 22 at 5:54
Arci Jeirico MalabananArci Jeirico Malabanan
276
276
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use setSpan() to join cells
from PySide2 import QtWidgets
class ColumnsLayout(QtWidgets.QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QtWidgets.QTableWidget(4, 3)
table_row.horizontalHeader().hide()
table_row.setSpan(0, 0, 1, 3)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QtWidgets.QHeaderView.Stretch)
layout = QtWidgets.QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = ColumnsLayout()
w.show()
sys.exit(app.exec_())

add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293664%2fadd-multiple-columns-inside-a-tableview-cell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use setSpan() to join cells
from PySide2 import QtWidgets
class ColumnsLayout(QtWidgets.QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QtWidgets.QTableWidget(4, 3)
table_row.horizontalHeader().hide()
table_row.setSpan(0, 0, 1, 3)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QtWidgets.QHeaderView.Stretch)
layout = QtWidgets.QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = ColumnsLayout()
w.show()
sys.exit(app.exec_())

add a comment |
You can use setSpan() to join cells
from PySide2 import QtWidgets
class ColumnsLayout(QtWidgets.QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QtWidgets.QTableWidget(4, 3)
table_row.horizontalHeader().hide()
table_row.setSpan(0, 0, 1, 3)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QtWidgets.QHeaderView.Stretch)
layout = QtWidgets.QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = ColumnsLayout()
w.show()
sys.exit(app.exec_())

add a comment |
You can use setSpan() to join cells
from PySide2 import QtWidgets
class ColumnsLayout(QtWidgets.QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QtWidgets.QTableWidget(4, 3)
table_row.horizontalHeader().hide()
table_row.setSpan(0, 0, 1, 3)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QtWidgets.QHeaderView.Stretch)
layout = QtWidgets.QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = ColumnsLayout()
w.show()
sys.exit(app.exec_())

You can use setSpan() to join cells
from PySide2 import QtWidgets
class ColumnsLayout(QtWidgets.QWidget):
def __init__(self, parent=None):
super(ColumnsLayout, self).__init__(parent)
table_row = QtWidgets.QTableWidget(4, 3)
table_row.horizontalHeader().hide()
table_row.setSpan(0, 0, 1, 3)
for x in range(0, 3):
table_row.horizontalHeader().setSectionResizeMode(x, QtWidgets.QHeaderView.Stretch)
layout = QtWidgets.QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(table_row)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = ColumnsLayout()
w.show()
sys.exit(app.exec_())

answered Mar 22 at 6:12
eyllanesceyllanesc
87.8k103564
87.8k103564
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293664%2fadd-multiple-columns-inside-a-tableview-cell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown