コード例 #1
0
RatingComboBox::RatingComboBox(QWidget* const parent)
    : ModelIndexBasedComboBox(parent)
{
    m_syncing = false;

    // create a custom model that contains the rating values
    m_model   = new RatingComboBoxModel(this);
    setModel(m_model);

    // set a custom delegate which draws rating stars
    RatingComboBoxDelegate* delegate = new RatingComboBoxDelegate(this);
    view()->setItemDelegate(delegate);

    // set a line edit that carries a RatingWidget
    ProxyLineEdit* lineEdit = new ProxyLineEdit;
    m_ratingWidget          = new RatingComboBoxWidget;
    lineEdit->setWidget(m_ratingWidget);
    setLineEdit(lineEdit);

    connect(view()->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(currentValueChanged(QModelIndex,QModelIndex)));

    connect(m_ratingWidget, SIGNAL(ratingValueChanged(int)),
            this, SLOT(ratingWidgetChanged(int)));
}
コード例 #2
0
void MgGaugeController::setCurrentValue(float arg)
{
    if (m_currentValue != arg) {
        m_currentValue = arg;
        Q_EMIT currentValueChanged(arg);             
        calculateProjectedAngle();
    }
}
コード例 #3
0
ファイル: mycounter.cpp プロジェクト: pmpuro/qt-samples
void MyCounter::increase()
{
    ++counter;

    emit currentValueChanged();

    if(0 == counter%10){
        emit reached10(value());
    }
}