Add initial version of the Plugin Container, which prevents plugins from resizing the window unless shown
parent
30623b36fd
commit
dd4865c3e0
@ -0,0 +1,32 @@
|
||||
#include "OpenRGBPluginContainer.h"
|
||||
#include "ui_OpenRGBPluginContainer.h"
|
||||
|
||||
Ui::OpenRGBPluginContainer::OpenRGBPluginContainer(QWidget *plugin, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBPluginContainerUi)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
plugin_widget = plugin;
|
||||
|
||||
ui->PluginContainerLayout->layout()->addWidget(plugin_widget);
|
||||
|
||||
plugin_widget->hide();
|
||||
}
|
||||
|
||||
Ui::OpenRGBPluginContainer::~OpenRGBPluginContainer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Ui::OpenRGBPluginContainer::on_ShowPluginButton_clicked()
|
||||
{
|
||||
if(plugin_widget->isHidden())
|
||||
{
|
||||
plugin_widget->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin_widget->hide();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
#ifndef OPENRGBPLUGINCONTAINER_H
|
||||
#define OPENRGBPLUGINCONTAINER_H
|
||||
|
||||
#include "ui_OpenRGBPluginContainer.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBPluginContainer;
|
||||
}
|
||||
|
||||
class Ui::OpenRGBPluginContainer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBPluginContainer(QWidget *plugin, QWidget *parent = nullptr);
|
||||
~OpenRGBPluginContainer();
|
||||
|
||||
private slots:
|
||||
void on_ShowPluginButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBPluginContainerUi *ui;
|
||||
QWidget* plugin_widget;
|
||||
};
|
||||
|
||||
#endif // OPENRGBPLUGINCONTAINER_H
|
||||
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBPluginContainerUi</class>
|
||||
<widget class="QWidget" name="OpenRGBPluginContainerUi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="PluginContainerLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ShowPluginButton">
|
||||
<property name="text">
|
||||
<string>Show/Hide Plugin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue