diff --git a/sources/ui/conductorpropertieswidget.cpp b/sources/ui/conductorpropertieswidget.cpp index 9053c36d3..a69f4a0e7 100644 --- a/sources/ui/conductorpropertieswidget.cpp +++ b/sources/ui/conductorpropertieswidget.cpp @@ -34,6 +34,31 @@ ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) : initWidget(); } +/** + * @brief ConductorPropertiesWidget::event + * @param event + * @return + */ +bool ConductorPropertiesWidget::event(QEvent *event) +{ + if (m_first_activation) + { + if (event -> type() == QEvent::WindowActivate || event -> type() == QEvent::Show) + { + QTimer::singleShot(10, this, SLOT(firstActivated())); + m_first_activation = true; + } + } + return(QWidget::event(event)); +} + +/** + * @brief ConductorPropertiesWidget::firstActivated + */ +void ConductorPropertiesWidget::firstActivated() { + ui -> m_text_le -> setFocus(); +} + /** * @brief ConductorPropertiesWidget::ConductorPropertiesWidget * Constructor with properties diff --git a/sources/ui/conductorpropertieswidget.h b/sources/ui/conductorpropertieswidget.h index 9fd1ad7f5..b45b3592c 100644 --- a/sources/ui/conductorpropertieswidget.h +++ b/sources/ui/conductorpropertieswidget.h @@ -48,6 +48,7 @@ class ConductorPropertiesWidget : public QWidget void initWidget(); void setConductorType(ConductorProperties::ConductorType type); + //SLOTS public slots: void updatePreview(bool b = true); @@ -58,11 +59,14 @@ class ConductorPropertiesWidget : public QWidget void on_m_color_pb_clicked(); void setColorButton (const QColor &color); void on_m_update_preview_pb_clicked(); + void firstActivated(); + virtual bool event(QEvent *event); private: Ui::ConductorPropertiesWidget *ui; ConductorProperties m_properties; QTextOrientationSpinBoxWidget *m_verti_select, *m_horiz_select; + bool m_first_activation; }; #endif // CONDUCTORPROPERTIESWIDGET_H