/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// While QtInstanceEntry generally takes care of handling signals // for the spinbox's QLineEdit, this doesn't work when the value // is changed as a result of setting a new spinbox value (e.g. // by using the spinbox buttons), as the QLineEdit signals are blocked // then, see QAbstractSpinBoxPrivate::updateEdit in qtbase: // https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qabstractspinbox.cpp?id=ced47a590aeb85953a16eaf362887f14c2815c45#n1790 // Therefore, connect the QDoubleSpinBox::textChanged signal // to the slot that calls signal_changed() instead to ensure // it gets called nonetheless, and disconnect from the other signal.
disconnect(pSpinBox->lineEdit(), &QLineEdit::textChanged, this, nullptr);
connect(m_pSpinBox, &QDoubleSpinBox::textChanged, this,
&QtInstanceSpinButton::handleTextChanged);
// set functions to convert between value and formatted text
m_pSpinBox->setFormatValueFunction([this](double fValue) { return formatValue(fValue); });
m_pSpinBox->setParseTextFunction([this](const QString& rText, double* pResult) { return parse_text(toOUString(rText), pResult);
});
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.