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. How to increase QTableWidgetItem SIZE
QtWS25 Last Chance

How to increase QTableWidgetItem SIZE

Scheduled Pinned Locked Moved Solved General and Desktop
qtablewidgetqt 5.7qtablewidgetite
5 Posts 3 Posters 4.3k Views
  • 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.
  • S Offline
    S Offline
    Swapnil_Shelke
    wrote on 20 Feb 2017, 10:15 last edited by
    #1

    I have these check boxes in my QTableWidget for selection but the check-boxes are small and not accessible properly with touch.
    I add the check-boxes the following way

    QTableWidgetItem *pItem = new QTableWidgetItem();
    pItem->setCheckState(Qt::Unchecked);

    Is there any way i can increase the check-box size.
    thanks in advance :)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 20 Feb 2017, 11:06 last edited by
      #2

      There is no direct way to do this as qtablewidgetitems are not widget. Either you create your own checkbox and set the style sheet and use setcellwidget. Or you write your own table view and write ur own delegate with checkbox

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      8
      • M Offline
        M Offline
        mostefa
        wrote on 20 Feb 2017, 20:50 last edited by mostefa
        #3

        Hi @Swapnil_Shelke

        Yes you can play with stylesheet to increase checkBox Size

        you can do something like this for example:

        yourTableWidget->setStyleSheet("QAbstractItemView::indicator { width: 40px;height:40px;/*size of checkbox change here */} QTableWidget::item{width: 200px;height: 100px;} "/*size of item */);

        The result will be then, something like this ;

        alt text

        instead of

        alt text

        alt text

        This can help you to solve your problem , but i really doubt that it is the best solution,

        S 1 Reply Last reply 21 Feb 2017, 07:11
        2
        • M mostefa
          20 Feb 2017, 20:50

          Hi @Swapnil_Shelke

          Yes you can play with stylesheet to increase checkBox Size

          you can do something like this for example:

          yourTableWidget->setStyleSheet("QAbstractItemView::indicator { width: 40px;height:40px;/*size of checkbox change here */} QTableWidget::item{width: 200px;height: 100px;} "/*size of item */);

          The result will be then, something like this ;

          alt text

          instead of

          alt text

          alt text

          This can help you to solve your problem , but i really doubt that it is the best solution,

          S Offline
          S Offline
          Swapnil_Shelke
          wrote on 21 Feb 2017, 07:11 last edited by
          #4

          @mostefa

          This worked
          thanks .

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mostefa
            wrote on 21 Feb 2017, 17:51 last edited by
            #5

            @Swapnil_Shelke

            Happy to see that it helped you,

            You are welcome =)

            1 Reply Last reply
            0

            2/5

            20 Feb 2017, 11:06

            • Login

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