As weld::SpinButton derives from weld::Entry, also let QtInstanceSpinButton derive from QtInstanceEntry, instead of duplicating code by reimplementing all of the weld::Entry methods anew. As the QtDoubleSpinBox derived from QDoubleSpinBox itself is not a subclass of QLineEdit, it cannot itself be passed down as the widget to the QtInstanceEntry ctor. Pass the spin box's QLineEdit instead. Make it available by adding a new QtDoubleSpinBox::lineEdit method which overrides the base class method of the same name that is protected. With this in place, QtInstanceSpinButton is now the only QtInstanceWidget subclass where the widget passed down to QtInstanceWidget is not the same as passed by QtInstanceBuilder in the QtInstanceSpinButton ctor, i.e. QtInstanceWidget::getQWidget does not return the QtDoubleSpinBox, but it's line edit. Therefore, make QtInstanceWidget::getQWidget virtual and override it in QtInstanceSpinButton to return the spin box. Drop the QtInstanceSpinButton methods of all methods already implemented in QtInstanceEntry. Change-Id: Ide2e1fe91216a5ec7f90a4f72ae34e3f63f624d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177449 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
21 lines
684 B
C++
21 lines
684 B
C++
/* -*- 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/.
|
|
*/
|
|
|
|
#include <QtDoubleSpinBox.hxx>
|
|
#include <QtDoubleSpinBox.moc>
|
|
|
|
QtDoubleSpinBox::QtDoubleSpinBox(QWidget* pParent)
|
|
: QDoubleSpinBox(pParent)
|
|
{
|
|
}
|
|
|
|
QLineEdit* QtDoubleSpinBox::lineEdit() const { return QDoubleSpinBox::lineEdit(); }
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|