mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Display the name of the current hovered element of the element collection tree, in the status bar.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4773 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
bb2fff7e5f
commit
ce638c770d
@ -29,6 +29,7 @@
|
|||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "qetelementeditor.h"
|
#include "qetelementeditor.h"
|
||||||
#include "elementstreeview.h"
|
#include "elementstreeview.h"
|
||||||
|
#include "qetdiagrameditor.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@ -115,6 +116,14 @@ bool ElementsCollectionWidget::event(QEvent *event)
|
|||||||
return QWidget::event(event);
|
return QWidget::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElementsCollectionWidget::leaveEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (QETDiagramEditor *qde = QETApp::diagramEditorAncestorOf(this))
|
||||||
|
qde->statusBar()->clearMessage();
|
||||||
|
|
||||||
|
QWidget::leaveEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void ElementsCollectionWidget::setUpAction()
|
void ElementsCollectionWidget::setUpAction()
|
||||||
{
|
{
|
||||||
m_open_dir = new QAction(QET::Icons::DocumentOpen, tr("Ouvrir le dossier correspondant"), this);
|
m_open_dir = new QAction(QET::Icons::DocumentOpen, tr("Ouvrir le dossier correspondant"), this);
|
||||||
@ -190,6 +199,13 @@ void ElementsCollectionWidget::setUpConnection()
|
|||||||
connect(m_tree_view, &QTreeView::doubleClicked, [this](const QModelIndex &index) {
|
connect(m_tree_view, &QTreeView::doubleClicked, [this](const QModelIndex &index) {
|
||||||
this->m_index_at_context_menu = index ;
|
this->m_index_at_context_menu = index ;
|
||||||
this->editElement();});
|
this->editElement();});
|
||||||
|
|
||||||
|
connect(m_tree_view, &QTreeView::entered, [this] (const QModelIndex &index) {
|
||||||
|
QETDiagramEditor *qde = QETApp::diagramEditorAncestorOf(this);
|
||||||
|
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||||
|
if (qde && eci)
|
||||||
|
qde->statusBar()->showMessage(eci->localName());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +54,7 @@ class ElementsCollectionWidget : public QWidget
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool event(QEvent *event);
|
virtual bool event(QEvent *event);
|
||||||
|
virtual void leaveEvent(QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setUpAction();
|
void setUpAction();
|
||||||
|
@ -609,6 +609,23 @@ QETDiagramEditor *QETApp::diagramEditorForFile(const QString &filepath) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETApp::diagramEditorAncestorOf
|
||||||
|
* @param child
|
||||||
|
* @return the parent QETDiagramEditor (or grandparent and so on to any level) of the given child.
|
||||||
|
* If not return nullptr;
|
||||||
|
*/
|
||||||
|
QETDiagramEditor *QETApp::diagramEditorAncestorOf (const QWidget *child)
|
||||||
|
{
|
||||||
|
foreach (QETDiagramEditor *qde, QETApp::diagramEditors()) {
|
||||||
|
if (qde->isAncestorOf(child)) {
|
||||||
|
return qde;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
/**
|
/**
|
||||||
Redefinit le chemin du dossier des elements communs
|
Redefinit le chemin du dossier des elements communs
|
||||||
|
@ -122,6 +122,7 @@ class QETApp : public QETSingleApplication {
|
|||||||
static QString lang_dir; ///< Directory containing localization files.
|
static QString lang_dir; ///< Directory containing localization files.
|
||||||
static QFont diagramTextsFont(qreal = -1.0);
|
static QFont diagramTextsFont(qreal = -1.0);
|
||||||
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
||||||
|
static QETDiagramEditor *diagramEditorAncestorOf (const QWidget *child);
|
||||||
static QList<QETDiagramEditor *> diagramEditors();
|
static QList<QETDiagramEditor *> diagramEditors();
|
||||||
static QList<QETElementEditor *> elementEditors();
|
static QList<QETElementEditor *> elementEditors();
|
||||||
static QList<QETElementEditor *> elementEditors(QETProject *);
|
static QList<QETElementEditor *> elementEditors(QETProject *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user