[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Fri Sep 7 22:21:38 CEST 2007


SVN commit 709565 by treat:

* Add layout options to dialog.  Can now specify
the spacing and margin.
* Reformat a few classes to fit style.


 M  +9 -9      filltab.h  
 A             layouttab.cpp   [License: GPL (v2+)]
 A             layouttab.h   [License: GPL (v2+)]
 A             layouttab.ui  
 M  +3 -0      libkstapp.pro  
 M  +15 -15    stroketab.h  
 M  +40 -0     viewitemdialog.cpp  
 M  +4 -0      viewitemdialog.h  


--- branches/work/kst/portto4/kst/src/libkstapp/filltab.h #709564:709565
@@ -21,18 +21,18 @@
 
 class KST_EXPORT FillTab : public DialogTab, Ui::FillTab {
   Q_OBJECT
-public:
-  FillTab(QWidget *parent = 0);
-  virtual ~FillTab();
+  public:
+    FillTab(QWidget *parent = 0);
+    virtual ~FillTab();
 
-  QColor color() const;
-  void setColor(const QColor &color);
+    QColor color() const;
+    void setColor(const QColor &color);
 
-  Qt::BrushStyle style() const;
-  void setStyle(Qt::BrushStyle style);
+    Qt::BrushStyle style() const;
+    void setStyle(Qt::BrushStyle style);
 
-  QGradient gradient() const;
-  void setGradient(const QGradient &gradient);
+    QGradient gradient() const;
+    void setGradient(const QGradient &gradient);
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #709564:709565
@@ -37,6 +37,7 @@
     graphicsfactory.cpp \
     labelitem.cpp \
     labelrenderer.cpp \
+    layouttab.cpp \
     lineitem.cpp \
     mainwindow.cpp \
     matrixmodel.cpp \
@@ -80,6 +81,7 @@
     graphicsfactory.h \
     labelitem.h \
     labelrenderer.h \
+    layouttab.h \
     lineitem.h \
     mainwindow.h \
     matrixmodel.h \
@@ -111,6 +113,7 @@
     debugdialog.ui \
     exportgraphicsdialog.ui \
     filltab.ui \
+    layouttab.ui \
     stroketab.ui \
     vectoreditordialog.ui \
     viewmanager.ui
--- branches/work/kst/portto4/kst/src/libkstapp/stroketab.h #709564:709565
@@ -21,27 +21,27 @@
 
 class KST_EXPORT StrokeTab : public DialogTab, Ui::StrokeTab {
   Q_OBJECT
-public:
-  StrokeTab(QWidget *parent = 0);
-  virtual ~StrokeTab();
+  public:
+    StrokeTab(QWidget *parent = 0);
+    virtual ~StrokeTab();
 
-  Qt::PenStyle style() const;
-  void setStyle(Qt::PenStyle style);
+    Qt::PenStyle style() const;
+    void setStyle(Qt::PenStyle style);
 
-  qreal width() const;
-  void setWidth(qreal width);
+    qreal width() const;
+    void setWidth(qreal width);
 
-  QColor brushColor() const;
-  void setBrushColor(const QColor &color);
+    QColor brushColor() const;
+    void setBrushColor(const QColor &color);
 
-  Qt::BrushStyle brushStyle() const;
-  void setBrushStyle(Qt::BrushStyle style);
+    Qt::BrushStyle brushStyle() const;
+    void setBrushStyle(Qt::BrushStyle style);
 
-  Qt::PenJoinStyle joinStyle() const;
-  void setJoinStyle(Qt::PenJoinStyle style);
+    Qt::PenJoinStyle joinStyle() const;
+    void setJoinStyle(Qt::PenJoinStyle style);
 
-  Qt::PenCapStyle capStyle() const;
-  void setCapStyle(Qt::PenCapStyle style);
+    Qt::PenCapStyle capStyle() const;
+    void setCapStyle(Qt::PenCapStyle style);
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #709564:709565
@@ -14,7 +14,9 @@
 #include "viewitem.h"
 #include "filltab.h"
 #include "stroketab.h"
+#include "layouttab.h"
 #include "dialogpage.h"
+#include "viewgridlayout.h"
 
 #include <QPen>
 #include <QBrush>
@@ -29,13 +31,16 @@
 
   _fillTab = new FillTab(this);
   _strokeTab = new StrokeTab(this);
+  _layoutTab = new LayoutTab(this);
   connect(_fillTab, SIGNAL(apply()), this, SLOT(fillChanged()));
   connect(_strokeTab, SIGNAL(apply()), this, SLOT(strokeChanged()));
+  connect(_layoutTab, SIGNAL(apply()), this, SLOT(layoutChanged()));
 
   DialogPage *page = new DialogPage(this);
   page->setPageTitle(tr("Appearance"));
   page->addDialogTab(_fillTab);
   page->addDialogTab(_strokeTab);
+  page->addDialogTab(_layoutTab);
   addDialogPage(page);
 
   QList<DialogPage*> dialogPages = _item->dialogPages();
@@ -44,6 +49,7 @@
 
   setupFill();
   setupStroke();
+  setupLayout();
 }
 
 
@@ -83,6 +89,22 @@
 }
 
 
+void ViewItemDialog::setupLayout() {
+  Q_ASSERT(_item);
+  ViewGridLayout *layout = _item->layout();
+
+  if (!layout) {
+    _layoutTab->setEnabled(false);
+    return;
+  }
+
+  _layoutTab->setHorizontalMargin(layout->margin().width());
+  _layoutTab->setVerticalMargin(layout->margin().height());
+  _layoutTab->setHorizontalSpacing(layout->spacing().width());
+  _layoutTab->setVerticalSpacing(layout->spacing().height());
+}
+
+
 void ViewItemDialog::fillChanged() {
   QBrush b = _item->brush();
 
@@ -119,6 +141,24 @@
   _item->setPen(p);
 }
 
+
+void ViewItemDialog::layoutChanged() {
+  Q_ASSERT(_item);
+  ViewGridLayout *layout = _item->layout();
+
+  if (!layout) {
+    _layoutTab->setEnabled(false);
+    return;
+  }
+
+  layout->setMargin(QSizeF(_layoutTab->horizontalMargin(),
+                              _layoutTab->verticalMargin()));
+  layout->setSpacing(QSizeF(_layoutTab->horizontalSpacing(),
+                               _layoutTab->verticalSpacing()));
+  layout->update();
 }
 
+
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.h #709564:709565
@@ -23,6 +23,7 @@
 class ViewItem;
 class FillTab;
 class StrokeTab;
+class LayoutTab;
 
 class KST_EXPORT ViewItemDialog : public Dialog
 {
@@ -34,15 +35,18 @@
   private Q_SLOTS:
     void fillChanged();
     void strokeChanged();
+    void layoutChanged();
 
   private:
     void setupFill();
     void setupStroke();
+    void setupLayout();
 
   private:
     QPointer<ViewItem> _item;
     FillTab *_fillTab;
     StrokeTab *_strokeTab;
+    LayoutTab *_layoutTab;
 };
 
 }


More information about the Kst mailing list