Results 1 to 1 of 1

Thread: QTableView and stylesheet horizontal scrolling problem

  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QTableView and stylesheet horizontal scrolling problem

    I'm having a problem on OSX with QTableView and scrolling horizontally. The problem happens when I set a stylesheet for QTableView. Any cells I've configured using QTableView->setIndexWidget will move out of their cells when scrolling horizontally. I can't reproduce this problem on Windows. Here is some code:

    Qt Code:
    1. main_window::main_window(QWidget *parent, Qt::WFlags flags)
    2. : QMainWindow(parent, flags)
    3. {
    4. ui = new Ui::MainWindow();
    5. ui->setupUi(this);
    6.  
    7. _model = new TableModel;
    8. ui->myTable->setModel(_model);
    9. int size = _model->rowCount();
    10.  
    11. for (int i = 0; i < size; i++)
    12. {
    13. QModelIndex index = _model->index(i, SIXTH_COLUMN);
    14. ui->myTable->setIndexWidget(index, new QComboBox);
    15. }
    16.  
    17. QString ss = "QTableView { background-color: rgb(237,237,241); border: none; border-radius: 4px; padding: 4px 4px; color: rgb(46,66,59);}";
    18. setStyleSheet(ss);
    19. }
    To copy to clipboard, switch view to plain text mode 

    In the above, TableModel is a subclass of QAbstractTableModel with eight columns. If I remove the last two lines (setting the stylesheet), the cell will not move when scrolling horizontally. Is this a bug or am I doing something wrong? I've attached my sources files.

    I'm using Qt 4.8.3 with Mountain Lion 10.8.2 & XCode 4.5.
    Attached Files Attached Files

Similar Threads

  1. Replies: 5
    Last Post: 15th October 2012, 13:14
  2. Alignment of HORIZONTAL HEADERS in a QTableView
    By sattu in forum Qt Programming
    Replies: 9
    Last Post: 12th January 2012, 16:21
  3. Replies: 4
    Last Post: 2nd January 2011, 07:46
  4. Horizontal Scrolling QListWidget
    By bl1nk in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2010, 08:44
  5. Grid QTableView horizontal only
    By estanisgeyer in forum Qt Programming
    Replies: 1
    Last Post: 11th September 2009, 16:14

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.