KDDockWidgets API Documentation
1.5
source
src
layoutlinter_main.cpp
Go to the documentation of this file.
1
/*
2
This file is part of KDDockWidgets.
3
4
SPDX-FileCopyrightText: 2020-2022 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
26
using namespace
KDDockWidgets
;
27
28
static
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
38
KDDockWidgets::Config::self
().
setDockWidgetFactoryFunc
(dwFunc);
39
KDDockWidgets::Config::self
().
setMainWindowFactoryFunc
(mwFunc);
40
41
LayoutSaver
restorer;
42
return
restorer.
restoreFromFile
(filename);
43
}
44
45
int
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
}
KDDockWidgets::Config::setMainWindowFactoryFunc
void setMainWindowFactoryFunc(MainWindowFactoryFunc)
counter-part of DockWidgetFactoryFunc but for the main window. Should be rarely used....
Definition:
Config.cpp:126
KDDockWidgets::MainWindowFactoryFunc
KDDockWidgets::MainWindowBase *(* MainWindowFactoryFunc)(const QString &name)
Definition:
Config.h:38
KDDockWidgets::DockWidgetFactoryFunc
KDDockWidgets::DockWidgetBase *(* DockWidgetFactoryFunc)(const QString &name)
Definition:
Config.h:37
DockWidget.h
Represents a dock widget.
main
int main(int argc, char *argv[])
Definition:
layoutlinter_main.cpp:45
QList::size
int size() const const
KDDockWidgets::LayoutSaver
LayoutSaver allows to save or restore layouts.
Definition:
LayoutSaver.h:55
QApplication
QString
QList::at
const T & at(int i) const const
KDDockWidgets::LayoutSaver::restoreFromFile
bool restoreFromFile(const QString &jsonFilename)
restores the layout from a JSON file
Definition:
LayoutSaver.cpp:123
KDDockWidgets::Config::setDockWidgetFactoryFunc
void setDockWidgetFactoryFunc(DockWidgetFactoryFunc)
Registers a DockWidgetFactoryFunc.
Definition:
Config.cpp:116
Config.h
Application-wide config to tune certain behaviours of the framework.
MainWindow.h
QMainWindow sub-class to enable KDDockWidgets support.
KDDockWidgets::DockWidgetBase
The DockWidget base-class. DockWidget and DockWidgetBase are only split in two so we can share some c...
Definition:
DockWidgetBase.h:61
KDDockWidgets
Definition:
Config.cpp:36
KDDockWidgets::DockWidgetType
KDDockWidgets::DockWidget DockWidgetType
Definition:
QWidgetAdapter.h:51
KDDockWidgets::MainWindowBase
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
Definition:
MainWindowBase.h:56
QCoreApplication::arguments
QStringList arguments()
KDDockWidgets::Config::self
static Config & self()
returns the singleton Config instance
Definition:
Config.cpp:82
lint
static bool lint(const QString &filename)
Definition:
layoutlinter_main.cpp:28
KDDockWidgets::MainWindowType
KDDockWidgets::MainWindow MainWindowType
Definition:
QWidgetAdapter.h:49
© 2019-2022 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 Mon Mar 7 2022 02:01:20 for KDDockWidgets API Documentation by doxygen 1.8.20