Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableView & QSqlTableModel: Erased Default Vertical Header Editing Behavior?

QTableView & QSqlTableModel: Erased Default Vertical Header Editing Behavior?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 685 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JahJerMar
    wrote on last edited by
    #1

    Hello all,

    I have a large project where I use a style sheet in my resource file, for a custom QTableView, QSqlTableModel, and QStyledItemDelegate. Now the problem I'm having is the I kind of forgot when I noticed this problem.. When new rows are added before they are submitted, or when a row is changed via the view, the vertical header does not show the ! or the * in the header text. Does anyone know the best way to fix this? I can post any other code that may be relevant to the answer but I believe the problem may be the style sheet (but of course I'm not sure). I didn't do anything fancy. Code for the style sheet below. Thanks for the help :)

    QMainWindow {
        background-color: #FFFFFF;
    }
    
    QWindow {
        background-color: #FFFFFF;
    }
    
    QDialog{
        background-color: #FFFFFF;
    }
    
    QMenu {
        background-color: white;
        color: black;
        padding-left: 3px;
        margin: 2px;
    }
    
    QMenu::item {
        padding-left: 25px;
        padding-right: 15px;
        padding-top: 3px;
        padding-bottom: 3px;
    }
    
    QMenu::item:selected {
        border-color: darkblue;
        color: white;
        background: #567dbc;
        padding-left: 35px;
        padding-right: 15px;
        padding-top: 3px;
        padding-bottom: 3px;
    }
    
    QMenuBar {
        background-color: white;
    }
    
    QMenuBar::item:selected {
        background: #567dbc;
        color: white;
    }
    
    QToolButton::hover {
        background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                    stop: 0 #fafafa, stop: 0.4 #f4f4f4,
                                    stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
    }
    
    QToolButton:pressed {
        color: white;
        background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                stop: 0 #567dbc, stop: 0.4 #CFCFCF,
                                stop: 0.5 #567dbc, stop: 1.0 #CFCFCF);
    }
    
    QTabBar::tab {
        background: white;
        border: 2px solid #C4C4C3;
        border-bottom-color: #C2C7CB;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        min-width: 8ex;
        padding: 2px;
    }
    
    QTabBar::tab:!selected {
        background: #F5F5F5;
        margin-top: 2px; /* make non-selected tabs look smaller */
    }
    
    QHeaderView::section {
        background-color: white;
        color: black;
        padding-left: 4px;
        border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFFFFF, stop: 1 #000000);
    }
    
    QHeaderView::section:checked {
        background-color: #ececec;
        border: 1px solid black;
        color: black;
    }
    
    QHeaderView::down-arrow {
        padding-bottom: 2px;
        image: url(:/images/icons/png/079-sortdown.png); width: 18px; height:14px; subcontrol-position: bottom right;
    }
    
    QHeaderView::up-arrow {
        padding-bottom: 2px;
        image: url(:/images/icons/png/079-sortup.png); subcontrol-position: bottom right;
    }
    
    QTableView QTableCornerButton::section {
        background: white;
        border: 1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFFFFF, stop: 1 #000000);
    }
    
    QTableView::item:selected:active {
        background-color: #567dbc;
        color: #FFFFFF;
    }
    
    QTableView::item:selected:!active {
        background-color: #CFCFCF;
        color: #323232;
    }
    
    QTableView::item:hover:active {
        background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DCE4F1, stop: 1 #567dbc);
    }
    
    QProgressBar {
        border: 2px solid grey;
        border-radius: 5px;
        text-align: center;
    }
    
    QProgressBar::chunk {
        background-color: #ccccff;
        width: 10px;
        margin: 0.5px;
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I think the fastest is the classic:

      • don't apply the style sheet
      • check it behaves as expected
      • comment out everything in your style sheet and apply it
      • check again
      • progressively uncomment items in your style sheet
      • check each time you uncomment something

      Not ideal but should get you the answer.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • J Offline
        J Offline
        JahJerMar
        wrote on last edited by JahJerMar
        #3

        It's not the style sheet. :( Thanks for the advice.
        I'm guessing at this point it may be the re implemented delegate??
        I'm just trying to figure out which function handles that... still digging.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then does it work as expected without the your delegate ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • SGaistS SGaist

            Then does it work as expected without the your delegate ?

            J Offline
            J Offline
            JahJerMar
            wrote on last edited by
            #5

            @SGaist
            Hey sorry it's been a while... but I finally got around to testing some stuff. It does not work regardless of style sheet, delegate. I'm thinking it may be the custom QTableView or QSqlTableModel at this point. I'll get there thanks.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved