1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 12:49:56 +00:00
openmw-tes3mp/apps/opencs/view/settings/abstractwidget.hpp
graffy76 a8b45e0a13 Three primary changes:
1.  Declared QStringPair::isEmpty() const
2.  Split the CsSettings namespace into two: CSMSettings and
CSVSettings. (Required splitting the support.hpp file)
3.  Declared several classes as _noqt in CMakeLists.txt for OpenCS
2013-05-11 05:55:46 -05:00

64 lines
1.6 KiB
C++

#ifndef ABSTRACTWIDGET_HPP
#define ABSTRACTWIDGET_HPP
#include <QWidget>
#include "support.hpp"
class QLayout;
namespace CSVSettings
{
class AbstractWidget : public QObject
{
Q_OBJECT
QLayout *mLayout;
public:
explicit AbstractWidget (QLayout *layout = 0, QWidget* parent = 0)
: QObject (parent), mLayout (layout)
{}
//retrieve layout for insertion into itemblock
QLayout *getLayout();
//create the derived widget instance
void build (QWidget* widget, WidgetDef &def, bool noLabel = false);
//reference to the derived widget instance
virtual QWidget *widget() = 0;
protected:
//called by inbound signal for type-specific widget udpates
virtual void updateWidget (const QString &value) = 0;
//converts user-defined enum to Qt equivalents
QFlags<Qt::AlignmentFlag> getAlignment (OcsAlignment flag);
private:
//widget initialization utilities
void createLayout (OcsWidgetOrientation direction, bool isZeroMargin);
void buildLabelAndWidget (QWidget *widget, WidgetDef &def, bool noLabel);
signals:
//outbound update
void signalUpdateItem (const QString &value);
public slots:
//inbound updates
void slotUpdateWidget (const QString &value);
//Outbound updates from derived widget signal
void slotUpdateItem (const QString &value);
void slotUpdateItem (bool value);
void slotUpdateItem (int value);
void slotUpdateItem (QListWidgetItem* current, QListWidgetItem* previous);
};
}
#endif // ABSTRACTWIDGET_HPP