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. Table header left over on the right (Mac only issue)
Forum Updated to NodeBB v4.3 + New Features

Table header left over on the right (Mac only issue)

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 421 Views 2 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.
  • F Offline
    F Offline
    FunghiApe
    wrote on last edited by FunghiApe
    #1

    Hi experts,
    Screen Shot 2022-08-08 at 16.54.20.png
    This is a mac only issue. It works just fine on Windows.
    The "Actions" section resize mode is set to "Fixed" and when I drag the divider between "Commands" and "Actions" sections to the left. There will be left over header (colored as grey) on the right.

    What could be wrong?

    Thank you!!!

    1 Reply Last reply
    0
    • F FunghiApe

      Here it is:

             const QSize MiniDialogSize(586, 368);
      
              auto tableWidget = new QTableWidget(2, 3, this);
      	tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("A"))));
      	tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString(tr("B"))));
      	tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(QString(tr("C"))));
      	tableWidget->setItem(0, 0, new QTableWidgetItem(QString("test1")));
      	tableWidget->setItem(0, 1, new QTableWidgetItem(QString("test2")));
      	tableWidget->setItem(0, 2, new QTableWidgetItem(QString("test3")));
      	tableWidget->setItem(1, 0, new QTableWidgetItem(QString("test4")));
      	tableWidget->setItem(1, 1, new QTableWidgetItem(QString("test5")));
      	tableWidget->setItem(1, 2, new QTableWidgetItem(QString("test6")));
      
      	const QString styles = "QTableWidget {background-color:rgb(255, 255, 255);\
      					border: 2px solid green;}\
      					QTableWidget::Item { padding-left: 6px; border: 0; font-size: 12px;}";
      
      	const QString headerStyle = "QHeaderView::section\
      	{\
      		background-color: rgba(0, 100, 0, 255);\
              color: white;\
      		padding-left: 10px;\
      		border: 2px solid blue;\
      		border-right: 1px solid red;\
      		font-size: 12px;\
      	}";
      
          tableWidget->setStyleSheet(styles);
          tableWidget->horizontalHeader()->setStyleSheet(headerStyle);
          tableWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
          boxLayout->addWidget(tableWidget);
          resize(MiniDialogSize);
      
      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #7

      @FunghiApe

      I 've just added this to the header style:

      "QHeaderView\
              {\
                  background-color: rgba(255,255, 255);\
          }";
      

      And the horizontal gray bar is now white.

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

        Hi,

        Can you share a minimal compilable example that shows the behaviour ?
        What result are you expecting ?
        Which version of Qt are you using ?
        On which version of macOS ?

        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
        0
        • F Offline
          F Offline
          FunghiApe
          wrote on last edited by
          #3

          @SGaist Thanks for reply.

          Here's how it looks in windows:
          image.png

          and this is how it looks in mac os 12.5
          Screen Shot 2022-08-09 at 15.53.20.png

          I am expecting the header to be like how it is shown in windows (no grey area on the right).
          Qt version is 5.15.2

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

            Can you please provide a minimal compilable example that shows this behaviour ?

            Note that different OS may show the same controls in different ways and it might be the correct representation even if not what you expect.

            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
            0
            • F Offline
              F Offline
              FunghiApe
              wrote on last edited by
              #5

              Here it is:

                     const QSize MiniDialogSize(586, 368);
              
                      auto tableWidget = new QTableWidget(2, 3, this);
              	tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("A"))));
              	tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString(tr("B"))));
              	tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(QString(tr("C"))));
              	tableWidget->setItem(0, 0, new QTableWidgetItem(QString("test1")));
              	tableWidget->setItem(0, 1, new QTableWidgetItem(QString("test2")));
              	tableWidget->setItem(0, 2, new QTableWidgetItem(QString("test3")));
              	tableWidget->setItem(1, 0, new QTableWidgetItem(QString("test4")));
              	tableWidget->setItem(1, 1, new QTableWidgetItem(QString("test5")));
              	tableWidget->setItem(1, 2, new QTableWidgetItem(QString("test6")));
              
              	const QString styles = "QTableWidget {background-color:rgb(255, 255, 255);\
              					border: 2px solid green;}\
              					QTableWidget::Item { padding-left: 6px; border: 0; font-size: 12px;}";
              
              	const QString headerStyle = "QHeaderView::section\
              	{\
              		background-color: rgba(0, 100, 0, 255);\
                      color: white;\
              		padding-left: 10px;\
              		border: 2px solid blue;\
              		border-right: 1px solid red;\
              		font-size: 12px;\
              	}";
              
                  tableWidget->setStyleSheet(styles);
                  tableWidget->horizontalHeader()->setStyleSheet(headerStyle);
                  tableWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
                  boxLayout->addWidget(tableWidget);
                  resize(MiniDialogSize);
              
              M 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Sorry but that's not compilable as it is.

                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
                0
                • F FunghiApe

                  Here it is:

                         const QSize MiniDialogSize(586, 368);
                  
                          auto tableWidget = new QTableWidget(2, 3, this);
                  	tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("A"))));
                  	tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString(tr("B"))));
                  	tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(QString(tr("C"))));
                  	tableWidget->setItem(0, 0, new QTableWidgetItem(QString("test1")));
                  	tableWidget->setItem(0, 1, new QTableWidgetItem(QString("test2")));
                  	tableWidget->setItem(0, 2, new QTableWidgetItem(QString("test3")));
                  	tableWidget->setItem(1, 0, new QTableWidgetItem(QString("test4")));
                  	tableWidget->setItem(1, 1, new QTableWidgetItem(QString("test5")));
                  	tableWidget->setItem(1, 2, new QTableWidgetItem(QString("test6")));
                  
                  	const QString styles = "QTableWidget {background-color:rgb(255, 255, 255);\
                  					border: 2px solid green;}\
                  					QTableWidget::Item { padding-left: 6px; border: 0; font-size: 12px;}";
                  
                  	const QString headerStyle = "QHeaderView::section\
                  	{\
                  		background-color: rgba(0, 100, 0, 255);\
                          color: white;\
                  		padding-left: 10px;\
                  		border: 2px solid blue;\
                  		border-right: 1px solid red;\
                  		font-size: 12px;\
                  	}";
                  
                      tableWidget->setStyleSheet(styles);
                      tableWidget->horizontalHeader()->setStyleSheet(headerStyle);
                      tableWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
                      boxLayout->addWidget(tableWidget);
                      resize(MiniDialogSize);
                  
                  M Offline
                  M Offline
                  mpergand
                  wrote on last edited by mpergand
                  #7

                  @FunghiApe

                  I 've just added this to the header style:

                  "QHeaderView\
                          {\
                              background-color: rgba(255,255, 255);\
                      }";
                  

                  And the horizontal gray bar is now white.

                  F 1 Reply Last reply
                  1
                  • M mpergand

                    @FunghiApe

                    I 've just added this to the header style:

                    "QHeaderView\
                            {\
                                background-color: rgba(255,255, 255);\
                        }";
                    

                    And the horizontal gray bar is now white.

                    F Offline
                    F Offline
                    FunghiApe
                    wrote on last edited by
                    #8

                    @mpergand Thank you!

                    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