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;
|
QSizePolicy policy;
|
||||||
policy.setWidthForHeight(true);
|
policy.setWidthForHeight(true);
|
||||||
q->setSizePolicy(policy);
|
q->setSizePolicy(policy);
|
||||||
|
|
||||||
rippleOverlay->installEventFilter(q);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -144,21 +142,6 @@ bool QtMaterialIconButton::event(QEvent *event)
|
||||||
return QAbstractButton::event(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
|
* \reimp
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,6 @@ protected:
|
||||||
QtMaterialIconButton(QtMaterialIconButtonPrivate &d, QWidget *parent = 0);
|
QtMaterialIconButton(QtMaterialIconButtonPrivate &d, QWidget *parent = 0);
|
||||||
|
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||||
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void paintEvent(QPaintEvent *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->disabledCheckBox->setChecked(!m_button->isEnabled());
|
||||||
ui->useThemeColorsCheckBox->setChecked(m_button->useThemeColors());
|
ui->useThemeColorsCheckBox->setChecked(m_button->useThemeColors());
|
||||||
|
ui->sizeSpinBox->setValue(m_button->iconSize().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconButtonSettingsEditor::updateWidget()
|
void IconButtonSettingsEditor::updateWidget()
|
||||||
{
|
{
|
||||||
m_button->setDisabled(ui->disabledCheckBox->isChecked());
|
m_button->setDisabled(ui->disabledCheckBox->isChecked());
|
||||||
m_button->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked());
|
m_button->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked());
|
||||||
|
m_button->setIconSize(QSize(ui->sizeSpinBox->value(), ui->sizeSpinBox->value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconButtonSettingsEditor::selectColor()
|
void IconButtonSettingsEditor::selectColor()
|
||||||
|
@ -79,4 +81,5 @@ void IconButtonSettingsEditor::init()
|
||||||
connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget()));
|
connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget()));
|
||||||
connect(ui->colorToolButton, SIGNAL(clicked(bool)), this, SLOT(selectColor()));
|
connect(ui->colorToolButton, SIGNAL(clicked(bool)), this, SLOT(selectColor()));
|
||||||
connect(ui->disabledColorToolButton, 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>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>234</width>
|
<width>274</width>
|
||||||
<height>391</height>
|
<height>371</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
@ -37,23 +37,33 @@
|
||||||
<widget class="QCheckBox" name="disabledCheckBox"/>
|
<widget class="QCheckBox" name="disabledCheckBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<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">
|
<widget class="QLabel" name="useThemeColorsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use theme colors</string>
|
<string>Use theme colors</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QCheckBox" name="useThemeColorsCheckBox"/>
|
<widget class="QCheckBox" name="useThemeColorsCheckBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="colorLabel">
|
<widget class="QLabel" name="colorLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Color</string>
|
<string>Color</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="colorLineEdit">
|
<widget class="QLineEdit" name="colorLineEdit">
|
||||||
|
@ -71,14 +81,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="disabledColorLabel">
|
<widget class="QLabel" name="disabledColorLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disabled color</string>
|
<string>Disabled color</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="disabledColorLineEdit">
|
<widget class="QLineEdit" name="disabledColorLineEdit">
|
||||||
|
|
Loading…
Reference in New Issue