Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved How to increase QTableWidgetItem SIZE

    General and Desktop
    qtablewidget qt 5.7 qtablewidgetite
    3
    5
    3360
    Loading More Posts
    • 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
      Swapnil_Shelke last edited by

      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 Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by

        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 Reply Quote 8
        • M
          mostefa last edited by mostefa

          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 Reply Quote 2
          • S
            Swapnil_Shelke @mostefa last edited by

            @mostefa

            This worked
            thanks .

            1 Reply Last reply Reply Quote 0
            • M
              mostefa last edited by

              @Swapnil_Shelke

              Happy to see that it helped you,

              You are welcome =)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post