Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved how can i set focus policy for a Qtablewidget column?

    General and Desktop
    3
    10
    2652
    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.
    • ?
      A Former User last edited by

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

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 2
        • ?
          A Former User last edited by A Former User

          @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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • ?
              A Former User @SGaist last edited by

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

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • ?
                  A Former User last edited by 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

                  VRonin 1 Reply Last reply Reply Quote 0
                  • VRonin
                    VRonin @Guest last edited by

                    @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 Reply Quote 0
                    • ?
                      A Former User @VRonin last edited by

                      @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 Reply Quote 0
                      • VRonin
                        VRonin last edited by

                        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 Reply Quote 1
                        • First post
                          Last post