File indexing completed on 2024-05-12 16:33:31
0001 /* This file is part of the KDE project 0002 0003 Copyright 2018 Dag Andersen <danders@get2net.dk> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 0022 #include "ConfigSubWidgetBase.h" 0023 0024 using namespace KoChart; 0025 0026 ConfigSubWidgetBase::ConfigSubWidgetBase(QWidget *parent) 0027 : QWidget(parent) 0028 , chart(0) 0029 { 0030 0031 } 0032 0033 ConfigSubWidgetBase::ConfigSubWidgetBase(QList<ChartType> types, QWidget *parent) 0034 : QWidget(parent) 0035 , chart(0) 0036 , chartTypes(types) 0037 { 0038 0039 } 0040 0041 ConfigSubWidgetBase::~ConfigSubWidgetBase() 0042 { 0043 0044 } 0045 0046 void ConfigSubWidgetBase::setChartTypes(QList<ChartType> types) 0047 { 0048 chartTypes = types; 0049 } 0050 0051 void ConfigSubWidgetBase::open(ChartShape *shape) 0052 { 0053 chart = shape; 0054 if (chart) { 0055 connect(chart, &ChartShape::chartTypeChanged, this, &ConfigSubWidgetBase::removeSubDialogs); 0056 } 0057 } 0058 0059 void ConfigSubWidgetBase::deactivate() 0060 { 0061 if (chart) { 0062 deleteSubDialogs(); 0063 disconnect(chart, &ChartShape::chartTypeChanged, this, &ConfigSubWidgetBase::removeSubDialogs); 0064 } 0065 } 0066 0067 void ConfigSubWidgetBase::deleteSubDialogs(ChartType type) 0068 { 0069 Q_UNUSED(type) 0070 } 0071 0072 void ConfigSubWidgetBase::updateData(ChartType type, ChartSubtype subtype) 0073 { 0074 Q_UNUSED(type) 0075 Q_UNUSED(subtype) 0076 } 0077 0078 void ConfigSubWidgetBase::blockSignals(bool block) 0079 { 0080 blockSignals(this, block); 0081 } 0082 0083 void ConfigSubWidgetBase::blockSignals(QWidget *w, bool block) 0084 { 0085 QList<QWidget*> lst = w->findChildren<QWidget*>(); 0086 for (int i = 0; i < lst.count(); ++i) { 0087 lst.at(i)->blockSignals(block); 0088 } 0089 } 0090 0091 void ConfigSubWidgetBase::removeSubDialogs(ChartType type, ChartType prev) 0092 { 0093 if (type != prev) { 0094 deleteSubDialogs(); 0095 } 0096 }