Search code examples
c++qtqtgui

Qt: How to access an element dragged on the main window by its id?


I have created a Table View by dragging and dropping it on the main window of a Qt application. The objectName of this Table View is set to tableView which seems to be only defined in the mainwindow.ui xml file. How can I access and set some properties of tableView from main.cpp or any other class?


Solution

  • You can access and set the properties of tableview from the mainwindow.cpp(not from the main.cpp ). Use ui.tableView.(properties or function) to edit the properties you need. May my answer can help you.