Add size change option to icon button settings editor
This commit is contained in:
parent
98c2b95a82
commit
f4905e7a77
|
@ -31,8 +31,6 @@ void QtMaterialIconButtonPrivate::init()
|
|||
QSizePolicy policy;
|
||||
policy.setWidthForHeight(true);
|
||||
q->setSizePolicy(policy);
|
||||
|
||||
rippleOverlay->installEventFilter(q);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -144,21 +142,6 @@ bool QtMaterialIconButton::event(QEvent *event)
|
|||
return QAbstractButton::event(event);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \reimp
|
||||
*/
|
||||
bool QtMaterialIconButton::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (QEvent::Resize == event->type())
|
||||
{
|
||||
Q_D(QtMaterialIconButton);
|
||||
|
||||
const int s = iconSize().width()/2;
|
||||
d->rippleOverlay->setGeometry(geometry().adjusted(-s, -s, s, s));
|
||||
}
|
||||
return QAbstractButton::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \reimp
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,6 @@ protected:
|
|||
QtMaterialIconButton(QtMaterialIconButtonPrivate &d, QWidget *parent = 0);
|
||||
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
|
|
|
@ -28,12 +28,14 @@ void IconButtonSettingsEditor::setupForm()
|
|||
{
|
||||
ui->disabledCheckBox->setChecked(!m_button->isEnabled());
|
||||
ui->useThemeColorsCheckBox->setChecked(m_button->useThemeColors());
|
||||
ui->sizeSpinBox->setValue(m_button->iconSize().width());
|
||||
}
|
||||
|
||||
void IconButtonSettingsEditor::updateWidget()
|
||||
{
|
||||
m_button->setDisabled(ui->disabledCheckBox->isChecked());
|
||||
m_button->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked());
|
||||
m_button->setIconSize(QSize(ui->sizeSpinBox->value(), ui->sizeSpinBox->value()));
|
||||
}
|
||||
|
||||
void IconButtonSettingsEditor::selectColor()
|
||||
|
@ -79,4 +81,5 @@ void IconButtonSettingsEditor::init()
|
|||
connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget()));
|
||||
connect(ui->colorToolButton, SIGNAL(clicked(bool)), this, SLOT(selectColor()));
|
||||
connect(ui->disabledColorToolButton, SIGNAL(clicked(bool)), this, SLOT(selectColor()));
|
||||
connect(ui->sizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateWidget()));
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>234</width>
|
||||
<height>391</height>
|
||||
<width>274</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
|
@ -37,23 +37,33 @@
|
|||
<widget class="QCheckBox" name="disabledCheckBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="sizeLabel">
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="sizeSpinBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="useThemeColorsLabel">
|
||||
<property name="text">
|
||||
<string>Use theme colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="useThemeColorsCheckBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="colorLabel">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="colorLineEdit">
|
||||
|
@ -71,14 +81,14 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="disabledColorLabel">
|
||||
<property name="text">
|
||||
<string>Disabled color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="disabledColorLineEdit">
|
||||
|
|
Loading…
Reference in New Issue