void ConfigurationDialogWidget::keyPressEvent(QKeyEvent* e) { bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("qt", e, actions); for (int i = 0; i < actions.size() && !handled; i++) { const QString &action = actions[i]; handled = true; if (action == "SELECT") accept(); else if (action == "ESCAPE") reject(); else if (action == "EDIT") emit editButtonPressed(); else if (action == "DELETE") emit deleteButtonPressed(); else handled = false; } if (!handled) MythDialog::keyPressEvent(e); }
MythDialog* StorageGroupListEditor::dialogWidget(MythMainWindow* parent, const char* widgetName) { dialog = ConfigurationDialog::dialogWidget(parent, widgetName); connect(dialog, SIGNAL(menuButtonPressed()), this, SLOT(doDelete())); connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(doDelete())); return dialog; }
MythDialog* ChannelEditor::dialogWidget(MythMainWindow* parent, const char* widgetName) { dialog = ConfigurationDialog::dialogWidget(parent, widgetName); connect(dialog, SIGNAL(editButtonPressed()), this, SLOT(edit())); connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(del())); return dialog; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); InterfaceController c; MainWindow w; c.window=&w; QObject::connect(&w,SIGNAL(addButtonPressed()),&c,SLOT(callAddFilmDialog())); QObject::connect(&w,SIGNAL(getInfo(QString)),&c,SLOT(callInfoDialog(QString))); QObject::connect(&c,SIGNAL(addFilm(Film)),&w,SLOT(addFilm(Film))); QObject::connect(&w,SIGNAL(editButtonPressed(QString)),&c,SLOT(callEditFilmDialog(QString))); QObject::connect(&c,SIGNAL(editFilm(Film)),&w,SLOT(editFilm(Film))); QObject::connect(&w,SIGNAL(deleteButtonPressed(QString)),&c,SLOT(callDeleteFilmDialog(QString))); c.initTable(); w.show(); return a.exec(); }