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:
scorpio810
2013-12-28 20:39:38 +00:00
parent 38e3e26ff8
commit 31a865b5d1
4 changed files with 14 additions and 17 deletions

View File

@@ -133,7 +133,9 @@ void BorderPropertiesWidget::build() {
widget_layout -> addWidget(diagram_size_box); widget_layout -> addWidget(diagram_size_box);
// add background color field // add background color field
QLabel *ds3 = new QLabel(tr("Couleur de fond :")); 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 // layout
diagram_size_box_layout -> addWidget(ds1, 0, 0); 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(display_rows, 1, 3);
diagram_size_box_layout -> addWidget(ds3, 2, 0, 1, 2); diagram_size_box_layout -> addWidget(ds3, 2, 0, 1, 2);
diagram_size_box_layout -> addWidget(pb_background_color, 2, 2, 1, 2); diagram_size_box_layout -> addWidget(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);
//build button connection //build button connection
connect(pb_background_color, SIGNAL(clicked()), this, SLOT(chooseColor())); connect(background_color, SIGNAL(stateChanged(int)), this, SLOT(changeColor()));
setLayout(widget_layout); setLayout(widget_layout);
} }
/** /**
Background color choose QColorDialog. Makes Diagram::background_color equal to new chosen color. Background color choose QColorDialog. Makes Diagram::background_color equal to new chosen color.
*/ */
void BorderPropertiesWidget::chooseColor() { void BorderPropertiesWidget::changeColor() {
QColor user_chosen_color = QColorDialog::getColor(Diagram::background_color); Diagram::background_color = (background_color -> isChecked()) ? Qt::gray : Qt::white;
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);
}
} }

View File

@@ -46,7 +46,7 @@ class BorderPropertiesWidget : public QWidget {
public slots: public slots:
// to choose the back_ground color of diagram. // to choose the back_ground color of diagram.
void chooseColor(); void changeColor();
private: private:
void build(); void build();
@@ -60,6 +60,6 @@ class BorderPropertiesWidget : public QWidget {
QSpinBox *rows_count; ///< Widget to edit the rows count QSpinBox *rows_count; ///< Widget to edit the rows count
QSpinBox *rows_height; ///< Widget to edit the rows height QSpinBox *rows_height; ///< Widget to edit the rows height
QCheckBox *display_rows; ///< Checkbox stating whether to display row headers 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 #endif

View File

@@ -39,6 +39,8 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) :
// orientation paysage par defaut // orientation paysage par defaut
printer_ -> setOrientation(QPrinter::Landscape); 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() { DiagramPrintDialog::~DiagramPrintDialog() {
delete dialog_; delete dialog_;
delete printer_; delete printer_;
Diagram::background_color = backup_diagram_background_color;
} }
/** /**

View File

@@ -83,5 +83,6 @@ class DiagramPrintDialog : public QWidget {
QLineEdit *filepath_field_; QLineEdit *filepath_field_;
QPushButton *browse_button_; QPushButton *browse_button_;
QDialogButtonBox *buttons_; QDialogButtonBox *buttons_;
QColor backup_diagram_background_color;
}; };
#endif #endif