[qet] [2673] Added Abhishek new patch:

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2673
Author:   scorpio810
Date:     2013-12-28 21:39:38 +0100 (Sat, 28 Dec 2013)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/sources/borderpropertieswidget.cpp
    trunk/sources/borderpropertieswidget.h
    trunk/sources/diagramprintdialog.cpp
    trunk/sources/diagramprintdialog.h

Modified: trunk/sources/borderpropertieswidget.cpp
===================================================================
--- trunk/sources/borderpropertieswidget.cpp	2013-12-28 13:28:27 UTC (rev 2672)
+++ trunk/sources/borderpropertieswidget.cpp	2013-12-28 20:39:38 UTC (rev 2673)
@@ -133,7 +133,9 @@
 	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 @@
 	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;
+
 }

Modified: trunk/sources/borderpropertieswidget.h
===================================================================
--- trunk/sources/borderpropertieswidget.h	2013-12-28 13:28:27 UTC (rev 2672)
+++ trunk/sources/borderpropertieswidget.h	2013-12-28 20:39:38 UTC (rev 2673)
@@ -46,7 +46,7 @@
 
 	public slots:
 	// to choose the back_ground color of diagram.
-	void chooseColor();
+	void changeColor();
 	
 	private:
 	void build();
@@ -60,6 +60,6 @@
 	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

Modified: trunk/sources/diagramprintdialog.cpp
===================================================================
--- trunk/sources/diagramprintdialog.cpp	2013-12-28 13:28:27 UTC (rev 2672)
+++ trunk/sources/diagramprintdialog.cpp	2013-12-28 20:39:38 UTC (rev 2673)
@@ -39,6 +39,8 @@
 	
 	// 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() {
 	delete dialog_;
 	delete printer_;
+	Diagram::background_color = backup_diagram_background_color;
 }
 
 /**

Modified: trunk/sources/diagramprintdialog.h
===================================================================
--- trunk/sources/diagramprintdialog.h	2013-12-28 13:28:27 UTC (rev 2672)
+++ trunk/sources/diagramprintdialog.h	2013-12-28 20:39:38 UTC (rev 2673)
@@ -83,5 +83,6 @@
 	QLineEdit *filepath_field_;
 	QPushButton *browse_button_;
 	QDialogButtonBox *buttons_;
+	QColor backup_diagram_background_color;
 };
 #endif


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/