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. QTablewidget insert check box and do alot
QtWS25 Last Chance

QTablewidget insert check box and do alot

Scheduled Pinned Locked Moved Unsolved General and Desktop
24 Posts 4 Posters 4.2k 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.
  • ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by
    #1

    i want to create table with 14 items on it and i want to create check box for all the 14 items and a common checkbox that acts as select all how can i do this ?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      QTableWidget, QTableWidgetItem, setData with Qt::CheckStateRole and separate checkBox together should be able to help you. Have you tried creating the QTableWidget with QTableWidgetItems ?

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

      1 Reply Last reply
      3
      • ManiRonM Offline
        ManiRonM Offline
        ManiRon
        wrote on last edited by
        #3

        one doubt sir once i run my application i can modify the coloum width but i dont want to do it what can i do for that

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

          Hi
          You can do
          ui->tableWidget->horizontalHeader()->setSectionResizeMode (QHeaderView::Fixed);
          so they are not adjustable at runtime.

          1 Reply Last reply
          1
          • ManiRonM Offline
            ManiRonM Offline
            ManiRon
            wrote on last edited by ManiRon
            #5

            @mrjj

            Sir i want to create an action log wi=hich should be editable at runtime means it should be like this in application
            0_1547897039531_Untitled.jpg

            we can drag up or down this action log similarly i want to create can we create like that?

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              The http://doc.qt.io/qt-5/qsplitter.html#details
              allows to drag and change size allocated to the widget on both sides of it.
              That could be used to make similar feature.

              ManiRonM 1 Reply Last reply
              4
              • mrjjM mrjj

                Hi
                The http://doc.qt.io/qt-5/qsplitter.html#details
                allows to drag and change size allocated to the widget on both sides of it.
                That could be used to make similar feature.

                ManiRonM Offline
                ManiRonM Offline
                ManiRon
                wrote on last edited by
                #7

                @mrjj we can drag it up and down if we use splitter?

                mrjjM 1 Reply Last reply
                0
                • ManiRonM ManiRon

                  @mrjj we can drag it up and down if we use splitter?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @ManiRon
                  Yes that is what the splitter does. its allows you to drag the splitter
                  and give more or less space to the widgets it controls.

                  To fast try it out.
                  Place any 2 widget on a form. then select both and
                  then right clik. Now in Layout menu there is option to
                  insert splitter between them.

                  alt text

                  ManiRonM 4 Replies Last reply
                  3
                  • mrjjM mrjj

                    @ManiRon
                    Yes that is what the splitter does. its allows you to drag the splitter
                    and give more or less space to the widgets it controls.

                    To fast try it out.
                    Place any 2 widget on a form. then select both and
                    then right clik. Now in Layout menu there is option to
                    insert splitter between them.

                    alt text

                    ManiRonM Offline
                    ManiRonM Offline
                    ManiRon
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • Maaz MominM Offline
                      Maaz MominM Offline
                      Maaz Momin
                      wrote on last edited by
                      #10

                      @ManiRon Layout is missing.

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @ManiRon
                        Yes that is what the splitter does. its allows you to drag the splitter
                        and give more or less space to the widgets it controls.

                        To fast try it out.
                        Place any 2 widget on a form. then select both and
                        then right clik. Now in Layout menu there is option to
                        insert splitter between them.

                        alt text

                        ManiRonM Offline
                        ManiRonM Offline
                        ManiRon
                        wrote on last edited by
                        #11

                        @mrjj

                        It worked sir thanks

                        1 Reply Last reply
                        1
                        • mrjjM mrjj

                          @ManiRon
                          Yes that is what the splitter does. its allows you to drag the splitter
                          and give more or less space to the widgets it controls.

                          To fast try it out.
                          Place any 2 widget on a form. then select both and
                          then right clik. Now in Layout menu there is option to
                          insert splitter between them.

                          alt text

                          ManiRonM Offline
                          ManiRonM Offline
                          ManiRon
                          wrote on last edited by
                          #12

                          @mrjj

                          Sir i inserted a background image and set background color for a QTableWidget but i amgetting it like this 0_1548069526329_Untitled.jpg

                          But i want it to be same for the whole table and the font color for the items also to be changed to white . How can i do this ?

                          1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @ManiRon
                            Yes that is what the splitter does. its allows you to drag the splitter
                            and give more or less space to the widgets it controls.

                            To fast try it out.
                            Place any 2 widget on a form. then select both and
                            then right clik. Now in Layout menu there is option to
                            insert splitter between them.

                            alt text

                            ManiRonM Offline
                            ManiRonM Offline
                            ManiRon
                            wrote on last edited by
                            #13

                            @mrjj and another doubt is that i want to have a tick mark in the menu item when it is pressed . whether it can be done or not ?

                            mrjjM 1 Reply Last reply
                            0
                            • ManiRonM ManiRon

                              @mrjj and another doubt is that i want to have a tick mark in the menu item when it is pressed . whether it can be done or not ?

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @ManiRon
                              Hi
                              You mean in a QMenu or in the QTableWidget ?

                              ManiRonM 2 Replies Last reply
                              0
                              • mrjjM mrjj

                                @ManiRon
                                Hi
                                You mean in a QMenu or in the QTableWidget ?

                                ManiRonM Offline
                                ManiRonM Offline
                                ManiRon
                                wrote on last edited by
                                #15

                                @mrjj Its solved sir,

                                But facing a new one .

                                I have added a style sheet for a pushbutton
                                Stylesheet:
                                background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909, stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(50, 50, 50, 255));
                                border: 1px solid black;
                                border-radius: 8px;
                                color:white;

                                But i want to highlight when its pressed but when i add that its not working is there any sequence i should follow?

                                1 Reply Last reply
                                0
                                • mrjjM mrjj

                                  @ManiRon
                                  Hi
                                  You mean in a QMenu or in the QTableWidget ?

                                  ManiRonM Offline
                                  ManiRonM Offline
                                  ManiRon
                                  wrote on last edited by
                                  #16

                                  @mrjj

                                  Sir how to bring the pressed effect to a push button in QT when style sheet is added

                                  mrjjM 1 Reply Last reply
                                  0
                                  • ManiRonM ManiRon

                                    @mrjj

                                    Sir how to bring the pressed effect to a push button in QT when style sheet is added

                                    mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @ManiRon
                                    Hi
                                    Its has a state for it

                                    QPushButton:pressed {
                                      background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909, 
                                      stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(50, 50, 50, 255));
                                      border: 1px solid black;
                                      border-radius: 8px;
                                      color:white;
                                    }
                                    

                                    http://doc.qt.io/qt-5/stylesheet-examples.html

                                    ManiRonM 1 Reply Last reply
                                    2
                                    • mrjjM mrjj

                                      @ManiRon
                                      Hi
                                      Its has a state for it

                                      QPushButton:pressed {
                                        background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909, 
                                        stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(50, 50, 50, 255));
                                        border: 1px solid black;
                                        border-radius: 8px;
                                        color:white;
                                      }
                                      

                                      http://doc.qt.io/qt-5/stylesheet-examples.html

                                      ManiRonM Offline
                                      ManiRonM Offline
                                      ManiRon
                                      wrote on last edited by
                                      #18

                                      @mrjj i gave it sir but know change

                                      QPushButton{background-color:qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909,stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(50, 50, 50, 255));
                                      border: 1px solid black;
                                      border-radius: 8px;
                                      color:white;}

                                      QPushButton:hover:!pressed
                                      {
                                      background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909, stop:0.0795455 rgba(0, 150, 190, 255), stop:1 rgba(50, 50, 100, 255));
                                      border: 2px solid black;
                                      border-radius: 8px;
                                      color:white;
                                      }

                                      mrjjM 1 Reply Last reply
                                      0
                                      • ManiRonM ManiRon

                                        @mrjj i gave it sir but know change

                                        QPushButton{background-color:qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909,stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(50, 50, 50, 255));
                                        border: 1px solid black;
                                        border-radius: 8px;
                                        color:white;}

                                        QPushButton:hover:!pressed
                                        {
                                        background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.8, fx:0.499, fy:0.488909, stop:0.0795455 rgba(0, 150, 190, 255), stop:1 rgba(50, 50, 100, 255));
                                        border: 2px solid black;
                                        border-radius: 8px;
                                        color:white;
                                        }

                                        mrjjM Offline
                                        mrjjM Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        @ManiRon
                                        Hi
                                        Why use ! (not pressed ) ?
                                        as that is same as normal ?

                                        ManiRonM 1 Reply Last reply
                                        0
                                        • mrjjM mrjj

                                          @ManiRon
                                          Hi
                                          Why use ! (not pressed ) ?
                                          as that is same as normal ?

                                          ManiRonM Offline
                                          ManiRonM Offline
                                          ManiRon
                                          wrote on last edited by
                                          #20

                                          @mrjj yes sir i removed it but i want an effect which all buttons have when pressed

                                          ManiRonM 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