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. QTableWidgetItem. Numbers only.

QTableWidgetItem. Numbers only.

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 6.6k Views 1 Watching
  • 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.
  • Z Offline
    Z Offline
    za83
    wrote on last edited by
    #1

    How can I make QTableWidgetItem accepting numbers only in editing.

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

      Hi,

      Use a custom QStyledItemDelegate that returns a QSpinBox has an editor

      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
      • Z Offline
        Z Offline
        za83
        wrote on last edited by
        #3

        Thank you. But I can't find any examples.

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

          Please, read the "documentation":http://qt-project.org/doc/qt-5/qstyleditemdelegate.html#details the link to the "example":http://qt-project.org/doc/qt-5/qtwidgets-itemviews-spinboxdelegate-example.html is given

          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
          • Z Offline
            Z Offline
            za83
            wrote on last edited by
            #5

            It works. Thank you!

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              za83
              wrote on last edited by
              #6

              How can I disable scrollbar?

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

                What scrollbar ?

                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
                • Z Offline
                  Z Offline
                  za83
                  wrote on last edited by
                  #8

                  I mistaked. Arrows on the right side. Not scrollbar.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    za83
                    wrote on last edited by
                    #9

                    Solved.
                    [code]
                    editor->setButtonSymbols(QAbstractSpinBox::NoButtons);
                    [/code]
                    Thank you.

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

                      You're welcome !

                      Since you have it working now as you like it, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                      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

                      • Login

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