Changeset 9cdab3
- Timestamp:
- Aug 11, 2025, 5:45:54 PM (2 months ago)
- Branches:
- Candidate_v1.7.0, stable
- Children:
- 5718cc
- Parents:
- ae9ad6
- git-author:
- Frederik Heber <frederik.heber@…> (07/20/25 20:19:22)
- git-committer:
- Frederik Heber <frederik.heber@…> (08/11/25 17:45:54)
- Location:
- src/UIElements
- Files:
-
- 7 edited
-
Menu/Menu.cpp (modified) (1 diff)
-
Menu/Menu.hpp (modified) (1 diff)
-
Menu/Qt4/QtMenu.hpp (modified) (5 diffs)
-
Qt4/QtMainWindow.cpp (modified) (2 diffs)
-
Qt4/QtMainWindow.hpp (modified) (1 diff)
-
Views/Qt4/Qt3D/GLWorldView.cpp (modified) (1 diff)
-
Views/Qt4/Qt3D/GLWorldView.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Menu/Menu.cpp
rae9ad6 r9cdab3 87 87 iter != MenuDescription::getInstance().getEndIter(); 88 88 ++iter) { 89 const std::string &MenuName = iter->first; 89 90 // skip when already present 90 if (!isPresent( iter->first)) {91 if (!isPresent(MenuName)) { 91 92 // have some short refs to infos 92 const std::string &MenuName = iter->first;93 93 const std::string &TopName = iter->second.first; 94 94 const int &MenuPosition = iter->second.second; -
src/UIElements/Menu/Menu.hpp
rae9ad6 r9cdab3 60 60 void init(); 61 61 62 //!> Getter for the menu's name. 63 const std::string getName() const { 64 return name; 65 } 66 62 67 protected: 63 68 //!> Unique name of the menu for identification. -
src/UIElements/Menu/Qt4/QtMenu.hpp
rae9ad6 r9cdab3 10 10 11 11 // include config.h 12 #include <cstddef> 12 13 #ifdef HAVE_CONFIG_H 13 14 #include <config.h> … … 16 17 17 18 #include <Qt/qaction.h> 19 #include <Qt/qpoint.h> 18 20 19 21 #include "Menu/Qt4/QMenu_tooltip.hpp" … … 52 54 virtual ~QtMenu() 53 55 { 56 // delete all plumbed actions 54 57 for(std::list<QtMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++) 55 58 delete (*it); 56 59 60 // delete all submenus 61 for(SubMenus_t::iterator iter = submenus.begin(); iter != submenus.end(); ++iter) 62 delete(*iter); 63 64 // delete the wrapped instance if we took over ownership 57 65 if (deleteMenu) 58 66 delete MenuInstance; … … 103 111 MenuShortcutMap ShortcutMap; 104 112 113 typedef std::list< QtMenu<QMenu_tooltip>* > SubMenus_t; 114 SubMenus_t submenus; 115 105 116 virtual void addActionItem(const std::string &token, const std::string &description) 106 117 { … … 123 134 MenuInstance->addMenu(Menu); 124 135 QtMenu<QMenu_tooltip> *NewMenu = new QtMenu<QMenu_tooltip>(Menu, token); 136 submenus.push_back(NewMenu); 125 137 NewMenu->init(); 126 138 } 127 139 140 public: 141 QtMenu<QMenu_tooltip>* findSubmenu(const std::string &token) { 142 for (SubMenus_t::iterator iter = submenus.begin(); iter != submenus.end(); ++iter) { 143 QtMenu<QMenu_tooltip>* submenu = *(iter); 144 if (submenu->getName() == token) 145 return submenu; 146 else { 147 QtMenu<QMenu_tooltip>* found_submenu = submenu->findSubmenu(token); 148 if (found_submenu != NULL) 149 return found_submenu; 150 } 151 } 152 return NULL; 153 } 154 155 void popup(const QPoint &pos) { 156 MenuInstance->popup(pos); 157 } 128 158 }; 129 159 -
src/UIElements/Qt4/QtMainWindow.cpp
rae9ad6 r9cdab3 134 134 toolbar->addFavoriteActionItems(20); 135 135 addToolBar(toolbar); 136 137 // add context menu on right click 138 glWorldView->setContextMenuPolicy(Qt::CustomContextMenu); 139 connect(glWorldView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotContextMenuRequested(const QPoint&))); 136 140 137 141 setCentralWidget(splitter1); … … 193 197 } 194 198 199 void QtMainWindow::slotContextMenuRequested(const QPoint &pos) 200 { 201 // pick the atoms menu 202 QtMenu<QMenu_tooltip> * atoms_submenu = MainMenu->findSubmenu("atom"); 203 // and show it 204 if (atoms_submenu != NULL) { 205 atoms_submenu->popup(glWorldView->mapToGlobal(pos)); 206 } else { 207 ELOG(1, "Could not find atom submenu."); 208 } 209 } 195 210 QtMainWindow::~QtMainWindow() 196 211 { -
src/UIElements/Qt4/QtMainWindow.hpp
rae9ad6 r9cdab3 57 57 virtual void closeEvent(QCloseEvent *event); 58 58 59 public slots: 60 void slotContextMenuRequested(const QPoint &pos); 59 61 60 62 private: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
rae9ad6 r9cdab3 609 609 QGLView::mousePressEvent(event); 610 610 611 // check for right mouse button 612 if (event->button() == Qt::RightButton) { 613 emit customContextMenuRequested(event->pos()); 614 } 615 611 616 // Reset the saved mouse position. 612 617 lastMousePos = event->posF(); -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
rae9ad6 r9cdab3 73 73 void ShapeRemoved(const std::string &); 74 74 void moleculesVisibilityChanged(ObservedValue_Index_t,bool); 75 void customContextMenuRequested(const QPoint&); 75 76 76 77 protected:
Note:
See TracChangeset
for help on using the changeset viewer.
