Esempio n. 1
0
void LightPathsWidget::keyPressEvent(QKeyEvent* event)
{
    switch (event->key())
    {
      // Home key: display all paths.
      case Qt::Key_Home:
        slot_display_all_light_paths();
        break;

      // Left key: display previous path.
      case Qt::Key_Left:
        slot_display_previous_light_path();
        break;

      // Right key: display next path.
      case Qt::Key_Right:
        slot_display_next_light_path();
        break;

      default:
        QGLWidget::keyPressEvent(event);
        break;
    }
}
Esempio n. 2
0
void LightPathsTab::create_toolbar()
{
    // Create the render toolbar.
    m_toolbar = new QToolBar();
    m_toolbar->setObjectName("render_toolbar");
    m_toolbar->setIconSize(QSize(18, 18));

    // Save Light Paths button.
    QToolButton* save_light_paths_button = new QToolButton();
    save_light_paths_button->setIcon(load_icons("lightpathstab_save_light_paths"));
    const auto light_path_count = m_project.get_light_path_recorder().get_light_path_count();
    save_light_paths_button->setToolTip(
        QString("Save %1 Light Path%2...")
            .arg(QString::fromStdString(pretty_uint(light_path_count)))
            .arg(light_path_count > 1 ? "s" : ""));
    connect(
        save_light_paths_button , SIGNAL(clicked()),
        SLOT(slot_save_light_paths()));
    m_toolbar->addWidget(save_light_paths_button);

    m_toolbar->addSeparator();

    // Previous Light Path button.
    m_prev_path_button = new QToolButton();
    m_prev_path_button->setIcon(load_icons("lightpathstab_prev_light_path"));
    m_prev_path_button->setToolTip("Display previous light path");
    m_prev_path_button->setEnabled(false);
    connect(
        m_prev_path_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_display_previous_light_path()));
    m_toolbar->addWidget(m_prev_path_button);

    // Next Light Path button.
    m_next_path_button = new QToolButton();
    m_next_path_button->setIcon(load_icons("lightpathstab_next_light_path"));
    m_next_path_button->setToolTip("Display next light path");
    m_next_path_button->setEnabled(false);
    connect(
        m_next_path_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_display_next_light_path()));
    m_toolbar->addWidget(m_next_path_button);

    m_toolbar->addSeparator();

    // Toggle Backface Culling button.
    QToolButton* backface_culling_button = new QToolButton();
    backface_culling_button->setIcon(load_icons("lightpathstab_toggle_backface_culling"));
    backface_culling_button->setToolTip("Show/hide backfacing surfaces");
    backface_culling_button->setCheckable(true);
    backface_culling_button->setChecked(false);
    connect(
        backface_culling_button, SIGNAL(toggled(bool)),
        m_light_paths_widget, SLOT(slot_toggle_backface_culling(const bool)));
    m_toolbar->addWidget(backface_culling_button);

    // Synchronize Camera button.
    QToolButton* sync_camera_button = new QToolButton();
    sync_camera_button->setIcon(load_icons("lightpathstab_synchronize_camera"));
    sync_camera_button->setToolTip("Synchronize the rendering camera with this camera");
    connect(
        sync_camera_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_synchronize_camera()));
    m_toolbar->addWidget(sync_camera_button);

    // Add stretchy spacer.
    // This places interactive widgets on the left and info on the right.
    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_toolbar->addWidget(spacer);

    // Create a label to display various information such as mouse coordinates, etc.
    m_info_label = new QLabel();
    m_info_label->setObjectName("info_label");
    m_toolbar->addWidget(m_info_label);
}