[qet] qet/qet: [4955] Improve last comit |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4955
Author: blacksun
Date: 2017-05-01 18:22:34 +0200 (Mon, 01 May 2017)
Log Message:
-----------
Improve last comit
Modified Paths:
--------------
trunk/sources/ElementsCollection/elementscollectionwidget.cpp
trunk/sources/ElementsCollection/elementscollectionwidget.h
trunk/sources/qetdiagrameditor.cpp
trunk/sources/qetdiagrameditor.h
Modified: trunk/sources/ElementsCollection/elementscollectionwidget.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2017-05-01 15:47:28 UTC (rev 4954)
+++ trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2017-05-01 16:22:34 UTC (rev 4955)
@@ -128,17 +128,6 @@
m_tree_view->setCurrentIndex(m_model->indexFromLocation(location));
}
-bool ElementsCollectionWidget::event(QEvent *event)
-{
- if (m_first_show && event->type() == QEvent::Show)
- {
- m_first_show = false;
- QTimer::singleShot(250, this, SLOT(reload()));
- }
-
- return QWidget::event(event);
-}
-
void ElementsCollectionWidget::leaveEvent(QEvent *event)
{
if (QETDiagramEditor *qde = QETApp::diagramEditorAncestorOf(this))
Modified: trunk/sources/ElementsCollection/elementscollectionwidget.h
===================================================================
--- trunk/sources/ElementsCollection/elementscollectionwidget.h 2017-05-01 15:47:28 UTC (rev 4954)
+++ trunk/sources/ElementsCollection/elementscollectionwidget.h 2017-05-01 16:22:34 UTC (rev 4955)
@@ -54,7 +54,6 @@
void setCurrentLocation(const ElementsLocation &location);
protected:
- virtual bool event(QEvent *event);
virtual void leaveEvent(QEvent *event);
private:
@@ -78,7 +77,7 @@
void showAndExpandItem (const QModelIndex &index, bool parent = true, bool child = false);
ElementCollectionItem *elementCollectionItemForIndex (const QModelIndex &index);
- private slots:
+ public slots:
void reload();
private:
Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp 2017-05-01 15:47:28 UTC (rev 4954)
+++ trunk/sources/qetdiagrameditor.cpp 2017-05-01 16:22:34 UTC (rev 4955)
@@ -671,20 +671,30 @@
}
/**
- Gere les evenements du l'editeur de schema
- Reimplemente ici pour :
- * eviter un conflit sur le raccourci clavier "Ctrl+W" (QKeySequence::Close)
- @param e Evenement
-*/
-bool QETDiagramEditor::event(QEvent *e) {
- if (e -> type() == QEvent::ShortcutOverride) {
+ * @brief QETDiagramEditor::event
+ * Reimplemented to :
+ * -avoid conflic with shortcut "Ctrl+W" (QKeySequence::Close)
+ * -Load elements collection when WindowActivate.
+ * @param e
+ * @return
+ */
+bool QETDiagramEditor::event(QEvent *e)
+{
+ if (e -> type() == QEvent::ShortcutOverride)
+ {
QKeyEvent *shortcut_event = static_cast<QKeyEvent *>(e);
- if (shortcut_event && shortcut_event -> matches(QKeySequence::Close)) {
+ if (shortcut_event && shortcut_event -> matches(QKeySequence::Close))
+ {
close_file -> trigger();
e -> accept();
return(true);
}
}
+ if (m_first_show && e->type() == QEvent::WindowActivate)
+ {
+ m_first_show = false;
+ QTimer::singleShot(250, m_element_collection_widget, SLOT(reload()));
+ }
return(QETMainWindow::event(e));
}
Modified: trunk/sources/qetdiagrameditor.h
===================================================================
--- trunk/sources/qetdiagrameditor.h 2017-05-01 15:47:28 UTC (rev 4954)
+++ trunk/sources/qetdiagrameditor.h 2017-05-01 16:22:34 UTC (rev 4955)
@@ -72,7 +72,7 @@
bool drawGrid() const;
protected:
- virtual bool event(QEvent *);
+ virtual bool event(QEvent *);
private:
bool addProject(QETProject *, bool = true);
@@ -239,5 +239,6 @@
// AutoNumbering Selection Dock
AutoNumberingDockWidget *m_autonumbering_dock;
int activeSubWindowIndex;
+ bool m_first_show = true;
};
#endif