Fix crash with clap plugins without MIDI input
[carla.git] / source / theme / CarlaStylePlugin.cpp
blob766bb2e4a9dddbde6ab9388e6b0eae69d37b0b36
1 /*
2 * Carla Style, based on Qt5 fusion style
3 * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
4 * Copyright (C) 2013-2022 Filipe Coelho <falktx@falktx.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * For a full copy of the license see the doc/LGPL.txt file
18 #include "CarlaStylePlugin.hpp"
19 #include "CarlaStyle.hpp"
21 #ifdef CARLA_OS_WIN
22 # if defined(__GNUC__) && __GNUC__ >= 8
23 # pragma GCC diagnostic push
24 # pragma GCC diagnostic ignored "-Wdeprecated-copy"
25 # endif
26 # include <QtWidgets/QApplication>
27 # if defined(__GNUC__) && __GNUC__ >= 8
28 # pragma GCC diagnostic pop
29 # endif
30 #endif
32 CarlaStylePlugin::CarlaStylePlugin(QObject* parentObj)
33 : QStylePlugin(parentObj) {}
35 QStyle* CarlaStylePlugin::create(const QString& key)
37 return (key.toLower() == "carla") ? new CarlaStyle() : nullptr;
40 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
41 QStringList CarlaStylePlugin::keys() const
43 return QStringList() << "Carla";
46 Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin)
47 #endif
49 #ifdef CARLA_OS_WIN
50 CARLA_PLUGIN_EXPORT void set_qt_app_style()
52 qApp->setStyle(new CarlaStyle());
54 #endif