QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) : QWidget( parent ) , mLayer( 0 ) , mEditIndex( 0 ) , mEditing( false ) , mSymbol( 0 ) { setupUi( this ); mDeleteButton->hide(); connect( mFieldCombo, SIGNAL( fieldChanged( QString ) ), SLOT( fieldChanged( QString ) ) ); connect( fieldRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( rowRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( mNewButton, SIGNAL( clicked() ), SLOT( addNewRule() ) ); connect( mSaveRule, SIGNAL( clicked() ), SLOT( saveRule() ) ); connect( mCancelButton, SIGNAL( clicked() ), SLOT( cancelRule() ) ); connect( mDeleteButton, SIGNAL( clicked() ), SLOT( deleteRule() ) ); connect( listView, SIGNAL( clicked( QModelIndex ) ), SLOT( ruleClicked( QModelIndex ) ) ); connect( btnChangeIcon , SIGNAL( clicked() ), SLOT( updateIcon() ) ); connect( btnBuildExpression , SIGNAL( clicked() ), SLOT( setExpression() ) ); connect( mPresetsList , SIGNAL( currentIndexChanged( int ) ), SLOT( presetSet( int ) ) ); btnBackgroundColor->setAllowAlpha( true ); btnBackgroundColor->setShowNoColor( true ); btnTextColor->setAllowAlpha( true ); btnTextColor->setShowNoColor( true ); mPresetsModel = new QStandardItemModel( listView ); mModel = new QStandardItemModel( listView ); listView->setModel( mModel ); mPresetsList->setModel( mPresetsModel ); setPresets( defaultPresets() ); }
DrawingWindow::DrawingWindow(QVector<QPointF> *customRulePoints, QWidget *parent) : QGraphicsView(parent) { //Connect main window with this one by custome rule points vector this->customRulePoints = customRulePoints; //Create drawing scene drawingScene = new QGraphicsScene; drawingScene->setSceneRect(0,0,1000,1000); setScene(drawingScene); //Configure button that create new joint of custom rule createJointButton = new QPushButton("New joint", this); connect(createJointButton,SIGNAL(clicked()), this,SLOT(createJoint())); //Configure button that delete last created joint of custom rule deleteJointButton = new QPushButton("Delete joint", this); connect(deleteJointButton,SIGNAL(clicked()), this,SLOT(deleteJoint())); //Configure button that accepts and save custom rule acceptCustomRule = new QPushButton("Accept", this); connect(acceptCustomRule,SIGNAL(clicked()), this,SLOT(acceptRule())); //Configure button that cancel and restore previous custom rule cancelCustomRule = new QPushButton("Cancel", this); connect(cancelCustomRule,SIGNAL(clicked()), this,SLOT(cancelRule())); //Place all buttons in one widget with vertical layout drawingSceneWidget = new QWidget; drawingSceneWidget->resize(200, 200); drawingSceneWidget->setLayout(&drawingSceneLayout); drawingSceneLayout.addWidget(createJointButton); drawingSceneLayout.addWidget(deleteJointButton); drawingSceneLayout.addWidget(acceptCustomRule); drawingSceneLayout.addWidget(cancelCustomRule); drawingScene->addWidget(drawingSceneWidget); //Make scene dynamically redraw connect(drawingScene,SIGNAL(changed(QList<QRectF>)), this,SLOT(redraw())); //Draw line showing custom rule customRule = new QGraphicsPathItem(); customRule->setPath(createPath(joints)); drawingScene->addItem(customRule); //Make it draws smooth and resize setRenderHint(QPainter::Antialiasing); resize(1000,1000); }