static gint search_window_key_pressed(GtkWidget * widget, GdkEventKey * kevent) { switch (kevent->keyval) { case GDK_Escape: close_button_clicked(NULL, NULL); return TRUE; break; case GDK_Return: case GDK_KP_Enter: search_button_clicked(NULL, NULL); return TRUE; break; } return FALSE; }
void MainWindow::prepareGUI() { this->ui->mapLayout->addWidget(&this->map, 0, 0); this->map.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); this->textEditLog.append("Application log\nApplication started\n"); this->textEditLog.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); this->ui->controlsLayout->addWidget(&this->browser, 0, 0); this->ui->controlsLayout->addWidget(&this->list, 1, 0); this->ui->controlsLayout->addWidget(&this->textEditLog, 2, 0); this->map.setMapThemeId("earth/openstreetmap/openstreetmap.dgml"); connect(&this->map, SIGNAL(placeSelected(double,double,QString)), this, SLOT(placeSelected(double,double,QString))); connect(&this->browser, SIGNAL(search_button_clicked(QString)), this, SLOT(searchButton_clicked(QString))); connect(&this->browser, SIGNAL(add_button_clicked()), this, SLOT(addPlace())); connect(&this->browser, SIGNAL(suggestion_clicked(QListWidgetItem*)), this, SLOT(suggestion_clicked(QListWidgetItem*))); connect(&this->list, SIGNAL(btn_delete_click(QListWidgetItem*)), this, SLOT(deletePlace(QListWidgetItem*))); connect(&this->list, SIGNAL(btn_calculate_click(int)), this, SLOT(calculate(int))); connect(&this->list, SIGNAL(item_clicked(QListWidgetItem*)), this, SLOT(place_clicked(QListWidgetItem*))); }