[qet] [4053] ConductorPropertiesWidget: set focus to the line edit

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4053
Author:   scorpio810
Date:     2015-07-19 17:34:37 +0200 (Sun, 19 Jul 2015)
Log Message:
-----------
ConductorPropertiesWidget: set focus to the line edit

Modified Paths:
--------------
    trunk/sources/ui/conductorpropertieswidget.cpp
    trunk/sources/ui/conductorpropertieswidget.h

Modified: trunk/sources/ui/conductorpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.cpp	2015-07-16 14:58:01 UTC (rev 4052)
+++ trunk/sources/ui/conductorpropertieswidget.cpp	2015-07-19 15:34:37 UTC (rev 4053)
@@ -35,6 +35,31 @@
 }
 
 /**
+ * @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
  * @param properties, properties to edit

Modified: trunk/sources/ui/conductorpropertieswidget.h
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.h	2015-07-16 14:58:01 UTC (rev 4052)
+++ trunk/sources/ui/conductorpropertieswidget.h	2015-07-19 15:34:37 UTC (rev 4053)
@@ -48,6 +48,7 @@
 		void initWidget();
 		void setConductorType(ConductorProperties::ConductorType type);
 
+
 	//SLOTS
 	public slots:
 		void updatePreview(bool b = true);
@@ -58,11 +59,14 @@
 		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


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/