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() );
}
void QgsRuleBasedLabelingWidget::addRule()
{
  if ( mRuleProps )
    mStackedWidget->removeWidget( mRuleProps );

  delete mRuleProps;
  mRuleProps = nullptr;

  // TODO Delete rule
  QgsRuleBasedLabeling::Rule* newrule = new QgsRuleBasedLabeling::Rule( new QgsPalLayerSettings );
  mRuleProps = new QgsLabelingRulePropsDialog( newrule, mLayer, this, mCanvas, mDockMode );
  mRuleProps->setCurrentMode( QgsLabelingRulePropsDialog::Adding );

  mStackedWidget->addWidget( mRuleProps );
  mStackedWidget->setCurrentWidget( mRuleProps );

  connect( mRuleProps, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) );
  connect( mRuleProps, SIGNAL( accepted() ), this, SLOT( saveRule() ) );
  connect( mRuleProps, SIGNAL( rejected() ), this, SLOT( rejectRule() ) );
  addNewRule( newrule );
}
Exemplo n.º 3
0
Scanner::Scanner (QString n, DBIndex *i) : QTabDialog (0, 0, FALSE)
{
  chartIndex = i;
  scannerName = n;
  
  QString s = "Qtstalker Scanner";
  s.append(": ");
  s.append(scannerName);
  setCaption (s);

  QWidget *w = new QWidget(this);
  
  QVBoxLayout *vbox = new QVBoxLayout(w);
  vbox->setMargin(5);
  vbox->setSpacing(5);
  
  QHGroupBox *gbox = new QHGroupBox(tr("Symbol Selection"), w);  
  vbox->addWidget(gbox);

  allSymbols = new QCheckBox(tr("All symbols"), gbox);
  connect(allSymbols, SIGNAL(toggled(bool)), this, SLOT(allSymbolsToggled(bool)));

  fileButton = new QPushButton(tr("0 Symbols"), gbox);
  connect(fileButton, SIGNAL(clicked()), this, SLOT(getSymbols()));

  basePath = new QComboBox(gbox);
  basePath->insertItem(tr("Chart"), -1);
  basePath->insertItem(tr("Group"), -1);

  QGridLayout *grid = new QGridLayout(vbox, 1, 2);
  grid->setColStretch(1, 1);

  QLabel *label = new QLabel(tr("Bar Length"), w);
  grid->addWidget(label, 0, 0);

  BarData bd(scannerName);
  period = new QComboBox(w);
  bd.getBarLengthList(barLengthList);
  period->insertStringList(barLengthList, -1);
  period->setCurrentText("Daily");
  grid->addWidget(period, 0, 1);

  label = new QLabel(tr("Bars"), w);
  grid->addWidget(label, 1, 0);

  bars = new QSpinBox(1, 99999999, 1, w);
  bars->setValue(100);
  grid->addWidget(bars, 1, 1);
  
  list = new FormulaEdit(w, FormulaEdit::Logic);
  vbox->addWidget(list);
  
  setDefaultButton(tr("&Scan"));
  connect(this, SIGNAL(defaultButtonPressed()), this, SLOT(scan()));
  
  setApplyButton(tr("&Apply"));  
  connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveRule()));
  
  setCancelButton(tr("&Cancel"));  
  connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog()));
  
  setOkButton(QString::null);  
  
  setHelpButton();
  QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp()));
  
  addTab(w, tr("Parms"));

  loadRule();
}