Example #1
0
/**
 * Dodaje nowy wykres do kontrolki.
 *
 * Sprawdza, ile jest aktualnie wyświetlonych wykresów. Jeśli więcej niż 0,
 * chowa kartę początkową.
 *
 * @param plot wskaźnik do wykresu
 * @param tabLabel tytuł zakładki na pasku
 */
void ChartsWidget::addPlot(QwtPlot* plot, QString tabLabel)
{
    int index = ui->tabCharts->addTab(plot, tabLabel);
    plot->replot();
    ui->tabCharts->setCurrentIndex(index);
    emit chartAdded(index);

    chartsCount++;
    updateUi();
    if (chartsCount > 0)
        ui->tabCharts->removeTab(ui->tabCharts->indexOf(ui->tabInitial));
}
Example #2
0
void QgsEffectStackPropertiesWidget::addEffect()
{
  QgsPaintEffect* newEffect = new QgsDrawSourceEffect();
  mStack->insertEffect( 0, newEffect );

  EffectItem *newEffectItem = new EffectItem( newEffect, this );
  mModel->invisibleRootItem()->insertRow( mStack->count() - 1, newEffectItem );

  mEffectsList->setCurrentIndex( mModel->indexFromItem( newEffectItem ) );
  updateUi();
  updatePreview();
}
QgsRasterPyramidsOptionsWidget::QgsRasterPyramidsOptionsWidget( QWidget* parent, const QString& provider )
    : QWidget( parent )
    , mProvider( provider )
{
  setupUi( this );

  mSaveOptionsWidget->setProvider( provider );
  mSaveOptionsWidget->setPyramidsFormat( QgsRaster::PyramidsGTiff );
  mSaveOptionsWidget->setType( QgsRasterFormatSaveOptionsWidget::ProfileLineEdit );

  updateUi();
}
Example #4
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), stopped(true)
{
    createWidgets();
    createLayout();
    createConnections();

    AQP::accelerateWidget(this);
    updateUi();
    directoryEdit->setFocus();
    setWindowTitle(QApplication::applicationName());
}
Example #5
0
bool WidgetRenderer::receiveFrame(const VideoFrame &frame)
{
    preparePixmap(frame);
    updateUi();
    /*
     * workaround for the widget not updated if has parent. don't know why it works and why update() can't
     * Thanks to Vito Covito and Carlo Scarpato
     * Now it's fixed by posting a QUpdateLaterEvent
     */
    Q_EMIT imageReady();
    return true;
}
Example #6
0
QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *stack, QWidget *parent )
    : QgsPanelWidget( parent )
    , mStack( stack )
    , mPreviewPicture( nullptr )
{

// TODO
#ifdef Q_OS_MAC
  //setWindowModality( Qt::WindowModal );
#endif

  mPresentWidget = nullptr;

  setupUi( this );

  mAddButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
  mRemoveButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.svg" ) ) );
  mUpButton->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowUp.svg" ) ) );
  mDownButton->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowDown.svg" ) ) );

  mModel = new QStandardItemModel();
  // Set the effect
  mEffectsList->setModel( mModel );

  QItemSelectionModel* selModel = mEffectsList->selectionModel();
  connect( selModel, SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( effectChanged() ) );

  loadStack( stack );
  updatePreview();

  connect( mUpButton, SIGNAL( clicked() ), this, SLOT( moveEffectUp() ) );
  connect( mDownButton, SIGNAL( clicked() ), this, SLOT( moveEffectDown() ) );
  connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addEffect() ) );
  connect( mRemoveButton, SIGNAL( clicked() ), this, SLOT( removeEffect() ) );

  updateUi();

  // set first selected effect as active item in the tree
  int initialRow = 0;
  for ( int i = 0; i < stack->count(); ++i )
  {
    // list shows effects in opposite order to stack
    if ( stack->effect( stack->count() - i - 1 )->enabled() )
    {
      initialRow = i;
      break;
    }
  }
  QModelIndex newIndex = mEffectsList->model()->index( initialRow, 0 );
  mEffectsList->setCurrentIndex( newIndex );

  setPanelTitle( tr( "Effects Properties" ) );
}
Example #7
0
void ItemEncryptedLoader::terminateGpgProcess()
{
    if (m_gpgProcess == nullptr)
        return;
    QProcess *p = m_gpgProcess;
    m_gpgProcess = nullptr;
    p->terminate();
    p->waitForFinished();
    p->deleteLater();
    m_gpgProcessStatus = GpgNotRunning;
    updateUi();
}
Example #8
0
void QgsMeasureDialog::restorePosition()
{
  QgsSettings settings;
  restoreGeometry( settings.value( QStringLiteral( "Windows/Measure/geometry" ) ).toByteArray() );
  int wh;
  if ( mMeasureArea )
    wh = settings.value( QStringLiteral( "Windows/Measure/hNoTable" ), 70 ).toInt();
  else
    wh = settings.value( QStringLiteral( "Windows/Measure/h" ), 200 ).toInt();
  resize( width(), wh );
  updateUi();
}
void QgsProcessingModelerParameterWidget::setWidgetValue( const QgsProcessingModelChildParameterSource &value )
{
  // we make a copy of all attributes and store locally, so that users can flick between
  // sources without losing their current value
  mStaticValue = value.staticValue();
  mModelInputParameterName = value.parameterName();
  mOutputChildId = value.outputChildId();
  mOutputName = value.outputName();
  mExpression = value.expression();

  updateUi();
  setSourceType( value.source() );
}
void QgsSymbolV2PropertiesDialog::addLayer()
{
  QgsSymbolLayerV2* newLayer = QgsSymbolLayerV2Registry::instance()->defaultSymbolLayer( mSymbol->type() );

  mSymbol->appendSymbolLayer( newLayer );

  loadSymbol();

  QModelIndex newIndex = listLayers->model()->index( 0, 0 );
  listLayers->setCurrentIndex( newIndex );

  updateUi();
}
Example #11
0
void ZFramework3D::slot_compute_isoline()
{
	ZMeshSpace::ZMeshAlgorithms* handler = ZDataManager::getDataManager()->getAlgorithmHandler();
	const ZMeshSpace::ZEigenData& eigenData = handler->getEigenData();
	double value = eigenData.minVal + (eigenData.maxVal-eigenData.minVal)*ui.hSliderValue->sliderPosition()/1000;
	QString str("Value: ");
	str += QString::number(value);
	ui.labelValue->setText(str);
	handler->clearIsoLineData();
	handler->computeIsoLines(handler->getCurrentEigenIdx(), value);
	handler->computeProjectionPlanes();
	updateUi();
	updateViews();
}
SubscribeToolButton::SubscribeToolButton(QWidget *parent) :
    QToolButton(parent)
{
	mSubscribed = false;

    	mMenu = NULL ;
	setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

#ifdef USE_MENUBUTTONPOPUP
	connect(this, SIGNAL(clicked()), this, SLOT(subscribePrivate()));
#endif

	updateUi();
}
void QgsMeasureDialog::restart()
{
  mTool->restart();

  // Set one cell row where to update current distance
  // If measuring area, the table doesn't get shown
  mTable->clear();
  QTreeWidgetItem* item = new QTreeWidgetItem( QStringList( QString::number( 0, 'f', 1 ) ) );
  item->setTextAlignment( 0, Qt::AlignRight );
  mTable->addTopLevelItem( item );
  mTotal = 0.;

  updateUi();
}
Example #14
0
WiredPage::WiredPage(const QModelIndex &technology, ConnMan *manager, QWidget *parent):
    QWidget(parent),
    m_technology(technology),
    m_manager(manager),
    m_service(NULL)
{
    ui.setupUi(this);

    m_wiredTechnology = static_cast<ManagerNode*>(technology.internalPointer())->object<Technology *>();

    ui.icon->setPixmap(QIcon::fromTheme("network-wired").pixmap(QSize(48, 48)));
    ui.enabled->setChecked(m_wiredTechnology->isPowered());

    connect(manager, SIGNAL(servicesChanged()), SLOT(configureService()));
    connect(m_wiredTechnology, SIGNAL(dataChanged()), SLOT(updateUi()));
    connect(m_wiredTechnology, SIGNAL(poweredChanged(bool)), ui.enabled, SLOT(setChecked(bool)));
    connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(toggleTechnology(bool)));

    ui.ipv4Widget->hide();

    configureService();
    updateUi();
}
void BlackBerryNDKSettingsWidget::deactivateApiLevel()
{
    if (!m_ui->ndksTreeWidget->currentItem())
        return;

    BlackBerryApiLevelConfiguration *config = static_cast<BlackBerryApiLevelConfiguration*>(
                m_ui->ndksTreeWidget->currentItem()->data(0, Qt::UserRole).value<void*>());
    if (m_activatedApiLevel.contains(config)) {
        m_deactivatedApiLevel << config;
        m_activatedApiLevel.removeAt(m_activatedApiLevel.indexOf(config));
        updateUi(m_ui->ndksTreeWidget->currentItem());
        emit configurationsUpdated();
    }
}
Example #16
0
void MainWindow::selectionChanged()
{
	if (form->selectedItems().count())
	{
		ui->propertyWidget->setWidget(itemWidget);
		itemWidget->update(form->selected());
	}
	else
	{
		ui->propertyWidget->setWidget(formWidget);
		formWidget->update(form);
	}
	updateUi();
}
Example #17
0
void QgsSymbolSelectorWidget::addLayer()
{
  QModelIndex idx = layersTree->currentIndex();
  if ( !idx.isValid() )
    return;

  int insertIdx = -1;
  SymbolLayerItem *item = static_cast<SymbolLayerItem *>( model->itemFromIndex( idx ) );
  if ( item->isLayer() )
  {
    insertIdx = item->row();
    item = static_cast<SymbolLayerItem *>( item->parent() );
  }

  QgsSymbol *parentSymbol = item->symbol();

  // save data-defined values at marker level
  QgsProperty ddSize( parentSymbol->type() == QgsSymbol::Marker
                      ? static_cast<QgsMarkerSymbol *>( parentSymbol )->dataDefinedSize()
                      : QgsProperty() );
  QgsProperty ddAngle( parentSymbol->type() == QgsSymbol::Marker
                       ? static_cast<QgsMarkerSymbol *>( parentSymbol )->dataDefinedAngle()
                       : QgsProperty() );
  QgsProperty ddWidth( parentSymbol->type() == QgsSymbol::Line
                       ? static_cast<QgsLineSymbol *>( parentSymbol )->dataDefinedWidth()
                       : QgsProperty() );

  QgsSymbolLayer *newLayer = QgsApplication::symbolLayerRegistry()->defaultSymbolLayer( parentSymbol->type() );
  if ( insertIdx == -1 )
    parentSymbol->appendSymbolLayer( newLayer );
  else
    parentSymbol->insertSymbolLayer( item->rowCount() - insertIdx, newLayer );

  // restore data-defined values at marker level
  if ( ddSize )
    static_cast<QgsMarkerSymbol *>( parentSymbol )->setDataDefinedSize( ddSize );
  if ( ddAngle )
    static_cast<QgsMarkerSymbol *>( parentSymbol )->setDataDefinedAngle( ddAngle );
  if ( ddWidth )
    static_cast<QgsLineSymbol *>( parentSymbol )->setDataDefinedWidth( ddWidth );

  SymbolLayerItem *newLayerItem = new SymbolLayerItem( newLayer );
  item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
  item->updatePreview();

  layersTree->setCurrentIndex( model->indexFromItem( newLayerItem ) );
  updateUi();
  updatePreview();
}
void QgsRelationEditorWidget::setRelations( const QgsRelation& relation, const QgsRelation& nmrelation )
{
  if ( mRelation.isValid() )
  {
    disconnect( mRelation.referencingLayer(), SIGNAL( editingStarted() ), this, SLOT( updateButtons() ) );
    disconnect( mRelation.referencingLayer(), SIGNAL( editingStopped() ), this, SLOT( updateButtons() ) );
  }

  if ( mNmRelation.isValid() )
  {
    disconnect( mNmRelation.referencedLayer(), SIGNAL( editingStarted() ), this, SLOT( updateButtons() ) );
    disconnect( mNmRelation.referencedLayer(), SIGNAL( editingStopped() ), this, SLOT( updateButtons() ) );
  }

  mRelation = relation;
  mNmRelation = nmrelation;

  if ( !mRelation.isValid() )
    return;

  connect( mRelation.referencingLayer(), SIGNAL( editingStarted() ), this, SLOT( updateButtons() ) );
  connect( mRelation.referencingLayer(), SIGNAL( editingStopped() ), this, SLOT( updateButtons() ) );

  if ( mNmRelation.isValid() )
  {
    connect( mNmRelation.referencingLayer(), SIGNAL( editingStarted() ), this, SLOT( updateButtons() ) );
    connect( mNmRelation.referencingLayer(), SIGNAL( editingStopped() ), this, SLOT( updateButtons() ) );
  }

  setTitle( relation.name() );

  QgsVectorLayer* lyr = relation.referencingLayer();

  bool canChangeAttributes = lyr->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
  if ( canChangeAttributes && !lyr->isReadOnly() )
  {
    mToggleEditingButton->setEnabled( true );
    updateButtons();
  }
  else
  {
    mToggleEditingButton->setEnabled( false );
  }

  setObjectName( mRelation.name() );
  loadState();

  updateUi();
}
//end
//start id="keyevent"
void KeySequenceLabel::keyPressEvent(QKeyEvent* evt) {
    bool doNothing = false;

    if (evt->key() == 0) doNothing = true;
    if (m_keys.size() > 3) doNothing = true;
    if (doNothing) {
        QMainWindow::keyPressEvent(evt); /* QWidget's base class handler
                   responds to ESC for pop-up windows. */
        return;
    }
    QPair<int, int> pair = QPair<int, int>(evt->modifiers(), evt->key());
    m_keys << pair;
    evt->accept();
    updateUi();
}
Example #20
0
void VanityGenPage::lockWallet(){

    if(this->walletModel->getEncryptionStatus() == 2){
        gui->externCommand((const QString) QString("walletlock"));
        buttonUnlockState = !buttonUnlockState;
        ui->checkBoxAutoImport->setChecked(false);
        updateUi();
    } else{
        AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
        dlg.setModel(walletModel);
        dlg.exec();

        gui->setEncryptionStatus(walletModel->getEncryptionStatus());
    }
}
void QgsEffectStackPropertiesWidget::effectChanged()
{
  updateUi();

  EffectItem* currentItem = currentEffectItem();
  if ( !currentItem )
    return;

  QWidget *effectPropertiesWidget = new QgsPaintEffectPropertiesWidget( currentItem->effect() );
  setWidget( effectPropertiesWidget );

  connect( effectPropertiesWidget, SIGNAL( changeEffect( QgsPaintEffect* ) ), this, SLOT( changeEffect( QgsPaintEffect* ) ) );
  connect( effectPropertiesWidget, SIGNAL( changed() ), this, SLOT( updatePreview() ) );

}
Example #22
0
TextItemDialog::TextItemDialog(TextItem *item_,
        const QPoint &position_, QGraphicsScene *scene_,
        QWidget *parent)
    : QDialog(parent), item(item_), position(position_), scene(scene_)
{
    createWidgets();
    createLayout();
    createConnections();

    AQP::accelerateWidget(this);
    setWindowTitle(tr("%1 - %2 Text Item")
            .arg(QApplication::applicationName())
            .arg(item ? tr("Edit") : tr("Add")));
    updateUi();
}
void QgsSymbolV2PropertiesDialog::removeLayer()
{
  int idx = currentLayerIndex();
  if ( idx < 0 ) return;
  int row = currentRowIndex();
  mSymbol->deleteSymbolLayer( idx );

  loadSymbol();

  updateUi();

  // set previous layer as active
  QModelIndex newIndex = listLayers->model()->index( qMin( row, mSymbol->symbolLayerCount() - 1 ), 0 );
  listLayers->setCurrentIndex( newIndex );
}
Example #24
0
void MainWindow::createConnections()
{
    connect(fileNewAction, SIGNAL(triggered()),
            this, SLOT(fileNew()));
    connect(fileOpenAction, SIGNAL(triggered()),
            this, SLOT(fileOpen()));
    connect(fileSaveAction, SIGNAL(triggered()),
            this, SLOT(fileSave()));
    connect(fileSaveAsAction, SIGNAL(triggered()),
            this, SLOT(fileSaveAs()));
    connect(fileExportAction, SIGNAL(triggered()),
            this, SLOT(fileExport()));
    connect(filePrintAction, SIGNAL(triggered()),
            this, SLOT(filePrint()));
    connect(fileQuitAction, SIGNAL(triggered()),
            this, SLOT(close()));
    connect(editSelectedItemAction, SIGNAL(triggered()),
            this, SLOT(editSelectedItem()));
    connect(editAddTextAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editAddBoxAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editAddSmileyAction, SIGNAL(triggered()),
            this, SLOT(editAddItem()));
    connect(editCopyAction, SIGNAL(triggered()),
            this, SLOT(editCopy()));
    connect(editCutAction, SIGNAL(triggered()),
            this, SLOT(editCut()));
    connect(editPasteAction, SIGNAL(triggered()),
            this, SLOT(editPaste()));
    connect(QApplication::clipboard(), SIGNAL(dataChanged()),
            this, SLOT(updateUi()));
    foreach (QAction *action, QList<QAction*>()
             << editAlignmentAction << editAlignLeftAction
             << editAlignRightAction << editAlignTopAction
             << editAlignBottomAction)
        connect(action, SIGNAL(triggered()), this, SLOT(editAlign()));
    connect(editClearTransformsAction, SIGNAL(triggered()),
            this, SLOT(editClearTransforms()));
    connect(scene, SIGNAL(selectionChanged()),
            this, SLOT(selectionChanged()));
    connect(viewShowGridAction, SIGNAL(toggled(bool)),
            this, SLOT(viewShowGrid(bool)));
    connect(viewZoomInAction, SIGNAL(triggered()),
            view, SLOT(zoomIn()));
    connect(viewZoomOutAction, SIGNAL(triggered()),
            view, SLOT(zoomOut()));
}
Example #25
0
/**
 * Zamyka kartę o podanym indeksie.
 *
 * Jeśli liczba wykresów spadła do zera, przywraca kartę początkową.
 *
 * @param index indeks karty
 */
