StackedWidget-da versiya yangilanib bo'lmadi

Stackedwidget-dan foydalanayapman va nima uchun men ko'rinishni yangilashga qodir emasman. Buni birinchi marta ko'rish uchun ishlatganman (boshqarish_employee_data).

connect(ui.actionManage_Employees_Data, SIGNAL(triggered()), this, SLOT(manage_employee_data()));

Mana, men ko'rinishni yangilash uchun foydalanadigan kod.

void employed::manage_employee_data()
{
    tablesModel = new QSqlTableModel(ui.empds_tableview);
    tablesModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
    tablesModel->setTable("employee_datastores");

    ui.empds_tableview->setModel(tablesModel);

    ui.empds_tableview->setColumnHidden(tablesModel->fieldIndex("id"), true);
    ui.empds_tableview->setColumnHidden(tablesModel->fieldIndex("employee_datastore_description"), true);

    ui.empds_tableview->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui.empds_tableview->setSelectionMode(QAbstractItemView::SingleSelection);
    ui.empds_tableview->setSortingEnabled(true);

    ui.empds_tableview->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui.empds_tableview->horizontalHeader()->setStretchLastSection(true);

    tablesModel->select();
    //Localized Header Captions
    tablesModel->setHeaderData(1, Qt::Horizontal, tr("Employee DataStore Name"));

    connect(ui.empds_tableview->selectionModel(),
            SIGNAL(currentRowChanged(const QModelIndex&,
                                     const QModelIndex&)),
            this, SLOT(updateView()));

    ui.stackedWidget->setCurrentWidget(ui.page_10);

}

void employed::updateView()
{
    QMessageBox msgBox;
    msgBox.setText("Manage Employee Data Sent Me.");
    msgBox.exec();
}
0
Men buni hal qildim va u hozir yaxshi ishlaydi. Rahmat.
qo'shib qo'ydi muallif Gandalf, manba
Buni qanday hal qildingiz? O'zingizning savolingizga javob berishingiz mumkin ...
qo'shib qo'ydi muallif alexisdm, manba

1 javoblar

I just added ui.stackedWidget->setCurrentWidget(ui.page_10); to my update function.

void employed::updateView()
{
    QMessageBox msgBox;
    msgBox.setText("Manage Employee Data Sent Me.");
    msgBox.exec();
    ui.stackedWidget->setCurrentWidget(ui.page_10);
}
0
qo'shib qo'ydi