void CombinedSymbolSettings::numberChanged(int value) { int old_num_items = symbol->getNumParts(); if (old_num_items == value) return; int num_items = value; symbol->setNumParts(num_items); for (int i = 0; i < max_count; ++i) { symbol_labels[i]->setVisible(i < num_items); symbol_edits[i]->setVisible(i < num_items); edit_buttons[i]->setVisible(i < num_items); if (i >= old_num_items && i < num_items) { // This item appears now symbol->setPart(i, NULL, false); symbol_edits[i]->blockSignals(true); symbol_edits[i]->setSymbol(NULL); symbol_edits[i]->blockSignals(false); edit_buttons[i]->setEnabled(symbol->isPartPrivate(i)); } } emit propertiesModified(); }
void CombinedSymbolSettings::symbolChanged(int index) { if (symbol_edits[index]->symbol() != NULL) symbol->setPart(index, symbol_edits[index]->symbol(), false); else if (symbol_edits[index]->customID() > 0) { // Changing to a private symbol Symbol::Type new_symbol_type; if (symbol_edits[index]->customID() == 1) new_symbol_type = Symbol::Line; else // if (symbol_edits[index]->customID() == 2) new_symbol_type = Symbol::Area; Symbol* new_symbol = NULL; if (symbol->getPart(index) != NULL && new_symbol_type == symbol->getPart(index)->getType()) { if (QMessageBox::question(this, tr("Change from public to private symbol"), tr("Take the old symbol as template for the private symbol?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { new_symbol = symbol->getPart(index)->duplicate(); } } if (new_symbol == NULL) new_symbol = Symbol::getSymbolForType(new_symbol_type); symbol->setPart(index, new_symbol, true); editClicked(index); } else symbol->setPart(index, NULL, false); edit_buttons[index]->setEnabled(symbol->isPartPrivate(index)); emit propertiesModified(); }
void TextSymbolSettings::addCustomTabClicked() { bool ok = false; // FIXME: Unit of measurement display in unusual way double position = QInputDialog::getDouble(dialog, tr("Add custom tabulator"), QString("%1 (%2)").arg(tr("Position:")).arg(tr("mm")), 0, 0, 999999, 3, &ok); if (ok) { int int_position = qRound(1000 * position); int row = symbol->getNumCustomTabs(); for (int i = 0; i < symbol->getNumCustomTabs(); ++i) { if (int_position == symbol->custom_tabs[i]) return; // do not add a double position else if (int_position < symbol->custom_tabs[i]) { row = i; break; } } custom_tab_list->insertItem(row, locale().toString(position, 'g', 3) % ' ' % tr("mm")); custom_tab_list->setCurrentRow(row); symbol->custom_tabs.insert(symbol->custom_tabs.begin() + row, int_position); emit propertiesModified(); updateCompatibilityCheckEnabled(); } }
void Properties::propertyChanged( ) { if ( getTarget() == nullptr ) return; // Note 20151029: Here is the magic, get the sender signal name an extract the 'property name' int senderSignalId = senderSignalIndex( ); if ( ( sender( ) == this || sender() == getTarget() ) && senderSignalId != -1 ) { QMetaMethod senderSignal{}; if ( sender() == this ) senderSignal = metaObject( )->method( senderSignalId ); if ( getTarget() != nullptr && sender() == getTarget() ) senderSignal = getTarget()->metaObject( )->method( senderSignalId ); if ( senderSignal.isValid( ) ) { QString senderSignalName( senderSignal.name( ) ); // FIXME 20151029 Document that behaviour: QuickProperties only works with xxxChanged() NOTIFY signals (this is the standard Qt "coding style"). QStringList propertyNames = senderSignalName.split( QRegExp( "Changed" ) ); if ( propertyNames.size( ) > 0 ) { QString propertyName = propertyNames.at( 0 ); int propertyIndex = getPropertyIndex( propertyName ); QModelIndex propertyModelIndex = index( propertyIndex ); if ( propertyModelIndex.isValid( ) ) { emit dataChanged( propertyModelIndex, propertyModelIndex ); emit propertiesModified( propertyName ); } } } } }
void TextSymbolSettings::iconTextEdited(const QString& text) { if (!react_to_changes) return; symbol->icon_text = text; emit propertiesModified(); }
/*! * \note Be carefull, that method is actually overriden in qan::Properties, but is not * declared virtual in the Qt framework. */ bool Properties::setProperty( const char* name, QVariant value ) { Q_ASSERT( name != nullptr ); QObject::setProperty( name, value ); // Not: Do not test return value, it could be false even when set value is successfull refreshModels( name ); emit propertiesModified( QString( name ) ); return true; }
void TextSymbolSettings::framingColorChanged() { if (!react_to_changes) return; symbol->framing_color = framing_color_edit->color(); updateFramingContents(); emit propertiesModified(); }
void TextSymbolSettings::colorChanged() { if (!react_to_changes) return; symbol->color = color_edit->color(); symbol->updateQFont(); emit propertiesModified(); }
void TextSymbolSettings::fontChanged(QFont font) { if (!react_to_changes) return; symbol->font_family = font.family(); symbol->updateQFont(); emit propertiesModified(); }
void TextSymbolSettings::removeCustomTabClicked() { int row = custom_tab_list->row(custom_tab_list->currentItem()); delete custom_tab_list->item(row); custom_tab_list->setCurrentRow(row - 1); symbol->custom_tabs.erase(symbol->custom_tabs.begin() + row); emit propertiesModified(); updateCompatibilityCheckEnabled(); }
void TextSymbolSettings::framingCheckClicked(bool checked) { if (!react_to_changes) return; setTabEnabled(indexOf(framing_widget), checked); symbol->framing = checked; emit propertiesModified(); }
/*! * \note Be carefull, that method is actually overriden in qps::Properties, but is not * declared virtual in the Qt framework. */ bool Properties::setProperty( const char* name, QVariant value ) { if ( getTarget() == nullptr ) return false; if ( name == nullptr ) return false; getTarget()->setProperty( name, value ); // Not: Do not test return value, it could be false even when set value is successfull emit propertiesModified( QString( name ) ); return true; }
bool Properties::event( QEvent* e ) { if ( getTarget() == nullptr && // Catch dynamic properties changes for this only if a target has not been set e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); updateProperty( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); } return QObject::event( e ); }
bool Properties::event( QEvent* e ) { if ( e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); refreshModels( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); } return QObject::event( e ); }
void TextSymbolSettings::framingSettingChanged() { if (!react_to_changes) return; symbol->framing_line_half_width = qRound(1000.0 * framing_line_half_width_edit->value()); symbol->framing_shadow_x_offset = qRound(1000.0 * framing_shadow_x_offset_edit->value()); symbol->framing_shadow_y_offset = qRound(-1000.0 * framing_shadow_y_offset_edit->value()); emit propertiesModified(); }
void TextSymbolSettings::determineSizeClicked() { DetermineFontSizeDialog modal_dialog(this, symbol); modal_dialog.setWindowModality(Qt::WindowModal); if (modal_dialog.exec() == QDialog::Accepted) { updateSizeEdit(); symbol->updateQFont(); emit propertiesModified(); } }
void TextSymbolSettings::framingModeChanged() { if (!react_to_changes) return; if (framing_line_radio->isChecked()) symbol->framing_mode = TextSymbol::LineFraming; else if (framing_shadow_radio->isChecked()) symbol->framing_mode = TextSymbol::ShadowFraming; updateFramingContents(); emit propertiesModified(); }
void TextSymbolSettings::lineBelowSettingChanged() { if (!react_to_changes) return; symbol->line_below_color = line_below_color_edit->color(); symbol->line_below_width = qRound(1000.0 * line_below_width_edit->value()); symbol->line_below_distance = qRound(1000.0 * line_below_distance_edit->value()); symbol->updateQFont(); emit propertiesModified(); updateCompatibilityCheckEnabled(); }
void TextSymbolSettings::spacingChanged(double value) { Q_UNUSED(value); if (!react_to_changes) return; symbol->line_spacing = 0.01 * line_spacing_edit->value(); symbol->paragraph_spacing = qRound(1000.0 * paragraph_spacing_edit->value()); symbol->character_spacing = 0.01f * character_spacing_edit->value(); symbol->updateQFont(); emit propertiesModified(); }
bool Properties::eventFilter( QObject *obj, QEvent* e ) { if ( getTarget() != nullptr && getTarget() == obj && e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); updateProperty( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); return false; } else return QObject::eventFilter( obj, e ); return false; }
void TextSymbolSettings::checkToggled(bool checked) { Q_UNUSED(checked); if (!react_to_changes) return; symbol->bold = bold_check->isChecked(); symbol->italic = italic_check->isChecked(); symbol->underline = underline_check->isChecked(); symbol->kerning = kerning_check->isChecked(); symbol->updateQFont(); emit propertiesModified(); }
void TextSymbolSettings::sizeChanged(double value) { if (!react_to_changes) return; SizeUnit unit = (SizeUnit)size_unit_combo->itemData(size_unit_combo->currentIndex()).toInt(); if (unit == SizeInMM) symbol->font_size = qRound(1000 * value); else if (unit == SizeInPT) symbol->font_size = qRound(1000 * value * (1 / 72.0 * 25.4)); symbol->updateQFont(); emit propertiesModified(); }
void CombinedSymbolSettings::editClicked(int index) { Q_ASSERT(symbol->isPartPrivate(index)); if (!symbol->isPartPrivate(index)) return; QScopedPointer<Symbol> part(symbol->getPart(index)->duplicate()); SymbolSettingDialog sub_dialog(part.data(), dialog->getSourceMap(), this); sub_dialog.setWindowModality(Qt::WindowModal); if (sub_dialog.exec() == QDialog::Accepted) { symbol->setPart(index, sub_dialog.getNewSymbol(), true); emit propertiesModified(); } }
void TextSymbolSettings::lineBelowCheckClicked(bool checked) { if (!react_to_changes) return; symbol->line_below = checked; if (checked) { // Set defaults such that the line becomes visible if (symbol->line_below_width == 0) line_below_width_edit->setValue(0.1); if (symbol->line_below_color == NULL) line_below_color_edit->setCurrentIndex(1); } symbol->updateQFont(); emit propertiesModified(); line_below_color_edit->setEnabled(checked); line_below_width_edit->setEnabled(checked); line_below_distance_edit->setEnabled(checked); updateCompatibilityCheckEnabled(); }