1 /*************************************************************************** 2 * Copyright (C) 2000-2019 by Johan Maes * 3 * on4qz@telenet.be * 4 * http://users.telenet.be/on4qz * 5 * * 6 * This program is free software; you can redistribute it and/or modify * 7 * it under the terms of the GNU General Public License as published by * 8 * the Free Software Foundation; either version 2 of the License, or * 9 * (at your option) any later version. * 10 * * 11 * This program is distributed in the hope that it will be useful, * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 * GNU General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU General Public License * 17 * along with this program; if not, write to the * 18 * Free Software Foundation, Inc., * 19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 20 ***************************************************************************/ 21 #ifndef GRADIENTDIALOG_H 22 #define GRADIENTDIALOG_H 23 24 #include <QtGui> 25 #include "ui_gradientform.h" 26 27 struct sgradientParam 28 { 29 enum gType {NONE,LINEAR,RADIAL,CONICAL}; sgradientParamsgradientParam30 sgradientParam() 31 { 32 type=NONE; 33 } 34 QColor color1; 35 QColor color2; 36 QColor color3; 37 QColor color4; 38 int pos1; 39 int pos2; 40 int pos3; 41 int pos4; 42 gType type; 43 int direction; 44 void load(QDataStream &str); 45 void save(QDataStream &str); 46 }; 47 48 /** 49 @author Johan Maes - ON4QZ 50 */ 51 class gradientForm; 52 53 /** Widget to disply the various canvasItems */ 54 class gradientDialog : public QDialog,private Ui::gradientForm 55 { 56 Q_OBJECT 57 public: 58 gradientDialog(QWidget *parent = 0); 59 ~gradientDialog(); 60 void readSettings(); 61 void writeSettings(); 62 void selectGradient(); param()63 sgradientParam param() {return gParam;} 64 65 // QGradient *constructGradient( QRectF f); 66 public slots: 67 void slotColorDialog(); 68 void slotUpdate(); 69 private: 70 sgradientParam gParam; 71 void update(); 72 QGradient *g; 73 74 }; 75 76 QGradient buildGradient(sgradientParam prm, QRectF f); 77 #endif 78 79