KDDockWidgets API Documentation 1.7
Loading...
Searching...
No Matches
layoutlinter_main.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#include "Config.h"
13
14#ifdef KDDOCKWIDGETS_QTQUICK
15#include "private/quick/DockWidgetQuick.h"
16#include "private/quick/MainWindowQuick_p.h"
17#else
18#include "DockWidget.h"
19#include "MainWindow.h"
20#endif
21
22#include <QApplication>
23#include <QDebug>
24#include <QString>
25
26using namespace KDDockWidgets;
27
28static bool lint(const QString &filename)
29{
30 DockWidgetFactoryFunc dwFunc = [](const QString &dwName) {
31 return static_cast<DockWidgetBase *>(new DockWidgetType(dwName));
32 };
33
34 MainWindowFactoryFunc mwFunc = [](const QString &dwName) {
35 return static_cast<MainWindowBase *>(new MainWindowType(dwName));
36 };
37
40
41 LayoutSaver restorer;
42 return restorer.restoreFromFile(filename);
43}
44
45int main(int argc, char *argv[])
46{
47 QApplication app(argc, argv);
48
49 if (app.arguments().size() != 2) {
50 qDebug() << "Usage: kddockwidgets_linter <layout json file>";
51 return 1;
52 }
53
54 return lint(app.arguments().at(1)) ? 0 : 2;
55}
Application-wide config to tune certain behaviours of the framework.
Represents a dock widget.
QMainWindow sub-class to enable KDDockWidgets support.
void setDockWidgetFactoryFunc(DockWidgetFactoryFunc)
Registers a DockWidgetFactoryFunc.
Definition Config.cpp:118
static Config & self()
returns the singleton Config instance
Definition Config.cpp:84
void setMainWindowFactoryFunc(MainWindowFactoryFunc)
counter-part of DockWidgetFactoryFunc but for the main window. Should be rarely used....
Definition Config.cpp:128
The DockWidget base-class. DockWidget and DockWidgetBase are only split in two so we can share some c...
LayoutSaver allows to save or restore layouts.
Definition LayoutSaver.h:55
bool restoreFromFile(const QString &jsonFilename)
restores the layout from a JSON file
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
int main(int argc, char *argv[])
static bool lint(const QString &filename)
KDDockWidgets::MainWindowBase *(* MainWindowFactoryFunc)(const QString &name)
Definition Config.h:40
KDDockWidgets::DockWidget DockWidgetType
KDDockWidgets::MainWindow MainWindowType
KDDockWidgets::DockWidgetBase *(* DockWidgetFactoryFunc)(const QString &name)
Definition Config.h:39
QStringList arguments()
const T & at(int i) const const
int size() const const

© 2019-2023 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated on Wed Nov 1 2023 00:02:31 for KDDockWidgets API Documentation by doxygen 1.9.8