mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-03 02:30:52 +01:00
use KColorButton instead of QPushButton when needed
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5787 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -105,7 +105,7 @@ void DynamicTextFieldEditor::updateForm()
|
||||
ui->m_frame_cb->setChecked(m_text_field.data()->frame());
|
||||
ui->m_user_text_le->setText(m_text_field.data()->text());
|
||||
ui->m_size_sb->setValue(m_text_field.data()->font().pointSize());
|
||||
setColorPushButton(m_text_field.data()->color());
|
||||
ui->m_color_kpb->setColor(m_text_field.data()->color());
|
||||
ui->m_width_sb->setValue(m_text_field.data()->textWidth());
|
||||
ui->m_font_pb->setText(m_text_field->font().family());
|
||||
|
||||
@@ -128,13 +128,6 @@ void DynamicTextFieldEditor::updateForm()
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setColorPushButton(const QColor& color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_pb->setStyleSheet(QString("background-color: %1; min-height: 1.5em; border-style: outset; border-width: 2px; border-color: gray; border-radius: 4px;").arg(color.name()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DynamicTextFieldEditor::fillInfoComboBox
|
||||
* Fill the combo box "element information"
|
||||
@@ -201,19 +194,6 @@ void DynamicTextFieldEditor::on_m_size_sb_editingFinished()
|
||||
undoStack().push(undo);
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_color_pb_clicked()
|
||||
{
|
||||
QColor color = QColorDialog::getColor(m_text_field.data()->color(), this, tr("Couleur du texte"));
|
||||
|
||||
if(color.isValid() && color != m_text_field.data()->color())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_text_field, "color", m_text_field.data()->color(), color);
|
||||
undo->setText(tr("Modifier la couleur d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
setColorPushButton(m_text_field.data()->color());
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
||||
{
|
||||
bool frame = ui->m_frame_cb->isChecked();
|
||||
@@ -321,3 +301,13 @@ void DynamicTextFieldEditor::on_m_font_pb_clicked()
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_color_kpb_changed(const QColor &newColor)
|
||||
{
|
||||
if(newColor.isValid() && newColor != m_text_field.data()->color())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_text_field, "color", m_text_field.data()->color(), newColor);
|
||||
undo->setText(tr("Modifier la couleur d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,13 @@ class DynamicTextFieldEditor : public ElementItemEditor
|
||||
|
||||
public:
|
||||
explicit DynamicTextFieldEditor(QETElementEditor *editor, PartDynamicTextField *text_field = nullptr, QWidget *parent = nullptr);
|
||||
~DynamicTextFieldEditor();
|
||||
~DynamicTextFieldEditor() override;
|
||||
|
||||
bool setPart(CustomElementPart *part) override;
|
||||
CustomElementPart *currentPart() const override;
|
||||
void updateForm() override;
|
||||
|
||||
private:
|
||||
void setColorPushButton(const QColor& color);
|
||||
void fillInfoComboBox();
|
||||
|
||||
private slots:
|
||||
@@ -50,8 +49,7 @@ class DynamicTextFieldEditor : public ElementItemEditor
|
||||
void on_m_y_sb_editingFinished();
|
||||
void on_m_rotation_sb_editingFinished();
|
||||
void on_m_user_text_le_editingFinished();
|
||||
void on_m_size_sb_editingFinished();
|
||||
void on_m_color_pb_clicked();
|
||||
void on_m_size_sb_editingFinished();
|
||||
void on_m_frame_cb_clicked();
|
||||
void on_m_width_sb_editingFinished();
|
||||
void on_m_elmt_info_cb_activated(const QString &arg1);
|
||||
@@ -60,7 +58,9 @@ class DynamicTextFieldEditor : public ElementItemEditor
|
||||
void on_m_alignment_pb_clicked();
|
||||
void on_m_font_pb_clicked();
|
||||
|
||||
private:
|
||||
void on_m_color_kpb_changed(const QColor &newColor);
|
||||
|
||||
private:
|
||||
Ui::DynamicTextFieldEditor *ui;
|
||||
QPointer<PartDynamicTextField> m_text_field;
|
||||
QList<QMetaObject::Connection> m_connection_list;
|
||||
|
||||
@@ -40,13 +40,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="m_color_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -213,8 +206,18 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="KColorButton" name="m_color_kpb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kcolorbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user