Ejemplo n.º 1
0
void TreeBrowser::update_buttons()
{
  m_actions.clear();
  m_menu_next->clear();
  m_menu_previous->clear();

  if(!m_history.isEmpty())
  {
    for(int i = 0 ; i < m_history.size() ; i++)
    {
      QPersistentModelIndex index = m_history.at(i);
      QString path = m_tree_view->path_from_index(index).path().c_str();
      QIcon icon = m_tree_view->icon_from_index(index);

      if(path.isEmpty())
      {
        path = NTree::global()->tree_root()->uri().path().c_str();
        //icon = NTree::global()->getRoot()->getIcon();
      }

      QAction * action = new QAction(icon, path, this);

      connect(action, SIGNAL(triggered()), this, SLOT(action_triggered()));
      m_actions[action] = i;

        if(i < m_current_index)
          m_menu_previous->addAction(action);
        else if(i > m_current_index)
          m_menu_next->addAction(action);
    }
  }

  m_bt_next->setEnabled(!m_menu_next->isEmpty());
  m_bt_previous->setEnabled(!m_menu_previous->isEmpty());
}
Ejemplo n.º 2
0
/*hub menu*/
void
CHubEnvironmentMenuItem::internal_action_triggered() {
  QAction* act = static_cast<QAction*>(sender());
  emit action_triggered(m_hub_environment, m_hub_container, (void*)act);
}