mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
ConductorPropertiesWidget: improve set focus
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4056 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -29,36 +29,14 @@
|
|||||||
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::ConductorPropertiesWidget),
|
ui(new Ui::ConductorPropertiesWidget),
|
||||||
m_first_activation (true)
|
m_activation (true)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initWidget();
|
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
|
* @brief ConductorPropertiesWidget::ConductorPropertiesWidget
|
||||||
@@ -140,6 +118,24 @@ ConductorProperties ConductorPropertiesWidget::properties() const {
|
|||||||
return properties_;
|
return properties_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
* @brief ConductorPropertiesWidget::setReadOnly
|
||||||
* @param ro if true this widget is disabled
|
* @param ro if true this widget is disabled
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class ConductorPropertiesWidget : public QWidget
|
|||||||
void initWidget();
|
void initWidget();
|
||||||
void setConductorType(ConductorProperties::ConductorType type);
|
void setConductorType(ConductorProperties::ConductorType type);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool event(QEvent *event);
|
||||||
|
|
||||||
//SLOTS
|
//SLOTS
|
||||||
public slots:
|
public slots:
|
||||||
@@ -59,14 +61,12 @@ class ConductorPropertiesWidget : public QWidget
|
|||||||
void on_m_color_pb_clicked();
|
void on_m_color_pb_clicked();
|
||||||
void setColorButton (const QColor &color);
|
void setColorButton (const QColor &color);
|
||||||
void on_m_update_preview_pb_clicked();
|
void on_m_update_preview_pb_clicked();
|
||||||
void firstActivated();
|
|
||||||
virtual bool event(QEvent *event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ConductorPropertiesWidget *ui;
|
Ui::ConductorPropertiesWidget *ui;
|
||||||
ConductorProperties m_properties;
|
ConductorProperties m_properties;
|
||||||
QTextOrientationSpinBoxWidget *m_verti_select, *m_horiz_select;
|
QTextOrientationSpinBoxWidget *m_verti_select, *m_horiz_select;
|
||||||
bool m_first_activation;
|
bool m_activation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONDUCTORPROPERTIESWIDGET_H
|
#endif // CONDUCTORPROPERTIESWIDGET_H
|
||||||
|
|||||||
Reference in New Issue
Block a user