[qet] [1077] Amelioration du widget d'edition des proprietes d' un conducteur au niveau de sa gestion du focus

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


Revision: 1077
Author:   xavier
Date:     2010-07-14 01:17:55 +0200 (Wed, 14 Jul 2010)
Log Message:
-----------
Amelioration du widget d'edition des proprietes d'un conducteur au niveau de sa gestion du focus

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

Modified: trunk/sources/conductorpropertieswidget.cpp
===================================================================
--- trunk/sources/conductorpropertieswidget.cpp	2010-07-12 07:02:45 UTC (rev 1076)
+++ trunk/sources/conductorpropertieswidget.cpp	2010-07-13 23:17:55 UTC (rev 1077)
@@ -45,6 +45,7 @@
 /// construit l'interface du widget
 void ConductorPropertiesWidget::buildInterface() {
 	
+	setFocusPolicy(Qt::StrongFocus);	
 	setMinimumSize(380, 350);
 	
 	QVBoxLayout *main_layout = new QVBoxLayout(this);
@@ -291,3 +292,17 @@
 	color_button -> setDisabled(ro);
 	dashed_checkbox -> setDisabled(ro);
 }
+
+/**
+	Gere le focus de ce widget
+*/
+void ConductorPropertiesWidget::focusInEvent(QFocusEvent *event) {
+	if (properties_.type == ConductorProperties::Multi) {
+		text_field -> setFocus(Qt::ActiveWindowFocusReason);
+		text_field -> selectAll();
+	} else if (properties_.type == ConductorProperties::Single) {
+		phase_spinbox -> setFocus(Qt::ActiveWindowFocusReason);
+		phase_spinbox -> selectAll();
+	}
+	QWidget::focusInEvent(event);
+}

Modified: trunk/sources/conductorpropertieswidget.h
===================================================================
--- trunk/sources/conductorpropertieswidget.h	2010-07-12 07:02:45 UTC (rev 1076)
+++ trunk/sources/conductorpropertieswidget.h	2010-07-13 23:17:55 UTC (rev 1077)
@@ -54,6 +54,9 @@
 	void updateDisplay();
 	void chooseColor();
 	
+	protected:
+	void focusInEvent(QFocusEvent *);
+	
 	// attributs prives
 	private:
 	QButtonGroup *radio_buttons;

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2010-07-12 07:02:45 UTC (rev 1076)
+++ trunk/sources/diagramview.cpp	2010-07-13 23:17:55 UTC (rev 1077)
@@ -705,6 +705,7 @@
 	dialog_layout -> addWidget(dbb);
 	connect(dbb, SIGNAL(accepted()), &conductor_dialog, SLOT(accept()));
 	connect(dbb, SIGNAL(rejected()), &conductor_dialog, SLOT(reject()));
+	cpw -> setFocus(Qt::ActiveWindowFocusReason);
 	
 	// execute le dialogue et met a jour le conducteur
 	if (conductor_dialog.exec() == QDialog::Accepted) {


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