[qet] [4056] ConductorPropertiesWidget: improve set focus |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4056
Author: scorpio810
Date: 2015-07-19 18:47:42 +0200 (Sun, 19 Jul 2015)
Log Message:
-----------
ConductorPropertiesWidget: improve set focus
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-19 15:52:44 UTC (rev 4055)
+++ trunk/sources/ui/conductorpropertieswidget.cpp 2015-07-19 16:47:42 UTC (rev 4056)
@@ -29,37 +29,15 @@
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ConductorPropertiesWidget),
- m_first_activation (true)
+ m_activation (true)
{
ui->setupUi(this);
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
@@ -141,6 +119,24 @@
}
/**
+ * @brief ConductorPropertiesWidget::event
+ * @param event
+ * @return
+ */
+bool ConductorPropertiesWidget::event(QEvent *event)
+{
+ if (m_activation)
+ {
+ if (event -> type() == QEvent::WindowActivate || event -> type() == QEvent::Show)
+ {
+ ui -> m_text_le -> setFocus();
+ }
+ }
+ return(QWidget::event(event));
+}
+
+
+/**
* @brief ConductorPropertiesWidget::setReadOnly
* @param ro if true this widget is disabled
*/
Modified: trunk/sources/ui/conductorpropertieswidget.h
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.h 2015-07-19 15:52:44 UTC (rev 4055)
+++ trunk/sources/ui/conductorpropertieswidget.h 2015-07-19 16:47:42 UTC (rev 4056)
@@ -48,6 +48,8 @@
void initWidget();
void setConductorType(ConductorProperties::ConductorType type);
+ protected:
+ virtual bool event(QEvent *event);
//SLOTS
public slots:
@@ -59,14 +61,12 @@
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;
+ bool m_activation;
};
#endif // CONDUCTORPROPERTIESWIDGET_H