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 can i set focus policy for a Qtablewidget column?

how can i set focus policy for a Qtablewidget column?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 4.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello,
    i need to make some columns have no focus and other have in Qtablewidget table

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

      Hi,

      Do you mean clear the Qt::ItemIsSelectable flag on the items of the column ?

      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
      2
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #3

        @SGaist
        0_1538167095995_bc648959-d0f8-430e-9ca0-a3fb496efb9c-image.png
        i have made the name, cost, public price, total Qlineedit but it's read only.
        when the user trigger the barcode it will insert new row with the name that match the inserted barcode in the DB
        so the user will not edit name or cost or public price or total it will be getten from the DB
        so i want the user when he press TAB button on the keyboard it will skip name, cost, public price, total and jump from quantity to discount and expire date then it goes to the socund row and jump directly to quantity and so on

        sorry for the bad English

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

          Did you already saw the Keyboard Focus in Widgets chapter in Qt's documentation ?

          As well as QWidget::setTabOrder ?

          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
          • SGaistS SGaist

            Did you already saw the Keyboard Focus in Widgets chapter in Qt's documentation ?

            As well as QWidget::setTabOrder ?

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @SGaist
            ok this is for QWidgets
            i'm dealing here with cells inside a Qtablewidget(QWidget) not QWidget itself

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

              From the looks of your screenshot you seem to have widgets in all the cells. It's not the case ?

              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
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by A Former User
                #7

                @SGaist
                0_1538170784407_fc9dd1cc-d292-4ff4-9abc-06eaa8469668-image.png
                yes there is a widgets in side the cells but i have set no focus for all the Qlineedit widgets
                and it's still make focus on the cell it self not the widget in side it

                VRoninV 1 Reply Last reply
                0
                • ? A Former User

                  @SGaist
                  0_1538170784407_fc9dd1cc-d292-4ff4-9abc-06eaa8469668-image.png
                  yes there is a widgets in side the cells but i have set no focus for all the Qlineedit widgets
                  and it's still make focus on the cell it self not the widget in side it

                  VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by
                  #8

                  @davidlabib said in how can i set focus policy for a Qtablewidget column?:

                  yes there is a widgets in side the cells

                  And this kids, is why setItemWidget should burn in hell for eternity. I can understand using it for complex widgets but what are you setting widgets for simple lineedits, spinboxes and dateedit?

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  ? 1 Reply Last reply
                  0
                  • VRoninV VRonin

                    @davidlabib said in how can i set focus policy for a Qtablewidget column?:

                    yes there is a widgets in side the cells

                    And this kids, is why setItemWidget should burn in hell for eternity. I can understand using it for complex widgets but what are you setting widgets for simple lineedits, spinboxes and dateedit?

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    @VRonin
                    Because I didn't found another way to do it.

                    Please simplify your words, English is not my main language

                    1 Reply Last reply
                    0
                    • VRoninV Offline
                      VRoninV Offline
                      VRonin
                      wrote on last edited by
                      #10

                      See http://doc.qt.io/qt-5/qstyleditemdelegate.html and http://doc.qt.io/qt-5/qitemeditorfactory.html

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      1 Reply Last reply
                      1

                      • Login

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