62 lines
2.1 KiB
C++
Raw Normal View History

2019-06-20 12:02:28 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
2017-07-25 07:24:27 +02:00
#include "MainWindow.h"
2017-07-25 21:34:27 +02:00
#include "SkinFactory.h"
2017-07-25 07:24:27 +02:00
2018-08-03 08:15:28 +02:00
#include <QskSetup.h>
#include <QskShortcutMap.h>
#include <QskSkinManager.h>
2017-07-25 07:24:27 +02:00
#include <SkinnyShortcut.h>
#include <QGuiApplication>
2017-07-26 13:21:10 +02:00
#include <iostream>
using namespace std;
2017-07-25 07:24:27 +02:00
2017-07-25 10:47:40 +02:00
int main( int argc, char** argv )
2017-07-25 07:24:27 +02:00
{
auto skinFactory = new SkinFactory();
qskSkinManager->setPluginPaths( QStringList() ); // no plugins
qskSkinManager->registerFactory(
QStringLiteral( "SampleSkinFactory" ), skinFactory );
2017-07-25 07:24:27 +02:00
QGuiApplication app( argc, argv );
2017-07-25 07:24:27 +02:00
/*
When going over QPainter for the SVGs we prefer the raster paint
engine, simply showing better results. Interestingly the OpenGL paint
engine was even slower for the use case of non-complex SVGs.
Looks like its tesselation is not much faster than "pixeling"
those images directly.
*/
qskSetup->setControlFlag( QskSetup::PreferRasterForTextures, true );
// Starting with a simple skin made for this example
// CTRL-S allow to rotate through the registered skins and CTRL-T
// changes the colors, when the DefaultSkin is active.
qskSetup->setSkin( QStringLiteral( "DefaultSkin" ) );
2017-07-25 07:24:27 +02:00
2017-07-26 13:21:10 +02:00
cout << "CTRL-S to change the skin." << endl;
cout << "CTRL-T to change the color scheme, when the \"Default\" skin is active." << endl;
2017-07-25 21:34:27 +02:00
QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_T ),
false, skinFactory, SLOT(toggleScheme()) );
2017-07-25 21:34:27 +02:00
QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ),
false, skinFactory, SLOT(rotateSkin()) );
2017-07-25 07:24:27 +02:00
2017-07-26 13:21:10 +02:00
// With CTRL-B you can rotate a couple of visual debug modes
SkinnyShortcut::enable( SkinnyShortcut::DebugBackground |
2017-07-26 13:21:10 +02:00
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
2017-07-25 07:24:27 +02:00
MainWindow mainWindow;
mainWindow.show();
2017-07-25 10:47:40 +02:00
2017-07-25 07:24:27 +02:00
return app.exec();
}