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. Input mask for QTableWidgetItem and QTreeWidgetItem
Forum Updated to NodeBB v4.3 + New Features

Input mask for QTableWidgetItem and QTreeWidgetItem

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.2k 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.
  • D Offline
    D Offline
    Djay96
    wrote on last edited by
    #1

    Hello,
    I have QTreeWidget with multiple column . I want input mask for some columns in QTreeWidget i.e. for column number 3 only double values. Is there any way to implement this. I tried using QLineEdit widget and QDoubleValidator but i don't want to use QLineEdit in column. If you have any suggestions how to implement this please let me know.
    Thank you !

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

      Hi,

      You can do that by creating a custom QStyledItemDelegate that uses a QDoubleSpinBox as 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
      • D Offline
        D Offline
        Djay96
        wrote on last edited by
        #3

        @SGaist Thank you !
        this is the best to implement above problem but as got your answer i got new requirement from user as follow.
        There will be a column containing QComboBox and as per comboBox selection other column inputs mask will be changed in particular row.
        input mask will be integer and double with ranges. Therefore different validator (at least 4) for different ComboBox selection.
        Therefore i want generic way to implement input masks for columns.
        Thank you in advance .

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

          You're requirements are not clear at all. There's a mix between a table view, a custom widget showing database entries or maybe something else. If you are not using one of the item views then you are free to setup your input as you want. If these are only numbers then you have both QSpinBox and QDoubleSpinBox.

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

            @SGaist Thank You !

            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