Beispiel #1
0
OsgForm::OsgForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::OsgForm),
    m_root(new osg::Group),
    m_loadedModel(new osg::MatrixTransform),
    m_viewToolBar(new QToolBar),
    m_viewMenuBar(new QMenuBar)
{
    ui->setupUi(this);
    setupUserInterface();
    m_root->setName("root");
    m_loadedModel->setName("loadedModel");
    m_root->addChild(m_loadedModel);


    ui->osg3dView->setScene(m_root);
    m_viewingCore = ui->osg3dView->getViewingCore();

    connect(ui->osg3dView, SIGNAL(pickObject(QVector<osg::ref_ptr<osg::Node> >)),
            this, SLOT(handlePick(QVector<osg::ref_ptr<osg::Node> >)));

    connect(ui->osg3dView, SIGNAL(mouseModeChanged(Osg3dView::MouseMode)),
            this, SLOT(announceMouseMode(Osg3dView::MouseMode)));

    connect(ui->osg3dView, SIGNAL(updated()),
            this, SLOT(updateCameraDisplay()));

    connect(ui->osg3dView, SIGNAL(toggleMenuBar()),
            this, SLOT(toggle3dMenu()));
    connect(ui->osg3dView, SIGNAL(toggleToolBar()),
            this, SLOT(toggle3dTools()));
}
Beispiel #2
0
void Osg3dView::buildPopupMenu()
{
    QAction *a;
    QMenu *sub = m_popupMenu.addMenu("MouseMode...");

    a = sub->addAction("Orbit", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_O));
    a->setData(QVariant(MM_ORBIT));
    a = sub->addAction("Pan", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_P));
    a->setData(QVariant(MM_PAN));
    a = sub->addAction("Rotate", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_R));
    a->setData(QVariant(MM_ROTATE));
    a = sub->addAction("Zoom", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_Z));
    a->setData(QVariant(MM_ZOOM));
    a = sub->addAction("Pick Center", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_C));
    a->setData(QVariant(MM_PICK_CENTER));
    a = sub->addAction("Select Object", this, SLOT(setMouseMode()), QKeySequence(Qt::Key_S));
    a->setData(QVariant(MM_SELECT));

    sub = m_popupMenu.addMenu("Std View...");
    a = sub->addAction("Top", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_T));
    a->setData(V_TOP);
    a = sub->addAction("Underside", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_U));
    a->setData(V_BOTTOM);
    a = sub->addAction("Front", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_F));
    a->setData(V_FRONT);
    a = sub->addAction("Back", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_B));
    a->setData(V_BACK);
    a = sub->addAction("Right", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_R));
    a->setData(V_RIGHT);
    a = sub->addAction("Left", this, SLOT(setStandardView()), QKeySequence(Qt::SHIFT + Qt::Key_L));
    a->setData(V_LEFT);

    sub = m_popupMenu.addMenu("Projection...");
    a = sub->addAction("Orthographic", this, SLOT(setProjection()));
    a->setData(P_ORTHO);
    a = sub->addAction("Perspective", this, SLOT(setProjection()));
    a->setData(P_PERSP);

    sub = m_popupMenu.addMenu("DrawMode...");
    a = sub->addAction("Facets", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_F));
    a->setData(osg::PolygonMode::FILL);
    a = sub->addAction("Wireframe", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_W));
    a->setData(osg::PolygonMode::LINE);
    a = sub->addAction("Verticies", this, SLOT(setDrawMode()), QKeySequence(Qt::Key_V));
    a->setData(osg::PolygonMode::POINT);

    sub = m_popupMenu.addMenu("Toggle...");
    a = sub->addAction("MenuBar", this, SIGNAL(toggleMenuBar()), QKeySequence(Qt::CTRL+ Qt::Key_M));
    a = sub->addAction("ToolBar", this, SIGNAL(toggleToolBar()), QKeySequence(Qt::CTRL+ Qt::Key_T));
}
Beispiel #3
0
void KWrite::setupActions()
{
    m_closeAction = actionCollection()->addAction(KStandardAction::Close, QStringLiteral("file_close"), this, SLOT(slotFlush()));
    m_closeAction->setWhatsThis(i18n("Use this command to close the current document"));
    m_closeAction->setDisabled(true);

    // setup File menu
    actionCollection()->addAction(KStandardAction::New, QStringLiteral("file_new"), this, SLOT(slotNew()))
    ->setWhatsThis(i18n("Use this command to create a new document"));
    actionCollection()->addAction(KStandardAction::Open, QStringLiteral("file_open"), this, SLOT(slotOpen()))
    ->setWhatsThis(i18n("Use this command to open an existing document for editing"));

    m_recentFiles = KStandardAction::openRecent(this, SLOT(slotOpen(QUrl)), this);
    actionCollection()->addAction(m_recentFiles->objectName(), m_recentFiles);
    m_recentFiles->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again."));

    QAction *a = actionCollection()->addAction(QStringLiteral("view_new_view"));
    a->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
    a->setText(i18n("&New Window"));
    connect(a, SIGNAL(triggered()), this, SLOT(newView()));
    a->setWhatsThis(i18n("Create another view containing the current document"));

    actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close()))
    ->setWhatsThis(i18n("Close the current document view"));

    // setup Settings menu
    setStandardToolBarMenuEnabled(true);

    m_paShowMenuBar = KStandardAction::showMenubar(this, SLOT(toggleMenuBar()), actionCollection());

    m_paShowStatusBar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), this);
    actionCollection()->addAction(m_paShowStatusBar->objectName(), m_paShowStatusBar);
    m_paShowStatusBar->setWhatsThis(i18n("Use this command to show or hide the view's statusbar"));

    m_paShowPath = new KToggleAction(i18n("Sho&w Path in Titlebar"), this);
    actionCollection()->addAction(QStringLiteral("set_showPath"), m_paShowPath);
    connect(m_paShowPath, SIGNAL(triggered()), this, SLOT(documentNameChanged()));
    m_paShowPath->setWhatsThis(i18n("Show the complete document path in the window caption"));

    a = actionCollection()->addAction(KStandardAction::KeyBindings, this, SLOT(editKeys()));
    a->setWhatsThis(i18n("Configure the application's keyboard shortcut assignments."));

    a = actionCollection()->addAction(KStandardAction::ConfigureToolbars, QStringLiteral("options_configure_toolbars"),
                                      this, SLOT(editToolbars()));
    a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s)."));

    a = actionCollection()->addAction(QStringLiteral("help_about_editor"));
    a->setText(i18n("&About Editor Component"));
    connect(a, SIGNAL(triggered()), this, SLOT(aboutEditor()));
}
Beispiel #4
0
void Osg3dView::keyPressEvent(QKeyEvent *event)
{
    int key = event->key();

    bool isShifted = event->modifiers() & Qt::ShiftModifier;

    switch (key) {
    case Qt::Key_M:
        if (event->modifiers() & Qt::ControlModifier)
            emit toggleMenuBar();
        break;
    case Qt::Key_W: setDrawMode(osg::PolygonMode::LINE); update(); break;
    case Qt::Key_V: setDrawMode(osg::PolygonMode::POINT); update(); break;
    case Qt::Key_T:
        if (isShifted) {
            m_viewingCore->viewTop();
            update();
        } else if (event->modifiers() & Qt::ControlModifier) {
            emit toggleToolBar();
        }
            break;
    case Qt::Key_L: if (isShifted) m_viewingCore->viewLeft(); update(); break;
    case Qt::Key_B: if (isShifted) m_viewingCore->viewBack(); update(); break;
    case Qt::Key_F:
        if (isShifted) {
            m_viewingCore->viewFront();
        } else {
            setDrawMode(osg::PolygonMode::FILL);
        }
        update();
        break;
    case Qt::Key_U: if (isShifted) m_viewingCore->viewBottom(); update(); break;
    case Qt::Key_O: setMouseMode(MM_ORBIT); break;
    case Qt::Key_P: setMouseMode(MM_PAN); break;
    case Qt::Key_Z: setMouseMode(MM_ZOOM); break;
    case Qt::Key_R:
        if (isShifted) {
            m_viewingCore->viewRight();
            update();
        }else
            setMouseMode(MM_ROTATE);
        break;
    case Qt::Key_C: setMouseMode(MM_PICK_CENTER); break;
    case Qt::Key_S: setMouseMode(MM_SELECT); break;
    }
}
Beispiel #5
0
void MainWindow::setupActions() {
  KStandardAction::preferences(this, SLOT(showPreferences()),
    actionCollection());
  KStandardAction::quit(kapp, SLOT(quit()),
    actionCollection());

  auto const show_menubar =
    KStandardAction::showMenubar(this, SLOT(toggleMenuBar()),
      actionCollection());
  show_menubar->setChecked(menuBar()->isVisibleTo(this));

  show_dicts_ = new KToggleAction(i18n("Show Dictionaries"), this);
  show_dicts_->setShortcut(Qt::CTRL + Qt::Key_D);
  connect(show_dicts_, SIGNAL(toggled(bool)),
    lookup_, SLOT(showDatabaseSelector(bool)));
  actionCollection()->addAction("show_dicts", show_dicts_);

  setupGUI();
}
Beispiel #6
0
void
KMixWindow::initActions()
{
  // file menu
  KStandardAction::quit(this, SLOT(quit()), actionCollection());

  // settings menu
  _actionShowMenubar = KStandardAction::showMenubar(this, SLOT(toggleMenuBar()),
      actionCollection());
  //actionCollection()->addAction( a->objectName(), a );
  KStandardAction::preferences(this, SLOT(showSettings()), actionCollection());
  KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
      actionCollection());
  KAction* action = actionCollection()->addAction("launch_kdesoundsetup");
  action->setText(i18n("Audio Setup"));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotKdeAudioSetupExec()));

  action = actionCollection()->addAction("hwinfo");
  action->setText(i18n("Hardware &Information"));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotHWInfo()));
  action = actionCollection()->addAction("hide_kmixwindow");
  action->setText(i18n("Hide Mixer Window"));
  connect(action, SIGNAL(triggered(bool)), SLOT(hideOrClose()));
  action->setShortcut(QKeySequence(Qt::Key_Escape));
  action = actionCollection()->addAction("toggle_channels_currentview");
  action->setText(i18n("Configure &Channels..."));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotConfigureCurrentView()));
  action = actionCollection()->addAction("select_master");
  action->setText(i18n("Select Master Channel..."));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotSelectMaster()));

  action = actionCollection()->addAction("save_1");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_1));
  action->setText(i18n("Save volume profile 1"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes1()));

  action = actionCollection()->addAction("save_2");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_2));
  action->setText(i18n("Save volume profile 2"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes2()));

  action = actionCollection()->addAction("save_3");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_3));
  action->setText(i18n("Save volume profile 3"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes3()));

  action = actionCollection()->addAction("save_4");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_4));
  action->setText(i18n("Save volume profile 4"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes4()));

  action = actionCollection()->addAction("load_1");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_1));
  action->setText(i18n("Load volume profile 1"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes1()));

  action = actionCollection()->addAction("load_2");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_2));
  action->setText(i18n("Load volume profile 2"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes2()));

  action = actionCollection()->addAction("load_3");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_3));
  action->setText(i18n("Load volume profile 3"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes3()));

  action = actionCollection()->addAction("load_4");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_4));
  action->setText(i18n("Load volume profile 4"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes4()));

  osdWidget = new OSDWidget();

  createGUI(QLatin1String("kmixui.rc"));
}