void KLFUnitChooser::internalCurrentIndexChanged(int index) { if (index < 0 || index >= count()) return; Unit u = itemData(index).value<Unit>(); klfDbg("New unit selected : #"<<index<<" = "<<u.name) ; emit unitChanged(u.name); emit unitChanged(u.factor); emit unitChanged(u.factor, u.abbrev); }
// private void KLFUnitChooser::setCurrentUnitIndex(int k) { if (isEnabled()) { setCurrentIndex(k); } else { pDelayedUnitSet = pUnits[k].name; emit unitChanged(pUnits[k].name); emit unitChanged(pUnits[k].factor); emit unitChanged(pUnits[k].factor, pUnits[k].abbrev); } }
KoPAConfigureDialog::KoPAConfigureDialog(KoPAView* parent) : KPageDialog(parent) { setFaceType(List); setWindowTitle(i18n("Configure")); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults); button(QDialogButtonBox::Ok)->setDefault(true); m_miscPage = new KoConfigMiscPage( parent->koDocument(), parent->kopaCanvas()->shapeController()->resourceManager() ); KPageWidgetItem *item = addPage( m_miscPage, i18n( "Misc" ) ); item->setHeader( i18n( "Misc" ) ); item->setIcon(koIcon("preferences-other")); m_gridPage = new KoConfigGridPage(parent->koDocument()); item = addPage(m_gridPage, i18n("Grid")); item->setHeader(i18n("Grid")); item->setIcon(koIcon("grid")); connect(m_miscPage, SIGNAL(unitChanged(KoUnit)), m_gridPage, SLOT(slotUnitChanged(KoUnit))); m_docPage = new KoConfigDocumentPage( parent->koDocument() ); item = addPage( m_docPage, i18nc( "@title:tab Document settings page", "Document" ) ); item->setHeader( i18n( "Document Settings" ) ); item->setIcon(koIcon("document-properties")); m_authorPage = new KoConfigAuthorPage(); item = addPage(m_authorPage, i18nc("@title:tab Author page", "Author")); item->setHeader(i18n("Author")); item->setIcon(koIcon("user-identity")); connect( this, SIGNAL(accepted()), this, SLOT(slotApply()) ); connect( button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), this, SLOT(slotDefault())); connect( button(QDialogButtonBox::Apply), SIGNAL(clicked(bool)), this, SLOT(slotApply()) ); connect(this, SIGNAL(changed()), parent, SLOT(slotUpdateAuthorProfileActions())); }
KWConfigureDialog::KWConfigureDialog(KWView* parent) : KPageDialog(parent) { setFaceType(List); setCaption(i18n("Configure")); setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Default); setDefaultButton(KDialog::Ok); m_miscPage = new KoConfigMiscPage(parent->koDocument(), parent->canvasBase()->shapeController()->resourceManager()); KPageWidgetItem *item = addPage(m_miscPage, i18n("Misc")); item->setHeader(i18n("Misc")); item->setIcon(koIcon("preferences-other")); m_gridPage = new KoConfigGridPage(parent->koDocument()); item = addPage(m_gridPage, i18n("Grid")); item->setHeader(i18n("Grid")); item->setIcon(koIcon("grid")); connect(m_miscPage, SIGNAL(unitChanged(KoUnit)), m_gridPage, SLOT(slotUnitChanged(KoUnit))); m_docPage = new KoConfigDocumentPage(parent->koDocument()); item = addPage(m_docPage, i18nc("@title:tab Document settings page", "Document")); item->setHeader(i18n("Document Settings")); item->setIcon(koIcon("document-properties")); m_authorPage = new KoConfigAuthorPage(); item = addPage(m_authorPage, i18nc("@title:tab Author page", "Author")); item->setHeader(i18n("Author")); item->setIcon(koIcon("user-identity")); connect(this, SIGNAL(okClicked()), this, SLOT(slotApply())); connect(this, SIGNAL(defaultClicked()), this, SLOT(slotDefault())); connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()) ); connect(this, SIGNAL(changed()), parent, SLOT(slotUpdateAuthorProfileActions())); }
CryptobullionAmountField::CryptobullionAmountField(QWidget *parent): QWidget(parent), amount(0), currentUnit(-1) { amount = new QDoubleSpinBox(this); amount->setLocale(QLocale::c()); amount->setDecimals(8); amount->installEventFilter(this); amount->setMaximumWidth(170); amount->setSingleStep(0.001); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(amount); unit = new QValueComboBox(this); unit->setModel(new CryptobullionUnits(this)); layout->addWidget(unit); layout->addStretch(1); layout->setContentsMargins(0,0,0,0); setLayout(layout); setFocusPolicy(Qt::TabFocus); setFocusProxy(amount); // If one if the widgets changes, the combined content changes as well connect(amount, SIGNAL(valueChanged(QString)), this, SIGNAL(textChanged())); connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); // Set default based on configuration unitChanged(unit->currentIndex()); }
void Phrase::setUnit(Unit *unit) { if (unit == m_unit) { return; } m_unit = unit; emit unitChanged(); }
/** Assignment operator */ const cwUnitValue & cwUnitValue::operator =(const cwUnitValue &other) { if(this != &other) { Data = other.Data; emit unitChanged(); emit valueChanged(); } return *this; }
void DurationSpinBox::stepUnitUp() { //kDebug(planDbg())<<m_unit<<">"<<m_maxunit; if ( m_unit > m_maxunit ) { setUnit( static_cast<Duration::Unit>(m_unit - 1) ); // line may change length, make sure cursor stays within unit lineEdit()->setCursorPosition( lineEdit()->displayText().length() - suffix().length() ); emit unitChanged( m_unit ); } }
/** Sets the unit for the length */ void cwUnitValue::setUnit(int unit) { if(Data->Unit != unit) { if(isUpdatingValue()) { //Update the value with a new value convertToUnit(unit); } Data->Unit = unit; emit unitChanged(); } }
void EditorSession::setUnit(Unit *unit) { if (m_unit == unit) { return; } m_unit = unit; // different than above, do not directly enter phrases // but first show editing information for units setPhrase(nullptr); return unitChanged(); }
void ProcessModel::setUnit(const State::Unit& u) { if (u != unit()) { auto addr = outlet->address(); addr.qualifiers.get().unit = u; outlet->setAddress(addr); prettyNameChanged(); unitChanged(u); } }
void DurationSpinBox::setMinimumUnit( Duration::Unit unit ) { //NOTE Year = 0, Milliseconds = 7 !!! m_minunit = unit; if ( m_maxunit > unit ) { m_maxunit = unit; } if ( m_unit > unit ) { setUnit( unit ); emit unitChanged( m_unit ); } }
void DurationSpinBox::updateUnit( Duration::Unit unit ) { if ( unit < m_maxunit ) { m_unit = m_maxunit; } else if ( unit > m_minunit ) { m_unit = m_minunit; } if ( m_unit != unit ) { m_unit = unit; emit unitChanged( unit ); } }
KWStartupWidget::KWStartupWidget(QWidget *parent, KWDocument *doc, const KoColumns &columns) : QWidget(parent), m_unit(doc->unit()) { widget.setupUi(this); m_columns = columns; m_layout.leftMargin = MM_TO_POINT(30); m_layout.rightMargin = MM_TO_POINT(30); m_layout.topMargin = MM_TO_POINT(25); m_layout.bottomMargin = MM_TO_POINT(25); m_doc = doc; setFocusProxy(widget.createButton); QVBoxLayout *lay = new QVBoxLayout(widget.sizeTab); m_sizeWidget = new KoPageLayoutWidget(widget.sizeTab, m_layout); m_sizeWidget->showPageSpread(true); m_sizeWidget->setUnit(m_unit); lay->addWidget(m_sizeWidget); lay = new QVBoxLayout(widget.columnsTab); m_columnsWidget = new KWDocumentColumns(widget.columnsTab, m_columns); m_columnsWidget->setUnit(m_unit); m_columnsWidget->setShowPreview(false); lay->addWidget(m_columnsWidget); lay = new QVBoxLayout(widget.previewPane); widget.previewPane->setLayout(lay); KoPagePreviewWidget *prev = new KoPagePreviewWidget(widget.previewPane); lay->addWidget(prev); prev->setColumns(columns); prev->setPageLayout(m_layout); connect(m_sizeWidget, SIGNAL(layoutChanged(KoPageLayout)), this, SLOT(sizeUpdated(KoPageLayout))); connect(widget.createButton, SIGNAL(clicked()), this, SLOT(buttonClicked())); connect(m_sizeWidget, SIGNAL(unitChanged(KoUnit)), this, SLOT(unitChanged(KoUnit))); connect(m_columnsWidget, SIGNAL(columnsChanged(KoColumns)), prev, SLOT(setColumns(KoColumns))); connect(m_columnsWidget, SIGNAL(columnsChanged(KoColumns)), this, SLOT(columnsUpdated(KoColumns))); connect(m_sizeWidget, SIGNAL(layoutChanged(KoPageLayout)), prev, SLOT(setPageLayout(KoPageLayout))); }
void QPageSetupWidget::selectPrinter(QCUPSSupport *cups) { m_cups = cups; widget.paperSize->clear(); #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) if (m_cups && QCUPSSupport::isAvailable()) { const ppd_option_t* pageSizes = m_cups->pageSizes(); const int numChoices = pageSizes ? pageSizes->num_choices : 0; int cupsDefaultSize = 0; QSize qtPreferredSize = m_printer->paperSize(QPrinter::Point).toSize(); bool preferredSizeMatched = false; for (int i = 0; i < numChoices; ++i) { widget.paperSize->addItem(QString::fromLocal8Bit(pageSizes->choices[i].text), QByteArray(pageSizes->choices[i].choice)); if (static_cast<int>(pageSizes->choices[i].marked) == 1) cupsDefaultSize = i; if (m_printer->d_func()->hasUserSetPageSize) { QRect cupsPaperSize = m_cups->paperRect(pageSizes->choices[i].choice); QSize diff = cupsPaperSize.size() - qtPreferredSize; if (qAbs(diff.width()) < 5 && qAbs(diff.height()) < 5) { widget.paperSize->setCurrentIndex(i); preferredSizeMatched = true; } } } if (!preferredSizeMatched) widget.paperSize->setCurrentIndex(cupsDefaultSize); if (m_printer->d_func()->hasCustomPageMargins) { m_printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); } else { QByteArray cupsPaperSizeChoice = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); QRect paper = m_cups->paperRect(cupsPaperSizeChoice); QRect content = m_cups->pageRect(cupsPaperSizeChoice); m_leftMargin = content.x() - paper.x(); m_topMargin = content.y() - paper.y(); m_rightMargin = paper.right() - content.right(); m_bottomMargin = paper.bottom() - content.bottom(); } } #endif if (widget.paperSize->count() == 0) { populatePaperSizes(widget.paperSize); widget.paperSize->setCurrentIndex(widget.paperSize->findData( QLocale::system().measurementSystem() == QLocale::ImperialSystem ? QPrinter::Letter : QPrinter::A4)); } unitChanged(widget.unit->currentIndex()); m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); }
void ProcessModel::init() { outlet->setCustomData("Out"); m_outlets.push_back(outlet.get()); connect( outlet.get(), &Process::Port::addressChanged, this, [=](const State::AddressAccessor& arg) { addressChanged(arg); prettyNameChanged(); unitChanged(arg.qualifiers.get().unit); }); }
void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p) { m_cups = 0; widget.paperSize->clear(); populatePaperSizes(widget.paperSize); widget.paperSize->setCurrentIndex(widget.paperSize->findData(p->paperSize())); m_leftMargin = 90; m_topMargin = 72; m_bottomMargin = 72; m_rightMargin = 90; unitChanged(widget.unit->currentIndex()); m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); }
void KoPageLayoutWidget::setUnit(const KUnit &unit) { if (d->unit == unit) return; d->unit = unit; d->widget.width->setUnit(unit); d->widget.height->setUnit(unit); d->widget.topMargin->setUnit(unit); d->widget.bottomMargin->setUnit(unit); d->widget.bindingEdgeMargin->setUnit(unit); d->widget.pageEdgeMargin->setUnit(unit); d->widget.units->setCurrentIndex(unit.indexInList()); emit unitChanged(d->unit); }
void XYFourierFilterCurveDock::xDataColumnChanged(const QModelIndex& index) { if (m_initializing) return; AbstractAspect* aspect = static_cast<AbstractAspect*>(index.internalPointer()); AbstractColumn* column = 0; if (aspect) { column = dynamic_cast<AbstractColumn*>(aspect); Q_ASSERT(column); } foreach(XYCurve* curve, m_curvesList) dynamic_cast<XYFourierFilterCurve*>(curve)->setXDataColumn(column); // update range of cutoff spin boxes (like a unit change) unitChanged(uiGeneralTab.cbUnit->currentIndex()); unit2Changed(uiGeneralTab.cbUnit2->currentIndex()); }
BitcoinAmountField::BitcoinAmountField(QWidget *parent): QWidget(parent), amount(0), currentUnit(-1), fHasTriAngle(false) { amount = new QDoubleSpinBox(this); amount->setLocale(QLocale::c()); amount->setDecimals(8); amount->installEventFilter(this); amount->setSingleStep(0.001); unit = new QValueComboBox(this); unit->setModel(new BitcoinUnits(this)); if (parent && parent->parent() && parent->parent()->inherits("SendCoinsEntry")) { amount->setFixedSize(400, 30); ((QDoubleSpinBoxEx *)amount)->lineEdit()->setPlaceholderText("0.000000"); unit->hide(); } else { amount->setMaximumWidth(170); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(amount); layout->addWidget(unit); layout->addStretch(1); layout->setContentsMargins(0,0,0,0); setLayout(layout); } setFocusPolicy(Qt::TabFocus); setFocusProxy(amount); // If one if the widgets changes, the combined content changes as well connect(amount, SIGNAL(valueChanged(QString)), this, SIGNAL(textChanged())); connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); // Set default based on configuration unitChanged(unit->currentIndex()); }
void QPageSetupWidget::setPrinter(QPrinter *printer) { m_printer = printer; m_blockSignals = true; selectPdfPsPrinter(printer); printer->getPageMargins(&m_leftMargin, &m_topMargin, &m_rightMargin, &m_bottomMargin, QPrinter::Point); unitChanged(widget.unit->currentIndex()); m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); m_paperSize = printer->paperSize(QPrinter::Point); widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); widget.landscape->setChecked(printer->orientation() == QPrinter::Landscape); #ifdef PSD_ENABLE_PAPERSOURCE widget.paperSource->setCurrentItem(printer->paperSource()); #endif Q_ASSERT(m_blockSignals); m_blockSignals = false; _q_paperSizeChanged(); }
BitcoinAmountField::BitcoinAmountField(QWidget *parent): QWidget(parent), amount(0), decimals(0), currentUnit(-1) { amount = new QValidatedLineEdit(this); amount->setValidator(new QRegExpValidator(QRegExp("[0-9]*"), this)); amount->setAlignment(Qt::AlignRight|Qt::AlignVCenter); amount->installEventFilter(this); amount->setMaximumWidth(75); decimals = new QValidatedLineEdit(this); decimals->setValidator(new QRegExpValidator(QRegExp("[0-9]+"), this)); decimals->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); decimals->setMaximumWidth(75); QHBoxLayout *layout = new QHBoxLayout(this); layout->setSpacing(0); layout->addWidget(amount); layout->addWidget(new QLabel(QString("<b>.</b>"))); layout->addWidget(decimals); unit = new QValueComboBox(this); unit->setModel(new BitcoinUnits(this)); layout->addWidget(unit); layout->addStretch(1); layout->setContentsMargins(0,0,0,0); setLayout(layout); setFocusPolicy(Qt::TabFocus); setFocusProxy(amount); // If one if the widgets changes, the combined content changes as well connect(amount, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged())); connect(decimals, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged())); connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); // Set default based on configuration unitChanged(unit->currentIndex()); }
void GamecreditsAmountField::setSingleStep(qint64 step) { nSingleStep = step; unitChanged(unit->currentIndex()); }
KarbonView::KarbonView( KarbonPart* p, QWidget* parent ) : KoView( p, parent ), KXMLGUIBuilder( shell() ), d( new Private( p ) ) { debugView("KarbonView::KarbonView"); setComponentData( KarbonFactory::componentData(), true ); setClientBuilder( this ); if( !p->isReadWrite() ) setXMLFile( QString::fromLatin1( "karbon_readonly.rc" ) ); else setXMLFile( QString::fromLatin1( "karbon.rc" ) ); const int viewMargin = 250; d->canvas = new KarbonCanvas( p ); d->canvas->setParent( this ); d->canvas->setDocumentViewMargin( viewMargin ); connect( d->canvas->shapeManager()->selection(), SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); d->canvasController = new KoCanvasController(this); d->canvasController->setMinimumSize( QSize(viewMargin+50,viewMargin+50) ); d->canvasController->setCanvas(d->canvas); d->canvasController->setCanvasMode( KoCanvasController::Infinite ); // always show srollbars which fixes some nasty infinite // recursion when scrollbars are disabled during resizing d->canvasController->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); d->canvasController->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); d->canvasController->show(); // set up status bar message d->status = new QLabel( QString(), statusBar() ); d->status->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); d->status->setMinimumWidth( 300 ); addStatusBarItem( d->status, 1 ); connect( KoToolManager::instance(), SIGNAL(changedStatusText(const QString &)), d->status, SLOT(setText(const QString &)) ); d->cursorCoords = new QLabel( QString(), statusBar() ); d->cursorCoords->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); d->cursorCoords->setMinimumWidth( 50 ); addStatusBarItem( d->cursorCoords, 0 ); // TODO maybe the zoomHandler should be a member of the view and not the canvas. // set up the zoom controller KarbonZoomController * zoomController = new KarbonZoomController( d->canvasController, actionCollection() ); zoomController->setPageSize( d->part->document().pageSize() ); addStatusBarItem( zoomController->zoomAction()->createWidget( statusBar() ), 0 ); zoomController->setZoomMode( KoZoomMode::ZOOM_PAGE ); connect( zoomController, SIGNAL(zoomedToSelection()), this, SLOT(zoomSelection())); connect( zoomController, SIGNAL(zoomedToAll()), this, SLOT(zoomDrawing())); KarbonSmallStylePreview * smallPreview = new KarbonSmallStylePreview( statusBar() ); connect( smallPreview, SIGNAL(fillApplied()), this, SLOT(applyFillToSelection()) ); connect( smallPreview, SIGNAL(strokeApplied()), this, SLOT(applyStrokeToSelection()) ); addStatusBarItem( smallPreview, 0 ); // layout: QGridLayout *layout = new QGridLayout(); layout->setMargin(0); layout->addWidget(d->canvasController, 1, 1); initActions(); unsigned int max = part()->maxRecentFiles(); setNumberOfRecentFiles( max ); // widgets: d->horizRuler = new KoRuler( this, Qt::Horizontal, d->canvas->viewConverter() ); d->horizRuler->setShowMousePosition(true); d->horizRuler->setUnit(p->unit()); d->horizRuler->setRightToLeft(false); d->horizRuler->setVisible(false); new KoRulerController( d->horizRuler, d->canvas->resourceProvider() ); layout->addWidget( d->horizRuler, 0, 1 ); connect( p, SIGNAL( unitChanged( KoUnit ) ), this, SLOT( updateUnit( KoUnit ) ) ); d->vertRuler = new KoRuler( this, Qt::Vertical, d->canvas->viewConverter() ); d->vertRuler->setShowMousePosition(true); d->vertRuler->setUnit(p->unit()); d->vertRuler->setVisible(false); layout->addWidget( d->vertRuler, 1, 0 ); connect( d->canvas, SIGNAL(documentOriginChanged( const QPoint &)), this, SLOT(pageOffsetChanged())); connect( d->canvasController, SIGNAL(canvasOffsetXChanged(int)), this, SLOT(pageOffsetChanged())); connect( d->canvasController, SIGNAL(canvasOffsetYChanged(int)), this, SLOT(pageOffsetChanged())); connect( d->canvasController, SIGNAL(canvasMousePositionChanged(const QPoint &)), this, SLOT(mousePositionChanged(const QPoint&))); connect( d->vertRuler, SIGNAL(guideLineCreated(Qt::Orientation,int)), d->canvasController, SLOT( addGuideLine(Qt::Orientation,int) ) ); connect( d->horizRuler, SIGNAL(guideLineCreated(Qt::Orientation,int)), d->canvasController, SLOT( addGuideLine(Qt::Orientation,int) ) ); updateRuler(); if( shell() ) { KoToolManager::instance()->addController( d->canvasController ); KoToolManager::instance()->registerTools( actionCollection(), d->canvasController ); // set the first layer active d->canvasController->canvas()->shapeManager()->selection()->setActiveLayer( part()->document().layers().first() ); //Create Dockers createLayersTabDock(); KoToolBoxFactory toolBoxFactory(d->canvasController, i18n( "Tools" ) ); createDockWidget( &toolBoxFactory ); KoDockerManager *dockerMng = dockerManager(); if (!dockerMng) { dockerMng = new KoDockerManager(this); setDockerManager(dockerMng); } connect( d->canvasController, SIGNAL( toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, KoView *) ), dockerMng, SLOT( newOptionWidgets(const QMap<QString, QWidget *> &, KoView *) ) ); KoToolManager::instance()->requestToolActivation( d->canvasController ); bool b = d->showRulerAction->isChecked(); d->horizRuler->setVisible( b ); d->vertRuler->setVisible( b ); } setLayout(layout); reorganizeGUI(); setFocusPolicy(Qt::NoFocus); }
void ConstraintTypes::PlaylistFileSizeEditWidget::on_comboBox_Unit_currentIndexChanged( const int l ) { emit unitChanged( l ); emit updated(); }
void BitcoinAmountField::setSingleStep(qint64 step) { nSingleStep = step; unitChanged(unit->currentIndex()); }