KDDockWidgets API Documentation
1.7
Loading...
Searching...
No Matches
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-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
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
}
Config.h
Application-wide config to tune certain behaviours of the framework.
DockWidget.h
Represents a dock widget.
MainWindow.h
QMainWindow sub-class to enable KDDockWidgets support.
KDDockWidgets::Config::setDockWidgetFactoryFunc
void setDockWidgetFactoryFunc(DockWidgetFactoryFunc)
Registers a DockWidgetFactoryFunc.
Definition
Config.cpp:118
KDDockWidgets::Config::self
static Config & self()
returns the singleton Config instance
Definition
Config.cpp:84
KDDockWidgets::Config::setMainWindowFactoryFunc
void setMainWindowFactoryFunc(MainWindowFactoryFunc)
counter-part of DockWidgetFactoryFunc but for the main window. Should be rarely used....
Definition
Config.cpp:128
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::LayoutSaver
LayoutSaver allows to save or restore layouts.
Definition
LayoutSaver.h:55
KDDockWidgets::LayoutSaver::restoreFromFile
bool restoreFromFile(const QString &jsonFilename)
restores the layout from a JSON file
Definition
LayoutSaver.cpp:133
KDDockWidgets::MainWindowBase
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
Definition
MainWindowBase.h:56
main
int main(int argc, char *argv[])
Definition
layoutlinter_main.cpp:45
lint
static bool lint(const QString &filename)
Definition
layoutlinter_main.cpp:28
KDDockWidgets
Definition
Config.cpp:37
KDDockWidgets::MainWindowFactoryFunc
KDDockWidgets::MainWindowBase *(* MainWindowFactoryFunc)(const QString &name)
Definition
Config.h:40
KDDockWidgets::DockWidgetType
KDDockWidgets::DockWidget DockWidgetType
Definition
QWidgetAdapter.h:51
KDDockWidgets::MainWindowType
KDDockWidgets::MainWindow MainWindowType
Definition
QWidgetAdapter.h:49
KDDockWidgets::DockWidgetFactoryFunc
KDDockWidgets::DockWidgetBase *(* DockWidgetFactoryFunc)(const QString &name)
Definition
Config.h:39
QApplication
QCoreApplication::arguments
QStringList arguments()
QList::at
const T & at(int i) const const
QList::size
int size() const const
QString
© 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