mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Adjust KCMs to no longer do cast manually
KCModule::widget returns the widget that should be a parent for widgets the KCM creates
This commit is contained in:
parent
1c393f50d5
commit
3d0c946eef
|
@ -20,16 +20,15 @@
|
||||||
K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
|
K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
|
||||||
|
|
||||||
DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data)
|
DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data)
|
||||||
: KCModule(qobject_cast<QWidget *>(parent), data)
|
: KCModule(parent, data)
|
||||||
, m_pages()
|
, m_pages()
|
||||||
{
|
{
|
||||||
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
||||||
|
|
||||||
const auto parentWidget = qobject_cast<QWidget *>(parent);
|
QVBoxLayout *topLayout = new QVBoxLayout(widget());
|
||||||
QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
|
|
||||||
topLayout->setContentsMargins(0, 0, 0, 0);
|
topLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QTabWidget *tabWidget = new QTabWidget(parentWidget);
|
QTabWidget *tabWidget = new QTabWidget(widget());
|
||||||
|
|
||||||
// initialize 'Behavior' tab
|
// initialize 'Behavior' tab
|
||||||
BehaviorSettingsPage *behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget);
|
BehaviorSettingsPage *behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget);
|
||||||
|
|
|
@ -16,16 +16,15 @@
|
||||||
K_PLUGIN_CLASS_WITH_JSON(DolphinNavigationConfigModule, "kcmdolphinnavigation.json")
|
K_PLUGIN_CLASS_WITH_JSON(DolphinNavigationConfigModule, "kcmdolphinnavigation.json")
|
||||||
|
|
||||||
DolphinNavigationConfigModule::DolphinNavigationConfigModule(QObject *parent)
|
DolphinNavigationConfigModule::DolphinNavigationConfigModule(QObject *parent)
|
||||||
: KCModule(qobject_cast<QWidget *>(parent))
|
: KCModule(parent)
|
||||||
, m_navigation(nullptr)
|
, m_navigation(nullptr)
|
||||||
{
|
{
|
||||||
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
||||||
|
|
||||||
const auto parentWidget = qobject_cast<QWidget *>(parent);
|
QVBoxLayout *topLayout = new QVBoxLayout(widget());
|
||||||
QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
|
|
||||||
topLayout->setContentsMargins(0, 0, 0, 0);
|
topLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
m_navigation = new NavigationSettingsPage(parentWidget);
|
m_navigation = new NavigationSettingsPage(widget());
|
||||||
connect(m_navigation, &NavigationSettingsPage::changed, this, &DolphinNavigationConfigModule::markAsChanged);
|
connect(m_navigation, &NavigationSettingsPage::changed, this, &DolphinNavigationConfigModule::markAsChanged);
|
||||||
topLayout->addWidget(m_navigation, 0, {});
|
topLayout->addWidget(m_navigation, 0, {});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
#include "settings/viewmodes/viewsettingstab.h"
|
#include "settings/viewmodes/viewsettingstab.h"
|
||||||
|
|
||||||
|
#include <KCModule>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KCModule>
|
|
||||||
|
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
|
@ -21,16 +21,15 @@
|
||||||
K_PLUGIN_CLASS_WITH_JSON(DolphinViewModesConfigModule, "kcmdolphinviewmodes.json")
|
K_PLUGIN_CLASS_WITH_JSON(DolphinViewModesConfigModule, "kcmdolphinviewmodes.json")
|
||||||
|
|
||||||
DolphinViewModesConfigModule::DolphinViewModesConfigModule(QObject *parent, const KPluginMetaData &data)
|
DolphinViewModesConfigModule::DolphinViewModesConfigModule(QObject *parent, const KPluginMetaData &data)
|
||||||
: KCModule(qobject_cast<QWidget *>(parent), data)
|
: KCModule(parent, data)
|
||||||
, m_tabs()
|
, m_tabs()
|
||||||
{
|
{
|
||||||
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
|
||||||
|
|
||||||
const auto parentWidget = qobject_cast<QWidget *>(parent);
|
QVBoxLayout *topLayout = new QVBoxLayout(widget());
|
||||||
QVBoxLayout *topLayout = new QVBoxLayout(parentWidget);
|
|
||||||
topLayout->setContentsMargins(0, 0, 0, 0);
|
topLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QTabWidget *tabWidget = new QTabWidget(parentWidget);
|
QTabWidget *tabWidget = new QTabWidget(widget());
|
||||||
|
|
||||||
// Initialize 'Icons' tab
|
// Initialize 'Icons' tab
|
||||||
ViewSettingsTab *iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
|
ViewSettingsTab *iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
|
||||||
|
|
Loading…
Reference in a new issue