Improve last comit

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4955 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-05-01 16:22:34 +00:00
parent 310ce75089
commit 1a9c27b017
4 changed files with 21 additions and 22 deletions

View File

@@ -128,17 +128,6 @@ void ElementsCollectionWidget::setCurrentLocation(const ElementsLocation &locati
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))

View File

@@ -54,7 +54,6 @@ class ElementsCollectionWidget : public QWidget
void setCurrentLocation(const ElementsLocation &location);
protected:
virtual bool event(QEvent *event);
virtual void leaveEvent(QEvent *event);
private:
@@ -78,7 +77,7 @@ class ElementsCollectionWidget : public QWidget
void showAndExpandItem (const QModelIndex &index, bool parent = true, bool child = false);
ElementCollectionItem *elementCollectionItemForIndex (const QModelIndex &index);
private slots:
public slots:
void reload();
private:

View File

@@ -671,20 +671,30 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) {
}
/**
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
* @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) {
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));
}

View File

@@ -239,5 +239,6 @@ class QETDiagramEditor : public QETMainWindow {
// AutoNumbering Selection Dock
AutoNumberingDockWidget *m_autonumbering_dock;
int activeSubWindowIndex;
bool m_first_show = true;
};
#endif