mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Added Abhishek new patch:
Diagram::background_color is now selectable for white or grey remove QColorDialog for Background print dialog is always in white background Thanks git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2673 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -133,7 +133,9 @@ void BorderPropertiesWidget::build() {
|
||||
widget_layout -> addWidget(diagram_size_box);
|
||||
// add background color field
|
||||
QLabel *ds3 = new QLabel(tr("Couleur de fond :"));
|
||||
pb_background_color = new QPushButton(diagram_size_box);
|
||||
background_color = new QCheckBox(tr("Gris"), diagram_size_box);
|
||||
bool isnotChecked = Diagram::background_color == Qt::white;
|
||||
background_color -> setChecked(!isnotChecked);
|
||||
|
||||
// layout
|
||||
diagram_size_box_layout -> addWidget(ds1, 0, 0);
|
||||
@@ -146,25 +148,16 @@ void BorderPropertiesWidget::build() {
|
||||
diagram_size_box_layout -> addWidget(display_rows, 1, 3);
|
||||
|
||||
diagram_size_box_layout -> addWidget(ds3, 2, 0, 1, 2);
|
||||
diagram_size_box_layout -> addWidget(pb_background_color, 2, 2, 1, 2);
|
||||
// make color of pushbutton same as the present background color chosen
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, Diagram::background_color);
|
||||
pb_background_color -> setPalette(palette);
|
||||
diagram_size_box_layout -> addWidget(background_color, 2, 2, 1, 2);
|
||||
|
||||
//build button connection
|
||||
connect(pb_background_color, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
||||
connect(background_color, SIGNAL(stateChanged(int)), this, SLOT(changeColor()));
|
||||
setLayout(widget_layout);
|
||||
}
|
||||
/**
|
||||
Background color choose QColorDialog. Makes Diagram::background_color equal to new chosen color.
|
||||
*/
|
||||
void BorderPropertiesWidget::chooseColor() {
|
||||
QColor user_chosen_color = QColorDialog::getColor(Diagram::background_color);
|
||||
if (user_chosen_color.isValid()) {
|
||||
Diagram::background_color = user_chosen_color;
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Button, Diagram::background_color);
|
||||
pb_background_color -> setPalette(palette);
|
||||
}
|
||||
void BorderPropertiesWidget::changeColor() {
|
||||
Diagram::background_color = (background_color -> isChecked()) ? Qt::gray : Qt::white;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class BorderPropertiesWidget : public QWidget {
|
||||
|
||||
public slots:
|
||||
// to choose the back_ground color of diagram.
|
||||
void chooseColor();
|
||||
void changeColor();
|
||||
|
||||
private:
|
||||
void build();
|
||||
@@ -60,6 +60,6 @@ class BorderPropertiesWidget : public QWidget {
|
||||
QSpinBox *rows_count; ///< Widget to edit the rows count
|
||||
QSpinBox *rows_height; ///< Widget to edit the rows height
|
||||
QCheckBox *display_rows; ///< Checkbox stating whether to display row headers
|
||||
QPushButton *pb_background_color; ///< Push button for selecting diagram background color
|
||||
QCheckBox *background_color; ///< Checkbox for selecting diagram background color grey/white
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,8 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) :
|
||||
|
||||
// orientation paysage par defaut
|
||||
printer_ -> setOrientation(QPrinter::Landscape);
|
||||
backup_diagram_background_color = Diagram::background_color;
|
||||
Diagram::background_color = Qt::white;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,7 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) :
|
||||
DiagramPrintDialog::~DiagramPrintDialog() {
|
||||
delete dialog_;
|
||||
delete printer_;
|
||||
Diagram::background_color = backup_diagram_background_color;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,5 +83,6 @@ class DiagramPrintDialog : public QWidget {
|
||||
QLineEdit *filepath_field_;
|
||||
QPushButton *browse_button_;
|
||||
QDialogButtonBox *buttons_;
|
||||
QColor backup_diagram_background_color;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user