modify mouse right menu
This commit is contained in:
parent
a3fc986d4e
commit
286a48a658
@ -636,57 +636,57 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>ModelTreeWidget</name>
|
<name>ModelTreeWidget</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="97"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="252"/>
|
||||||
<source>Release Track</source>
|
<source>Release Track</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="113"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="107"/>
|
||||||
<source>Add boke Entity</source>
|
<source>Add boke Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="120"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="114"/>
|
||||||
<source>Add lsjhqt Entity</source>
|
<source>Add lsjhqt Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="127"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="121"/>
|
||||||
<source>Add nimizi Entity</source>
|
<source>Add nimizi Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="134"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="128"/>
|
||||||
<source>Add tkdlj Entity</source>
|
<source>Add tkdlj Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="141"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="135"/>
|
||||||
<source>Add jiaofan Entity</source>
|
<source>Add jiaofan Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="148"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="142"/>
|
||||||
<source>Add satellite Entity</source>
|
<source>Add satellite Entity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="250"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="260"/>
|
||||||
<source>Track</source>
|
<source>Track</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="257"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="268"/>
|
||||||
<source>Add Mesh Component</source>
|
<source>Add Mesh Component</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="260"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="271"/>
|
||||||
<source>Add Path Component</source>
|
<source>Add Path Component</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="267"/>
|
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="278"/>
|
||||||
<source>Delete</source>
|
<source>Delete</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -694,12 +694,12 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>OsgWidget</name>
|
<name>OsgWidget</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../viewer/OsgWidget.cpp" line="81"/>
|
<location filename="../viewer/OsgWidget.cpp" line="86"/>
|
||||||
<source>warning</source>
|
<source>warning</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../viewer/OsgWidget.cpp" line="82"/>
|
<location filename="../viewer/OsgWidget.cpp" line="87"/>
|
||||||
<source>open dyt file failed</source>
|
<source>open dyt file failed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -93,18 +93,12 @@ void ModelTreeWidget::OnEntityRemoved(Entity* entity) {
|
|||||||
void ModelTreeWidget::contextMenuEvent(QContextMenuEvent* event) {
|
void ModelTreeWidget::contextMenuEvent(QContextMenuEvent* event) {
|
||||||
QTreeWidgetItem* item = itemAt(event->pos());
|
QTreeWidgetItem* item = itemAt(event->pos());
|
||||||
if (nullptr != item) {
|
if (nullptr != item) {
|
||||||
QMenu menu(this);
|
QVariant value = item->data(0, E_Entity);
|
||||||
QAction* addEntiy = new QAction(tr("Release Track"), this);
|
if (!value.isValid()) {
|
||||||
connect(addEntiy, &QAction::triggered, [this]() {
|
LOG_WARN("unknown data E_Entity");
|
||||||
OnTrackEntity(nullptr);
|
return;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
menu.addAction(addEntiy);
|
|
||||||
menu.exec(event->globalPos());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QVariant value = item->data(0, E_Entity);
|
|
||||||
if (nullptr != item && value.isValid()) {
|
|
||||||
Entity* entity = value.value<Entity*>();
|
Entity* entity = value.value<Entity*>();
|
||||||
PopupEntityMenu(event, entity);
|
PopupEntityMenu(event, entity);
|
||||||
} else {
|
} else {
|
||||||
@ -247,14 +241,31 @@ void ModelTreeWidget::OnDeleteEntity(Entity* entity) {
|
|||||||
void ModelTreeWidget::PopupEntityMenu(QContextMenuEvent* event, Entity* entity) {
|
void ModelTreeWidget::PopupEntityMenu(QContextMenuEvent* event, Entity* entity) {
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
|
|
||||||
QAction* addEntiy = new QAction(tr("Track"), this);
|
if (nullptr != entity) {
|
||||||
menu.addAction(addEntiy);
|
auto workspace = entity->GetWorkspace();
|
||||||
connect(addEntiy, &QAction::triggered, [this, entity]() {
|
if (nullptr == workspace) {
|
||||||
OnTrackEntity(entity);
|
LOG_WARN("workspace is nullptr");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
if (workspace->GetTrackEntity() == entity) {
|
||||||
|
QAction* releaseTrack = new QAction(tr("Release Track"), this);
|
||||||
|
connect(releaseTrack, &QAction::triggered, [this]() {
|
||||||
|
OnTrackEntity(nullptr);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
menu.addAction(releaseTrack);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QAction* addEntiy = new QAction(tr("Track"), this);
|
||||||
|
menu.addAction(addEntiy);
|
||||||
|
connect(addEntiy, &QAction::triggered, [this, entity]() {
|
||||||
|
OnTrackEntity(entity);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
addEntiy = new QAction(tr("Add Mesh Component"), this);
|
QAction* addEntiy = new QAction(tr("Add Mesh Component"), this);
|
||||||
menu.addAction(addEntiy);
|
menu.addAction(addEntiy);
|
||||||
|
|
||||||
addEntiy = new QAction(tr("Add Path Component"), this);
|
addEntiy = new QAction(tr("Add Path Component"), this);
|
||||||
@ -328,11 +339,12 @@ void ModelTreeWidget::OnTrackEntity(Entity* entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr == entity) {
|
if (nullptr == entity) {
|
||||||
LOG_WARN("entity is nullptr, clear camera manipulator");
|
LOG_INFO("clear track entity");
|
||||||
|
workspace->UntrackEntity();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LOG_INFO("track entity: {}", entity->GetName().toStdString());
|
||||||
workspace->TrackEntity(entity);
|
workspace->TrackEntity(entity);
|
||||||
//scene->Track
|
//scene->Track
|
||||||
//MainWindow::
|
//MainWindow::
|
||||||
|
@ -45,6 +45,11 @@ OsgWidget::OsgWidget(QWidget* parent, Qt::WindowFlags f)
|
|||||||
|
|
||||||
connect( &timer_, SIGNAL(timeout()), this, SLOT(update()) );
|
connect( &timer_, SIGNAL(timeout()), this, SLOT(update()) );
|
||||||
timer_.start( 10 );
|
timer_.start( 10 );
|
||||||
|
LOG_INFO("OsgWidget::OsgWidget");
|
||||||
|
}
|
||||||
|
|
||||||
|
OsgWidget::~OsgWidget() {
|
||||||
|
LOG_INFO("OsgWidget::~OsgWidget");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OsgWidget::Initialize() {
|
void OsgWidget::Initialize() {
|
||||||
|
@ -10,6 +10,7 @@ class OsgWidget : public QWidget, public osgViewer::CompositeViewer {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
OsgWidget(QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
|
OsgWidget(QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||||
|
~OsgWidget() override;
|
||||||
|
|
||||||
void Initialize(void);
|
void Initialize(void);
|
||||||
void LoadDefaultScene(void);
|
void LoadDefaultScene(void);
|
||||||
|
@ -118,6 +118,9 @@ public:
|
|||||||
void RemoveEntity(class Entity* entity);
|
void RemoveEntity(class Entity* entity);
|
||||||
bool TrackEntity(class Entity* entity);
|
bool TrackEntity(class Entity* entity);
|
||||||
void UntrackEntity();
|
void UntrackEntity();
|
||||||
|
class Entity* GetTrackEntity() const {
|
||||||
|
return trackedEntity_;
|
||||||
|
}
|
||||||
|
|
||||||
bool Save(const QString& path);
|
bool Save(const QString& path);
|
||||||
bool Save();
|
bool Save();
|
||||||
|
Loading…
Reference in New Issue
Block a user