void TransFuncEditorIntensityGradient::updateFromProperty() {
    if (!supported_)
        return;

    const VolumeHandleBase* newHandle = property_->getVolumeHandle();
    if (newHandle != volumeHandle_) {
        volumeHandle_ = newHandle;
        volumeChanged();
    }

    if (transFuncGradient_)
        transCanvas_->update();
    else
        resetEditor();
}
void TransFuncEditorIntensityPet::updateFromProperty() {
    // check whether the volume associated with the TransFuncProperty has changed
    const VolumeHandleBase* newHandle = property_->getVolumeHandle();
    if (newHandle != volumeHandle_) {
        volumeHandle_ = newHandle;
        volumeChanged();
    }

    if (transferFuncGradient_) {
        transferFuncGradient_->resize(maximumIntensity_ + 1);

        bool emitRepaint = false;
        // adjust tf when not all keys have maximum alpha
        if (!transferFunctionCorrect()) {
            LINFO("The transfer function contains keys that don't have maximum alpha. "
                   << "The alpha value of these keys is set to 255.");
            rectifyTransferFunction();

            emitRepaint = true;
        }

        // update threshold control elements when necessary
        if (transferFuncIntensity_->getThresholds() != tgt::vec2(0.f, 1.f)) {
            restoreThresholds();
            emitRepaint = true;
        }

        if (emitRepaint) {
            property_->notifyChange();
            emit transferFunctionChanged();
        }

        // repaint control elements
        repaintAll();
    }
    else
        resetEditor();
}
Пример #3
0
void ShortcutsHandler::resetEditor(const PalmIME::EditorState & state)
{
    m_enableDoubleSpacePeriod = (state.type == PalmIME::FieldType_Text) && VirtualKeyboardPreferences::instance().getSpaces2period();
    resetEditor();
}
Пример #4
0
TimeWidget::TimeWidget(JointModel *model, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TimeWidget),
    m_model(model),
    m_delegate(new JointDelegate(this)),
    m_leftProxy(new JointProxyModel(model, this)),
    m_rightProxy(new JointProxyModel(model, this))
{
    ui->setupUi(this);

    QTreeView *namesView = ui->namesView;
    QTreeView *timeLineView = ui->timeLineView;

    // Sync views
    connect(namesView->verticalScrollBar(), SIGNAL(valueChanged(int)), timeLineView->verticalScrollBar(), SLOT(setValue(int)));
    connect(timeLineView->verticalScrollBar(), SIGNAL(valueChanged(int)), namesView->verticalScrollBar(), SLOT(setValue(int)));
    connect(namesView, SIGNAL(expanded(QModelIndex)), SLOT(onExpanded(QModelIndex)));
    connect(namesView, SIGNAL(collapsed(QModelIndex)), SLOT(onCollapsed(QModelIndex)));

    // Configure names view
    m_leftProxy->showAnims(false);

    namesView->setModel(m_leftProxy);
//    namesView->setModel(model);
    namesView->setItemDelegate(m_delegate);
    namesView->setHeader(new JointHeaderView(false));
    namesView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    namesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    // Configure time line view
    JointHeaderView *header = new JointHeaderView(true);

    m_rightProxy->showVisibleColumn(false);
    m_rightProxy->showAnim(0);

    timeLineView->setModel(m_rightProxy);
    timeLineView->setItemDelegate(m_delegate);
    timeLineView->setHeader(header);
    timeLineView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    timeLineView->hideColumn(JointModel::NameColumn);
    timeLineView->setAutoScroll(false);
    timeLineView->setMouseTracking(true);
    timeLineView->setItemsExpandable(false);

    connect(timeLineView, SIGNAL(entered(QModelIndex)), SLOT(openEditor(QModelIndex)));
    connect(model->animModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(resetEditor()));
    connect(model->animModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), SLOT(resetEditor()));
    connect(model->animModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(resetEditor()));

    connect(m_delegate, SIGNAL(currentFrameChanged(int)), header, SLOT(setCurrentFrame(int)));
    connect(header, SIGNAL(currentFrameChanged(int)), m_delegate, SLOT(setCurrentFrame(int)));
    connect(header, SIGNAL(currentFrameChanged(int)), timeLineView->viewport(), SLOT(update()));
    connect(header, SIGNAL(currentFrameChanged(int)), SIGNAL(currentFrameChanged(int)));

    // Configure push buttons
    connect(ui->frameCount, SIGNAL(pressed()), SLOT(showFrameCountDialog()));
    connect(ui->fps, SIGNAL(pressed()), SLOT(showFpsDialog()));

    // Initialize
    setCurrentAnim(-1);
}