Results 1 to 3 of 3

Thread: QDateEdit With DataMapper - No Tab traversing?

  1. #1
    Join Date
    Apr 2008
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question QDateEdit With DataMapper - No Tab traversing?

    Not sure if this is a qt, pyqt (or something in my os environment)
    problem, but...

    I have a QDateEdit widget which is mapped to a database date field.
    The issue I have is ...

    I can tab into the widget, ie into the 'dd' of 'dd/MM/yyyy' but cannot
    tab onto the 'MM' and from MM cannot tab to 'yyyy'. However, I can tab
    from 'yyyy' to another control.

    If I comment out the datamapper line then I can use tab as expected.

    I have checked the book examples from Rapid GUI Programming with
    Python and PyQt and see the same problem there.

    My versions are 'Python 2.5.2 - Qt 4.3.4- PyQt 4.3.3 on Linux 2.6.24-19-generic'.
    However, I've also tested this on WinXP using a PyQt-Py2.5-gpl-4.4.2-1 install
    with the same results.

    Any help would be much appreciated as this is kinda a show stopper for
    me - I am trying to make this form as quick as possible to use for
    processing orders.

    Chris.

  2. #2
    Join Date
    Apr 2008
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QDateEdit With DataMapper - No Tab traversing?

    Can anyone confirm if this is expected behaviour? Also a quick (python) example of the issue,

    Qt Code:
    1. #!/usr/bin/env python
    2. import os
    3. import sys
    4. from PyQt4.QtCore import *
    5. from PyQt4.QtGui import *
    6. from PyQt4.QtSql import *
    7.  
    8. class ExampleDlg(QDialog):
    9.  
    10. def __init__(self, parent=None):
    11. super(ExampleDlg, self).__init__(parent)
    12.  
    13. label1 = QLabel("First Edit:")
    14. self.edit1 = QLineEdit()
    15. label2 = QLabel("Unmapped:")
    16. self.dateTime1 = QDateTimeEdit()
    17. label3 = QLabel("Mapped:")
    18. self.dateTime2 = QDateTimeEdit()
    19. label4 = QLabel("Second Edit:")
    20. self.edit2 = QLineEdit()
    21.  
    22. fieldLayout = QGridLayout()
    23. fieldLayout.addWidget(label1, 0, 0)
    24. fieldLayout.addWidget(self.edit1, 0, 1, 1, 3)
    25. fieldLayout.addWidget(label2, 1, 0)
    26. fieldLayout.addWidget(self.dateTime1, 1, 1)
    27. fieldLayout.addWidget(label3, 1, 2)
    28. fieldLayout.addWidget(self.dateTime2, 1, 3)
    29. fieldLayout.addWidget(label4, 2, 0)
    30. fieldLayout.addWidget(self.edit2, 2, 1, 1, 3)
    31. self.setLayout(fieldLayout)
    32.  
    33. self.model = QSqlRelationalTableModel(self)
    34. self.model.setTable("calls")
    35. self.model.select()
    36.  
    37. self.mapper = QDataWidgetMapper(self)
    38. self.mapper.setSubmitPolicy(QDataWidgetMapper.ManualSubmit)
    39. self.mapper.setModel(self.model)
    40. self.mapper.setItemDelegate(QSqlRelationalDelegate(self))
    41. self.mapper.addMapping(self.edit1, 1)
    42. #self.mapper.addMapping(self.dateTime1, 2)
    43. self.mapper.addMapping(self.dateTime2, 3)
    44. self.mapper.addMapping(self.edit2, 4)
    45. self.mapper.toFirst()
    46.  
    47. app = QApplication(sys.argv)
    48. filename = os.path.join(os.path.dirname(__file__), "example.db")
    49. db = QSqlDatabase.addDatabase("QSQLITE")
    50. db.setDatabaseName(filename)
    51. if not db.open():
    52. sys.exit(1)
    53. form = ExampleDlg()
    54. form.show()
    55. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 

    I've noticed you can still navigate through the QDateEdit using the cursor keys or by entering values, but would expect to be able to navigate through the form widgets using tab.

  3. #3
    Join Date
    Apr 2008
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QDateEdit With DataMapper - No Tab traversing?

    Anyone?

    I'm struggling with this. Is there any way I can capture the key event for Tab and change the QDateEdit section by code?

Similar Threads

  1. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.