Results 1 to 2 of 2

Thread: Qtableview margin/padding

  1. #1
    Join Date
    Feb 2021
    Posts
    7
    Thanks
    2
    Qt products
    Qt3 Qt5
    Platforms
    Windows

    Default Qtableview margin/padding

    Hi Team

    I have a small problem with tableview.
    The problem I have is that the QT designer view and the actual application view differ (as shown in the in the pic below).
    The table is somehow split in two columns, but when populating all data appears on the left side, including scroll bars.
    After import of my data, these views stay the same. My data appears in the left field (with scroll adjuster) whilst the right field stays blank.

    Screenshot 2021-02-17 130417.jpg
    Does anybody know what setting may need to change in QTdesigner (or in my code) to resolve this?

    Qt Code:
    1. from PyQt5 import QtCore, QtWidgets, uic
    2. from PyQt5.QtCore import Qt
    3. from PyQt5.QtGui import *
    4. from PyQt5.QtWidgets import (qApp, QComboBox, QMainWindow, QApplication, QMessageBox, QFileDialog)
    5.  
    6. #define class
    7. class Bathyui(QtWidgets.QDialog):
    8. def __init__(self, parent=None):
    9. super(Bathyui, self).__init__(parent)
    10. uic.loadUi('Open_File_UWN_Model.ui', self)
    11.  
    12. #connect to widget
    13. self.table = QtWidgets.QTableView(self.tableView)
    14.  
    15. #populate with dataframe
    16. self.table.setModel(file_reader)
    To copy to clipboard, switch view to plain text mode 

    Below the .ui code
    Open_File_UWN_Model.ui

    Im a littlebit lost how to solve this. I pretty much hit every setting in the QT Designer formatting menu

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,941
    Thanks
    276
    Thanked 803 Times in 792 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Qtableview margin/padding

    Note - this is not a double-post. The OP's first post was marked as "Moderated" and was therefore not visible to the Forum until approval. Because this post has attachments that are also probably used by the repost, I have not deleted it.

    Please make replies to the other post.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QListWidget margin/padding space
    By Hennessy in forum Newbie
    Replies: 0
    Last Post: 28th March 2014, 15:01
  2. QTabWidget icon padding/margin?
    By Nyte in forum Newbie
    Replies: 0
    Last Post: 2nd April 2013, 11:31
  3. Replies: 3
    Last Post: 19th February 2012, 11:40
  4. Replies: 3
    Last Post: 25th June 2010, 05:21
  5. QPainter.drawText and margin/padding
    By invictus in forum Newbie
    Replies: 1
    Last Post: 24th July 2009, 12:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.