Forum Discussion

rrubio's avatar
rrubio
Contributor
14 years ago

QT QTableView control support



I need to test an application which uses a QTableView control.

Although I have all Qt plug-ins installed, I see this control as a bitmap, instead of a table control.



Implementation of application under test uses this QTableView control as a view of a QStandardItemModel component.

(attached file contains the application GUI with this control)





When spying this control, I obtain the following FullName:



Sys.Process("Funnel").QtObject("FunnelMain").QtObject("centralwidget").QtObject("toolBox").QtObject("QScrollArea", "", 2).QtObject("qt_scrollarea_viewport").QtObject("page_2").QtObject("tableViewTags").QtObject("qt_scrollarea_viewport")





When recording some interactions with table I obtain the following:



Sub Test1()

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.Click(161, 12)

  'Enters '5' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("5")

  'Sets the 5 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 5

  'Enters '0' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("0")

  'Sets the 50 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 50

  'Enters '0' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("0")

  'Sets the 500 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 500

  'Enters '0' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("0")

  'Sets the 5000 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 5000

  'Enters '0' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("0")

  'Sets the 50000 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 50000

  'Enters '[Enter]' in the 'SpinBox' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.Keys("[Enter]")

  'Sets the 50000 value in the 'SpinBox' spin box.

  Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 50000

  'Enters '[Tab][Tab]' in the 'tableViewTags' object.

  Call Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.Keys("[Tab][Tab]")

End Sub



Could anybody help me to be able to work with this control as a table with all its methods and properties?



Basically, I need to move to a cell (x, y), get and set text



Thank you vey much,



Raul




  • Hi Raul,



    Currently, TestComplete cannot recognize a QTableView control as a table control. That is, internal methods and properties of this control are not accessible from your tests. However, we have a suggestion to implement this, and your request has increased its rating. Thank you.



    Meanwhile, you can test this control in black-box mode by simulating user actions over it (clicks, double-clicks, keystrokes, and others). Also, as you may notice, TestComplete can recognize some child controls of the QTableView control.  In your case, it is the SpinBox control:

    Aliases.Funnel.FunnelMain.centralwidget.toolBox.ScrollArea.qt_scrollarea_viewport.page_2.tableViewTags.qt_scrollarea_viewport.SpinBox.wValue = 50000


    You can use properties and methods of this control to get or set text to the needed cell. For more information, see the QtSpinBox object help topic.