mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +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:
|
||||
@@ -51,7 +50,6 @@ class DynamicTextFieldEditor : public ElementItemEditor
|
||||
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_frame_cb_clicked();
|
||||
void on_m_width_sb_editingFinished();
|
||||
void on_m_elmt_info_cb_activated(const QString &arg1);
|
||||
@@ -60,6 +58,8 @@ class DynamicTextFieldEditor : public ElementItemEditor
|
||||
void on_m_alignment_pb_clicked();
|
||||
void on_m_font_pb_clicked();
|
||||
|
||||
void on_m_color_kpb_changed(const QColor &newColor);
|
||||
|
||||
private:
|
||||
Ui::DynamicTextFieldEditor *ui;
|
||||
QPointer<PartDynamicTextField> m_text_field;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -73,8 +73,6 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
|
||||
|
||||
m_properties = properties;
|
||||
|
||||
setColorButton(m_properties.color);
|
||||
setColorButton2(m_properties.m_color_2);
|
||||
int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style));
|
||||
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
|
||||
|
||||
@@ -93,6 +91,8 @@ void ConductorPropertiesWidget::setProperties(const ConductorProperties &propert
|
||||
ui->m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
|
||||
ui->m_phase_cb -> setChecked (m_properties.singleLineProperties.phasesCount());
|
||||
ui->m_phase_slider -> setValue (m_properties.singleLineProperties.phasesCount());
|
||||
ui->m_color_kpb -> setColor(m_properties.color);
|
||||
ui->m_color_2_kpb -> setColor(m_properties.m_color_2);
|
||||
|
||||
ui->m_horiz_cb->setCurrentIndex(m_properties.m_horizontal_alignment == Qt::AlignTop? 0 : 1);
|
||||
ui->m_verti_cb->setCurrentIndex(m_properties.m_vertical_alignment == Qt::AlignLeft? 0 : 1);
|
||||
@@ -113,9 +113,9 @@ ConductorProperties ConductorPropertiesWidget::properties() const
|
||||
if (ui -> m_multiwires_gb -> isChecked()) properties_.type = ConductorProperties::Multi;
|
||||
else if (ui -> m_singlewire_gb -> isChecked()) properties_.type = ConductorProperties::Single;
|
||||
|
||||
properties_.color = ui -> m_color_pb->palette().color(QPalette::Button);
|
||||
properties_.color = ui -> m_color_kpb->color();
|
||||
properties_.m_bicolor = ui->m_color_2_gb->isChecked();
|
||||
properties_.m_color_2 = ui->m_color_2_pb->palette().color(QPalette::Button);
|
||||
properties_.m_color_2 = ui->m_color_2_kpb->color();
|
||||
properties_.m_dash_size = ui->m_dash_size_sb->value();
|
||||
properties_.style = ui -> m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).value<QPen>().style();
|
||||
properties_.m_formula = ui->m_formula_le->text();
|
||||
@@ -292,39 +292,6 @@ void ConductorPropertiesWidget::on_m_neutral_cb_toggled(bool checked) {
|
||||
else ui -> m_pen_cb -> setDisabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorPropertiesWidget::on_m_color_pb_clicked
|
||||
* Open a color dialog, for choose the color of conductor
|
||||
*/
|
||||
void ConductorPropertiesWidget::on_m_color_pb_clicked() {
|
||||
QColor color = QColorDialog::getColor(m_properties.color, this);
|
||||
if (color.isValid())
|
||||
setColorButton(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorPropertiesWidget::setColorButton
|
||||
* Set m_color_pb to @color
|
||||
* @param color
|
||||
*/
|
||||
void ConductorPropertiesWidget::setColorButton(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 ConductorPropertiesWidget::setColorButton2
|
||||
* Set m_color_2_pb to @color
|
||||
* @param color
|
||||
*/
|
||||
void ConductorPropertiesWidget::setColorButton2(const QColor &color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, color);
|
||||
ui->m_color_2_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 ConductorPropertiesWidget::on_m_update_preview_pb_clicked
|
||||
* Update the preview of single line.
|
||||
@@ -335,14 +302,3 @@ void ConductorPropertiesWidget::setColorButton2(const QColor &color)
|
||||
void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() {
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorPropertiesWidget::on_m_color_2_pb_clicked
|
||||
* Open a color dialog, for choose the second color of conductor
|
||||
*/
|
||||
void ConductorPropertiesWidget::on_m_color_2_pb_clicked()
|
||||
{
|
||||
QColor color = QColorDialog::getColor(m_properties.m_color_2, this);
|
||||
if (color.isValid())
|
||||
setColorButton2(color);
|
||||
}
|
||||
|
||||
@@ -63,13 +63,8 @@ class ConductorPropertiesWidget : public QWidget
|
||||
private slots:
|
||||
void on_m_earth_cb_toggled(bool checked);
|
||||
void on_m_neutral_cb_toggled(bool checked);
|
||||
void on_m_color_pb_clicked();
|
||||
void setColorButton (const QColor &color);
|
||||
void setColorButton2 (const QColor &color);
|
||||
void on_m_update_preview_pb_clicked();
|
||||
|
||||
void on_m_color_2_pb_clicked();
|
||||
|
||||
private:
|
||||
Ui::ConductorPropertiesWidget *ui;
|
||||
ConductorProperties m_properties;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>716</width>
|
||||
<height>1073</height>
|
||||
<width>346</width>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -27,7 +27,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_multiwires_gb">
|
||||
<property name="title">
|
||||
<string>Multifilaire</string>
|
||||
<string>&Multifilaire</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -352,54 +352,18 @@
|
||||
<string>Apparence</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_color_2_gb">
|
||||
<property name="title">
|
||||
<string>Couleur secondaire :</string>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_dash_size_sb">
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_color_2_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Couleur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Taille de trait :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
@@ -411,49 +375,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_color_pb">
|
||||
<property name="toolTip">
|
||||
<string>Couleur du conducteur</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Taille :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="toolTip">
|
||||
<string>Style du conducteur</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Style :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_line_style_cb">
|
||||
<property name="toolTip">
|
||||
<string>Style du conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_cond_size_sb">
|
||||
<property name="minimum">
|
||||
@@ -470,18 +391,77 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_color_2_gb">
|
||||
<property name="title">
|
||||
<string>Couleur secondaire :</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Taille de trait :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_dash_size_sb">
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Couleur :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KColorButton" name="m_color_2_kpb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Taille :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_line_style_cb">
|
||||
<property name="toolTip">
|
||||
<string>Style du conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="toolTip">
|
||||
<string>Style du conducteur</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Style :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KColorButton" name="m_color_kpb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -489,6 +469,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kcolorbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
|
||||
@@ -184,7 +184,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
new_pen.setStyle( Qt::CustomDashLine );
|
||||
}
|
||||
//painter.setPen( new_pen );
|
||||
new_pen.setColor(ui->m_color_pb->palette().color(QPalette::Button));
|
||||
new_pen.setColor(ui->m_color_kpb->color());
|
||||
|
||||
if (new_pen != old_pen)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
QBrush old_brush = m_shape->brush();
|
||||
QBrush new_brush = old_brush;
|
||||
new_brush.setStyle(Qt::BrushStyle(ui->m_brush_style_cb->currentIndex()));
|
||||
new_brush.setColor(ui->m_brush_color_pb->palette().color(QPalette::Button));
|
||||
new_brush.setColor(ui->m_brush_color_kpb->color());
|
||||
|
||||
if (new_brush != old_brush)
|
||||
{
|
||||
@@ -257,7 +257,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
}
|
||||
}
|
||||
|
||||
QColor c =ui->m_color_pb->palette().color(QPalette::Button);
|
||||
QColor c =ui->m_color_kpb->color();
|
||||
if (c != QPalette().color(QPalette::Button) && shape_->pen().color() != c)
|
||||
{
|
||||
for (QPointer<QetShapeItem> qsi : m_shapes_list)
|
||||
@@ -289,7 +289,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
}
|
||||
}
|
||||
|
||||
c = ui->m_brush_color_pb->palette().color(QPalette::Button);
|
||||
c = ui->m_brush_color_kpb->color();
|
||||
if (c != QPalette().color(QPalette::Button) && shape_->brush().color() != c)
|
||||
{
|
||||
for (QPointer<QetShapeItem> qsi : m_shapes_list)
|
||||
@@ -327,7 +327,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
new_pen.setStyle( Qt::CustomDashLine );
|
||||
}
|
||||
//painter.setPen( new_pen );
|
||||
new_pen.setColor(ui->m_color_pb->palette().color(QPalette::Button));
|
||||
new_pen.setColor(ui->m_color_kpb->color());
|
||||
|
||||
if (new_pen != old_pen) {
|
||||
new QPropertyUndoCommand(m_shape, "pen", old_pen, new_pen, undo);
|
||||
@@ -336,7 +336,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
|
||||
QBrush old_brush = m_shape->brush();
|
||||
QBrush new_brush = old_brush;
|
||||
new_brush.setStyle(Qt::BrushStyle(ui->m_brush_style_cb->currentIndex()));
|
||||
new_brush.setColor(ui->m_brush_color_pb->palette().color(QPalette::Button));
|
||||
new_brush.setColor(ui->m_brush_color_kpb->color());
|
||||
|
||||
if (new_brush != old_brush) {
|
||||
new QPropertyUndoCommand(m_shape, "brush", old_brush, new_brush, undo);
|
||||
@@ -379,7 +379,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
|
||||
//Pen
|
||||
ui->m_style_cb->setCurrentIndex(static_cast<int>(m_shape->pen().style()) - 1);
|
||||
ui->m_size_dsb ->setValue(m_shape->pen().widthF());
|
||||
setPenColorButton(m_shape->pen().color());
|
||||
ui->m_color_kpb->setColor(m_shape->pen().color());
|
||||
ui->m_color_kpb->setColor(m_shape->pen().color());
|
||||
|
||||
//Brush
|
||||
@@ -387,7 +387,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
|
||||
ui->m_filling_gb->setVisible(m_shape->isClosed());
|
||||
|
||||
ui->m_brush_style_cb->setCurrentIndex(static_cast<int>(m_shape->brush().style()));
|
||||
setBrushColorButton(m_shape->brush().color());
|
||||
ui->m_brush_color_kpb->setColor(m_shape->brush().color());
|
||||
|
||||
ui->m_lock_pos_cb->setChecked(!m_shape->isMovable());
|
||||
ui->m_close_polygon->setChecked(m_shape->isClosed());
|
||||
@@ -424,7 +424,6 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
|
||||
break;
|
||||
}
|
||||
}
|
||||
setPenColorButton(same ? pc : QColor());
|
||||
ui->m_color_kpb->setColor(same ? pc : QColor());
|
||||
|
||||
//Brush
|
||||
@@ -448,7 +447,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
|
||||
break;
|
||||
}
|
||||
}
|
||||
setBrushColorButton(same ? bc : QColor());
|
||||
ui->m_brush_color_kpb->setColor(same ? bc : QColor());
|
||||
|
||||
ui->m_lock_pos_cb->setChecked(false);
|
||||
ui->m_close_polygon->setChecked(false);
|
||||
@@ -482,36 +481,6 @@ bool ShapeGraphicsItemPropertiesWidget::setLiveEdit(bool live_edit)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ShapeGraphicsItemPropertiesWidget::setPenColorButton
|
||||
* Set the color of pen push button to the current color of the shape pen
|
||||
* @param color
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::setPenColorButton(const QColor &color)
|
||||
{
|
||||
if (!color.isValid()) {
|
||||
ui->m_color_pb->setStyleSheet("");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_color_pb->setStyleSheet(QString("background-color : %1").arg(color.name()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ShapeGraphicsItemPropertiesWidget::setBrushColorButton
|
||||
* Set the color of brush push button to the current color of shape brush
|
||||
* @param color
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::setBrushColorButton(const QColor &color)
|
||||
{
|
||||
if (!color.isValid()) {
|
||||
ui->m_brush_color_pb->setStyleSheet("");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_brush_color_pb->setStyleSheet(QString("background-color : %1").arg(color.name()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ShapeGraphicsItemPropertiesWidget::setUpEditConnection
|
||||
* Disconnect the previous connection, and reconnect the connection between the editors widgets and void ShapeGraphicsItemPropertiesWidget::apply function
|
||||
@@ -546,54 +515,16 @@ void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ShapeGraphicsItemPropertiesWidget::on_m_color_pb_clicked
|
||||
* Pen color button was clicked, we open a QColorDialog for select the color to apply to the shape pen.
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::on_m_color_pb_clicked()
|
||||
{
|
||||
if (!m_shape && m_shapes_list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QetShapeItem *shape_ = m_shape ? m_shape : m_shapes_list.first().data();
|
||||
QColor color = QColorDialog::getColor(shape_->pen().color(), this);
|
||||
if (color.isValid()) {
|
||||
setPenColorButton(color);
|
||||
}
|
||||
if (m_live_edit) {
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ShapeGraphicsItemPropertiesWidget::on_m_brush_color_pb_clicked
|
||||
* Brush color button was clicked, we open a QColorDialog for select the color to apply to the shape brush.
|
||||
*/
|
||||
void ShapeGraphicsItemPropertiesWidget::on_m_brush_color_pb_clicked()
|
||||
{
|
||||
if (!m_shape && m_shapes_list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QetShapeItem *shape_ = m_shape ? m_shape : m_shapes_list.first().data();
|
||||
|
||||
QColor color = QColorDialog::getColor(shape_->brush().color(), this);
|
||||
if (color.isValid()) {
|
||||
setBrushColorButton(color);
|
||||
}
|
||||
if (m_live_edit) {
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ShapeGraphicsItemPropertiesWidget::on_m_color_kpb_changed(const QColor &newColor)
|
||||
{
|
||||
if (newColor.isValid())
|
||||
{
|
||||
setPenColorButton(newColor);
|
||||
if (m_live_edit) {
|
||||
if(newColor.isValid() && m_live_edit) {
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeGraphicsItemPropertiesWidget::on_m_brush_color_kpb_changed(const QColor &newColor)
|
||||
{
|
||||
if(newColor.isValid() && m_live_edit) {
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,18 +52,12 @@ class ShapeGraphicsItemPropertiesWidget : public PropertiesEditorWidget
|
||||
bool setLiveEdit(bool live_edit) override;
|
||||
|
||||
private:
|
||||
void setPenColorButton(const QColor &color);
|
||||
void setBrushColorButton(const QColor &color);
|
||||
void setUpEditConnection();
|
||||
|
||||
private slots:
|
||||
void on_m_lock_pos_cb_clicked();
|
||||
void on_m_color_pb_clicked();
|
||||
void on_m_brush_color_pb_clicked();
|
||||
|
||||
|
||||
|
||||
void on_m_color_kpb_changed(const QColor &newColor);
|
||||
void on_m_brush_color_kpb_changed(const QColor &newColor);
|
||||
|
||||
private:
|
||||
Ui::ShapeGraphicsItemPropertiesWidget *ui;
|
||||
|
||||
@@ -20,13 +20,6 @@
|
||||
<string>Trait</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Épaisseur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -34,6 +27,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Épaisseur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@@ -42,16 +42,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="m_color_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="KColorButton" name="m_color_kpb"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_size_dsb">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -85,7 +78,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_style_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -128,13 +121,6 @@
|
||||
<string>Remplissage</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_brush_style_cb">
|
||||
<item>
|
||||
@@ -214,6 +200,13 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
@@ -222,11 +215,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="m_brush_color_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="KColorButton" name="m_brush_color_kpb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user