examples: Move custom_titlebar code into kddockwidgets_example
Guarded with a command line switch, no need to have two examples
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "MyWidget.h"
|
||||
#include "MyMainWindow.h"
|
||||
#include "MyFrameworkWidgetFactory.h"
|
||||
|
||||
#include <kddockwidgets/Config.h>
|
||||
|
||||
@@ -45,11 +46,12 @@ int main(int argc, char **argv)
|
||||
|
||||
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
|
||||
|
||||
QCommandLineOption customStyle("p", QCoreApplication::translate("main", "Shows how to style framework internals via FrameworkWidgetFactory"));
|
||||
parser.addOption(customStyle);
|
||||
|
||||
QCommandLineOption noTitleBars("t", QCoreApplication::translate("main", "Never show titlebars"));
|
||||
parser.addOption(noTitleBars);
|
||||
|
||||
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
QCommandLineOption noCentralFrame("c", QCoreApplication::translate("main", "No central frame"));
|
||||
parser.addOption(noCentralFrame);
|
||||
@@ -57,6 +59,13 @@ int main(int argc, char **argv)
|
||||
|
||||
parser.process(app);
|
||||
|
||||
if (parser.isSet(customStyle)) {
|
||||
Config::self().setFrameworkWidgetFactory(new CustomWidgetFactory()); // Sets our custom factory
|
||||
|
||||
// Increase the separator size, just for demo
|
||||
Config::self().setSeparatorThickness(10, /*static=*/ false);
|
||||
}
|
||||
|
||||
MainWindowOptions options = MainWindowOption_None;
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
options = parser.isSet(noCentralFrame) ? MainWindowOption_None
|
||||
|
||||
Reference in New Issue
Block a user