Mercurial > bellaciao
diff layout_view.h @ 10:877a005c2b42
Layout designer: WidgetView class, with two types: WidgetViewItem and WidgetViewBox which contains items.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 26 Aug 2011 15:58:46 +0200 |
parents | 0d7875c26974 |
children |
line wrap: on
line diff
--- a/layout_view.h Fri Aug 26 12:15:21 2011 +0200 +++ b/layout_view.h Fri Aug 26 15:58:46 2011 +0200 @@ -25,11 +25,30 @@ #define LAYOUT_WIDGET_MIME "application/x-bellaciao-widget" -class WidgetView : public QLabel +typedef enum +{ + HORIZONTAL, VERTICAL +} LayoutDirection; + +class WidgetView +{ + public: + WidgetView(const QString& name); + ~WidgetView(); +}; + +class WidgetViewItem : public QLabel, public WidgetView { Q_OBJECT public: - WidgetView(const QString& name); + WidgetViewItem(const QString& name); +}; + +class WidgetViewBox : public QScrollArea, public WidgetView +{ + Q_OBJECT + public: + WidgetViewBox(const QString& name); }; class LayoutView : public QWidget @@ -37,7 +56,7 @@ Q_OBJECT public: - LayoutView(QWidget* parent=0); + LayoutView(QWidget* parent = 0, LayoutDirection direction = VERTICAL); ~LayoutView(); void setLayoutWidgets(const QHash<QString, LayoutWidget*>& layout_widgets); void dragEnterEvent (QDragEnterEvent* event ); @@ -50,8 +69,10 @@ private: QHash<QString, LayoutWidget*> m_layout_widgets; QList<LayoutWidget> m_widgets_list; - QVBoxLayout* m_layout; + QBoxLayout* m_layout; QRect m_loc_hint; int m_insert_pos; //position in the layout when a widget must be inserted + LayoutDirection m_direction; }; + #endif