class KoSliderComboContainer : public QMenu
{
public:
- KoSliderComboContainer(KoSliderCombo *parent) : QMenu(parent ), m_parent(parent) {}
+ KoSliderComboContainer(KoSliderCombo *parent) : QMenu(parent), m_parent(parent) {}
protected:
virtual void mousePressEvent(QMouseEvent *e);
opt.subControls = QStyle::SC_All;
opt.activeSubControls = QStyle::SC_ComboBoxArrow;
QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt,
- m_parent->mapFromGlobal(e->globalPos()),
- m_parent);
+ m_parent->mapFromGlobal(e->globalPos()),
+ m_parent);
if (sc == QStyle::SC_ComboBoxArrow)
setAttribute(Qt::WA_NoMouseReplay);
QMenu::mousePressEvent(e);
}
-class KoSliderCombo::KoSliderComboPrivate {
+class KoSliderCombo::KoSliderComboPrivate
+{
public:
KoSliderCombo *thePublic;
QValidator *m_validator;
};
KoSliderCombo::KoSliderCombo(QWidget *parent)
- : QComboBox(parent)
- ,d(new KoSliderComboPrivate())
+ : QComboBox(parent)
+ , d(new KoSliderComboPrivate())
{
d->thePublic = this;
d->minimum = 0.0;
void KoSliderCombo::KoSliderComboPrivate::showPopup()
{
- if(firstShowOfSlider) {
+ if (firstShowOfSlider) {
container->show(); //show container a bit early so the slider can be layout'ed
firstShowOfSlider = false;
}
QStyleOptionSlider opt;
opt.init(slider);
- opt.maximum=256;
+ opt.maximum = 256;
opt.sliderPosition = opt.sliderValue = slider->value();
int hdlPos = thePublic->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle).center().x();
void KoSliderCombo::changeEvent(QEvent *e)
{
- switch (e->type())
- {
- case QEvent::EnabledChange:
- if (!isEnabled())
- d->hidePopup();
- break;
- case QEvent::PaletteChange:
- d->container->setPalette(palette());
- break;
- default:
- break;
+ switch (e->type()) {
+ case QEvent::EnabledChange:
+ if (!isEnabled())
+ d->hidePopup();
+ break;
+ case QEvent::PaletteChange:
+ d->container->setPalette(palette());
+ break;
+ default:
+ break;
}
QComboBox::changeEvent(e);
}
opt.subControls = QStyle::SC_All;
opt.editable = true;
QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->pos(),
- this);
- if (sc == QStyle::SC_ComboBoxArrow && !d->container->isVisible())
- {
+ this);
+ if (sc == QStyle::SC_ComboBoxArrow && !d->container->isVisible()) {
d->showPopup();
- }
- else
+ } else
QComboBox::mousePressEvent(e);
}
void KoSliderCombo::keyPressEvent(QKeyEvent *e)
{
- if (e->key() == Qt::Key_Up) setValue(value() + d->slider->singleStep() * (maximum() - minimum()) / 256 + 0.5);
- else if (e->key() == Qt::Key_Down) setValue(value() - d->slider->singleStep() * (maximum() - minimum()) / 256 - 0.5);
+ if (e->key() == Qt::Key_Up) setValue(value() + d->slider->singleStep() *(maximum() - minimum()) / 256 + 0.5);
+ else if (e->key() == Qt::Key_Down) setValue(value() - d->slider->singleStep() *(maximum() - minimum()) / 256 - 0.5);
else QComboBox::keyPressEvent(e);
}
void KoSliderCombo::wheelEvent(QWheelEvent *e)
{
- if (e->delta() > 0) setValue(value() + d->slider->singleStep() * (maximum() - minimum()) / 256 + 0.5);
- else setValue(value() - d->slider->singleStep() * (maximum() - minimum()) / 256 - 0.5);
+ if (e->delta() > 0) setValue(value() + d->slider->singleStep() *(maximum() - minimum()) / 256 + 0.5);
+ else setValue(value() - d->slider->singleStep() *(maximum() - minimum()) / 256 - 0.5);
}
void KoSliderCombo::KoSliderComboPrivate::lineEditFinished()
void KoSliderCombo::KoSliderComboPrivate::sliderValueChanged(int slidervalue)
{
- thePublic->setEditText(KGlobal::locale()->formatNumber(minimum + (maximum - minimum)*slidervalue/256, decimals));
+ thePublic->setEditText(KGlobal::locale()->formatNumber(minimum + (maximum - minimum)*slidervalue / 256, decimals));
qreal value = thePublic->currentText().toDouble();
emit thePublic->valueChanged(value, false);
void KoSliderCombo::setValue(qreal value)
{
- if(value < d->minimum)
+ if (value < d->minimum)
value = d->minimum;
- if(value > d->maximum)
+ if (value > d->maximum)
value = d->maximum;
setEditText(KGlobal::locale()->formatNumber(value, d->decimals));
d->slider->blockSignals(true);
*
* KoSliderCombo combines a numerical input and a dropdown slider in a way that takes up as
* little screen space as possible.
- *
+ *
* It allows the user to either enter a floating point value or quickly set the value using a slider
- *
+ *
* One signal is emitted when the value changes. The signal is even emitted when the slider
* is moving. The second argument of the signal however tells you if the value is final or not. A
* final value is produced by entering a value numerically or by releasing the slider.
- *
+ *
* The input of the numerical line edit is constrained to numbers and decimal signs.
*/
class KoSliderCombo : public QComboBox
*
* @param parent parent QWidget
*/
- KoSliderCombo(QWidget *parent=0);
+ KoSliderCombo(QWidget *parent = 0);
/**
* Destructor
*/
void setMaximum(qreal max);
- /**
- * The value shown.
- */
+ /**
+ * The value shown.
+ */
qreal value() const;
virtual QSize minimumSizeHint() const; ///< reimplemented from QComboBox
public slots:
- /**
- * Sets the value.
- * The value actually set is forced to be within the legal range: minimum <= value <= maximum
- * @param value the new value
- */
+ /**
+ * Sets the value.
+ * The value actually set is forced to be within the legal range: minimum <= value <= maximum
+ * @param value the new value
+ */
void setValue(qreal value);
signals:
zDown->setDefaultAction(m_zDown);
m_zTop = new QAction(KIcon("kdenlive-zindex-top"), QString(), this);
- // TODO mbt 1414: Shortcut should change z index only if
+ // TODO mbt 1414: Shortcut should change z index only if
// cursor is NOT in a text field ...
//m_zTop->setShortcut(Qt::Key_Home);
m_zTop->setToolTip(i18n("Raise object to top"));
x.rotatez = rotlist[2].toDouble();
// Try to adjust zoom
- t.rotate(x.rotatex * (-1), Qt::XAxis);
- t.rotate(x.rotatey * (-1), Qt::YAxis);
- t.rotate(x.rotatez * (-1), Qt::ZAxis);
+ t.rotate(x.rotatex *(-1), Qt::XAxis);
+ t.rotate(x.rotatey *(-1), Qt::YAxis);
+ t.rotate(x.rotatez *(-1), Qt::ZAxis);
x.scalex = t.m11();
x.scaley = t.m22();
} else {