void ChartsWidget::closeChart(int index)
{
    QWidget* tab = ui->tabCharts->widget(index);
    // cannot close the initial page
    if (tab == ui->tabInitial)
        return;

    ui->tabCharts->removeTab(index);
    delete tab;
    emit chartRemoved(index);

    chartsCount--;
    updateUi();
    if (chartsCount <= 0)
        ui->tabCharts->addTab(ui->tabInitial, tr("No charts"));
}
Example #26
0
void QgsMeasureDialog::crsChanged()
{
  if ( !mTool->canvas()->mapSettings().destinationCrs().isValid() )
  {
    mUnitsCombo->setEnabled( false );
    if ( mMeasureArea )
      mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsUnitTypes::DistanceUnknownUnit ) );
    else
      mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsUnitTypes::AreaUnknownUnit ) );
  }
  else
  {
    mUnitsCombo->setEnabled( true );
  }
  updateUi();
}
void QgsSymbolV2PropertiesDialog::moveLayerByOffset( int offset )
{
  int rowIdx = currentRowIndex();
  int layerIdx = currentLayerIndex();

  // switch layers
  QgsSymbolLayerV2* tmpLayer = mSymbol->takeSymbolLayer( layerIdx );
  mSymbol->insertSymbolLayer( layerIdx - offset, tmpLayer );

  loadSymbol();

  QModelIndex newIndex = listLayers->model()->index( rowIdx + offset, 0 );
  listLayers->setCurrentIndex( newIndex );

  updateUi();
}
Example #28
0
void MinesRankingWidget::addNewRanking(const QString& playerName,
                   const int& time,
                   const int& nRows,
                   const int& nCols,
                   const int& nMines)
{
    MinesRankingItem item;
    item.player = playerName;
    item.time = time;
    item.nRows = nRows;
    item.nCols = nCols;
    item.mines = nMines;
    item.computeScore();
    ranking.addRankingItem(item);
    updateUi();
}
Example #29
0
void QgsMeasureDialog::updateSettings()
{
  QgsSettings settings;

  mDecimalPlaces = settings.value( QStringLiteral( "qgis/measure/decimalplaces" ), "3" ).toInt();
  mCanvasUnits = mTool->canvas()->mapUnits();
  // Configure QgsDistanceArea
  mDistanceUnits = QgsProject::instance()->distanceUnits();
  mAreaUnits = QgsProject::instance()->areaUnits();
  mDa.setSourceCrs( mTool->canvas()->mapSettings().destinationCrs() );
  mDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

  mTable->clear();
  mTotal = 0;
  updateUi();
}
void QgsSymbolV2PropertiesDialog::layerChanged()
{
  updateUi();

  // get layer info
  QgsSymbolLayerV2* layer = currentLayer();
  if ( layer == NULL )
    return;

  // update layer type combo box
  int idx = cboLayerType->findData( layer->layerType() );
  cboLayerType->setCurrentIndex( idx );

  updateSymbolLayerWidget( layer );

  updateLockButton();
}