Results 1 to 2 of 2

Thread: Updating a view from StackedWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    67
    Thanks
    22
    Thanked 5 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Updating a view from StackedWidget

    I am trying to update a view from a stackedwidget and it does not work.

    I have this:

    Qt Code:
    1. void employed::manage_employee_data()
    2. {
    3. tablesModel = new QSqlTableModel(ui.empds_tableview);
    4. tablesModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
    5. tablesModel->setTable("employee_datastores");
    6.  
    7. ui.empds_tableview->setModel(tablesModel);
    8.  
    9. ui.empds_tableview->setColumnHidden(tablesModel->fieldIndex("id"), true);
    10. ui.empds_tableview->setColumnHidden(tablesModel->fieldIndex("employee_datastore_description"), true);
    11.  
    12. ui.empds_tableview->setEditTriggers(QAbstractItemView::NoEditTriggers);
    13. ui.empds_tableview->setSelectionMode(QAbstractItemView::SingleSelection);
    14. ui.empds_tableview->setSortingEnabled(true);
    15.  
    16. ui.empds_tableview->setSelectionBehavior(QAbstractItemView::SelectRows);
    17. ui.empds_tableview->horizontalHeader()->setStretchLastSection(true);
    18.  
    19. tablesModel->select();
    20. //Localized Header Captions
    21. tablesModel->setHeaderData(1, Qt::Horizontal, tr("Employee DataStore Name"));
    22.  
    23. connect(ui.empds_tableview->selectionModel(),
    24. SIGNAL(currentRowChanged(const QModelIndex&,
    25. const QModelIndex&)),
    26. this, SLOT(updateView()));
    27.  
    28. ui.stackedWidget->setCurrentWidget(ui.page_10);
    29.  
    30. }
    31.  
    32. void employed::updateView()
    33. {
    34. QMessageBox msgBox;
    35. msgBox.setText("Manage Employee Data Sent Me.");
    36. msgBox.exec();
    37. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Apr 2011
    Posts
    67
    Thanks
    22
    Thanked 5 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Updating a view from StackedWidget

    I solved it and the error was elsewhere and the code worked.

Similar Threads

  1. Replies: 1
    Last Post: 8th June 2011, 14:13
  2. Replies: 7
    Last Post: 22nd November 2009, 19:47
  3. Updating a view on demand
    By schall_l in forum Qt Programming
    Replies: 3
    Last Post: 14th August 2009, 09:34
  4. Updating directory view in a QListView
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2009, 23:48
  5. Replies: 1
    Last Post: 14th January 2009, 10:10

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.