changeset 162:4bbd9f3d9add

a few fixes
author mwarning
date Wed, 17 Jun 2009 22:40:56 +0000
parents 849b66609571
children ab01453c9d56
files demos/shared/arthurstyle.d demos/shared/arthurwidgets.d demos/shared/hoverpoints.d demos/shared/images/bg_pattern.png demos/shared/images/button_normal_cap_left.png demos/shared/images/button_normal_cap_right.png demos/shared/images/button_normal_stretch.png demos/shared/images/button_pressed_cap_left.png demos/shared/images/button_pressed_cap_right.png demos/shared/images/button_pressed_stretch.png demos/shared/images/curve_thing_edit-6.png demos/shared/images/frame_bottom.png demos/shared/images/frame_bottomleft.png demos/shared/images/frame_bottomright.png demos/shared/images/frame_left.png demos/shared/images/frame_right.png demos/shared/images/frame_top.png demos/shared/images/frame_topleft.png demos/shared/images/frame_topright.png demos/shared/images/groupframe_bottom_left.png demos/shared/images/groupframe_bottom_right.png demos/shared/images/groupframe_bottom_stretch.png demos/shared/images/groupframe_left_stretch.png demos/shared/images/groupframe_right_stretch.png demos/shared/images/groupframe_top_stretch.png demos/shared/images/groupframe_topleft.png demos/shared/images/groupframe_topright.png demos/shared/images/line_dash_dot.png demos/shared/images/line_dash_dot_dot.png demos/shared/images/line_dashed.png demos/shared/images/line_dotted.png demos/shared/images/line_solid.png demos/shared/images/radiobutton-off.png demos/shared/images/radiobutton-on.png demos/shared/images/radiobutton_off.png demos/shared/images/radiobutton_on.png demos/shared/images/slider_bar.png demos/shared/images/slider_thumb_off.png demos/shared/images/slider_thumb_on.png demos/shared/images/title_cap_left.png demos/shared/images/title_cap_right.png demos/shared/images/title_stretch.png demos/shared/shared.qrc
diffstat 43 files changed, 65 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/demos/shared/arthurstyle.d	Wed Jun 17 22:39:42 2009 +0000
+++ b/demos/shared/arthurstyle.d	Wed Jun 17 22:40:56 2009 +0000
@@ -38,21 +38,22 @@
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
+module arthurstyle;
 
 
-//import arthurwidgets;
 import
-    qt.gui.QLayout,
-    qt.gui.QWindowsStyle,
-    qt.gui.QPainter,
-    qt.gui.QPainterPath,
-    qt.gui.QPixmapCache,
-    qt.gui.QRadioButton,
-    qt.gui.QPushButton,
-    qt.gui.QGroupBox,
-    qt.gui.QLinearGradient,
-    qt.gui.QstyleOptionFrameV2,
-    qt.gui.QStyleOption;
+	qt.gui.QLayout,
+	qt.gui.QWindowsStyle,
+	qt.gui.QPainter,
+	qt.gui.QPainterPath,
+	qt.gui.QPixmapCache,
+	qt.gui.QRadioButton,
+	qt.gui.QPushButton,
+	qt.gui.QGroupBox,
+	qt.gui.QLinearGradient,
+	qt.gui.QStyleOption,
+	qt.gui.QStyleOptionFrameV2;
+
 
 class ArthurStyle : QWindowsStyle
 {
@@ -74,13 +75,12 @@
     {
         //Q_INIT_RESOURCE(shared);
     }
-
-
+    
     void drawHoverRect(QPainter painter, QRect r)
     {
         qreal h = r.height();
         qreal h2 = r.height() / 2.0;
-        QPainterPath path;
+        QPainterPath path = new QPainterPath;
         path.addRect(r.x() + h2, r.y() + 0, r.width() - h2 * 2, r.height());
         path.addEllipse(r.x(), r.y(), h, h);
         path.addEllipse(r.x() + r.width() - h, r.y(), h, h);
@@ -91,9 +91,7 @@
         painter.drawPath(path);
     }
 
-
-    override void drawPrimitive(PrimitiveElement element, QStyleOption option,
-                                QPainter painter, QWidget widget)
+    override void drawPrimitive(PrimitiveElement element, QStyleOption option, QPainter painter, QWidget widget)
     {
         assert(option);
         switch (element)
@@ -153,7 +151,7 @@
                     mid = cached(":res/images/button_normal_stretch.png");
                 }
                 painter.drawPixmap(button.rect.topLeft, left);
-                painter.drawTiledPixmap(new QRect(button.rect.x + left.width,
+                painter.drawTiledPixmap(QRect(button.rect.x + left.width,
                                                button.rect.y,
                                                button.rect.width - left.width - right.width,
                                                left.height),
@@ -168,8 +166,7 @@
             break;
 
         case PE_FrameGroupBox:
-            if (QStyleOptionFrameV2 group
-                    = cast(QStyleOptionFrameV2)(option)) {
+            if (QStyleOptionFrameV2 group = cast(QStyleOptionFrameV2)(option)) {
                 auto r = group.rect;
 
                 painter.save();
@@ -201,11 +198,9 @@
 
                 int topFrameOffset = titleStretch.height()/2 - 2;
                 painter.drawPixmap(r.topLeft() + QPoint(0, topFrameOffset), topLeft);
-                painter.drawPixmap(r.topRight() - QPoint(topRight.width()-1, 0)
-                                    + QPoint(0, topFrameOffset), topRight);
+                painter.drawPixmap(r.topRight() - QPoint(topRight.width()-1, 0) + QPoint(0, topFrameOffset), topRight);
                 painter.drawPixmap(r.bottomLeft() - QPoint(0, bottomLeft.height()-1), bottomLeft);
-                painter.drawPixmap(r.bottomRight() - QPoint(bottomRight.width()-1,
-                                    bottomRight.height()-1), bottomRight);
+                painter.drawPixmap(r.bottomRight() - QPoint(bottomRight.width()-1, bottomRight.height()-1), bottomRight);
 
                 QRect left = r;
                 left.setY(r.y() + topLeft.height() + topFrameOffset);
@@ -224,8 +219,7 @@
                 right.setX(r.right() - rightStretch.width()+1);
                 right.setY(r.y() + topRight.height() + topFrameOffset);
                 right.setWidth(rightStretch.width());
-                right.setHeight(r.height() - topRight.height()
-                                - bottomRight.height() - topFrameOffset);
+                right.setHeight(r.height() - topRight.height() - bottomRight.height() - topFrameOffset);
                 painter.drawTiledPixmap(right, rightStretch);
 
                 QRect bottom = r;
@@ -264,7 +258,7 @@
 
                 if ((option.subControls & SC_SliderGroove) && groove.isValid()) {
                     QPixmap grv = cached(":res/images/slider_bar.png");
-                    painter.drawPixmap(new QRect(groove.x() + 5, groove.y(),
+                    painter.drawPixmap(QRect(groove.x() + 5, groove.y(),
                                               groove.width() - 10, grv.height()),
                                         grv);
                 }
@@ -344,7 +338,7 @@
                     QPixmap titleRight = cached(":res/images/title_cap_right.png");
                     QPixmap titleStretch = cached(":res/images/title_stretch.png");
                     int txt_width = group.fontMetrics.width(group.text) + 20;
-                    rect = new QRect(group.rect.center().x() - txt_width/2 + titleLeft.width(), 0,
+                    rect = QRect(group.rect.center().x() - txt_width/2 + titleLeft.width(), 0,
                                  txt_width - titleLeft.width() - titleRight.width(),
                                  titleStretch.height());
                     break;
@@ -398,7 +392,7 @@
     override void polish(QWidget widget)
     {
         if (widget.layout() && cast(QGroupBox)(widget)) {
-            if (widget.findChildren!(QGroupBox).length == 0) {
+            if (qFindChildren!(QGroupBox)(widget).length == 0) {
                 widget.layout().setWidgetSpacing(0); // Why setSpacing was renamed to setWidgetSpacing?
                 widget.layout().setMargin(12);
             } else {
@@ -417,7 +411,6 @@
             pal.setColor(QPalette.Window, new QColor(241, 241, 241));
             widget.setPalette(pal);
         }
-
     }
 
     override void unpolish(QWidget widget)
--- a/demos/shared/arthurwidgets.d	Wed Jun 17 22:39:42 2009 +0000
+++ b/demos/shared/arthurwidgets.d	Wed Jun 17 22:40:56 2009 +0000
@@ -38,6 +38,7 @@
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
+module arthurwidgets;
 
 
 import qt.core.QFile,
@@ -48,7 +49,6 @@
     qt.gui.QTextDocument,
     qt.gui.QAbstractTextDocumentLayout,
     qt.gui.QLinearGradient,
-
     qt.gui.QTextBrowser,
     qt.gui.QBoxLayout,
     qt.opengl.QGL,
--- a/demos/shared/hoverpoints.d	Wed Jun 17 22:39:42 2009 +0000
+++ b/demos/shared/hoverpoints.d	Wed Jun 17 22:40:56 2009 +0000
@@ -38,6 +38,7 @@
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
+module hoverpoints;
 
 version (QT_OPENGL_SUPPORT)
     import qt.opengl.QGLWidget;
Binary file demos/shared/images/bg_pattern.png has changed
Binary file demos/shared/images/button_normal_cap_left.png has changed
Binary file demos/shared/images/button_normal_cap_right.png has changed
Binary file demos/shared/images/button_normal_stretch.png has changed
Binary file demos/shared/images/button_pressed_cap_left.png has changed
Binary file demos/shared/images/button_pressed_cap_right.png has changed
Binary file demos/shared/images/button_pressed_stretch.png has changed
Binary file demos/shared/images/curve_thing_edit-6.png has changed
Binary file demos/shared/images/frame_bottom.png has changed
Binary file demos/shared/images/frame_bottomleft.png has changed
Binary file demos/shared/images/frame_bottomright.png has changed
Binary file demos/shared/images/frame_left.png has changed
Binary file demos/shared/images/frame_right.png has changed
Binary file demos/shared/images/frame_top.png has changed
Binary file demos/shared/images/frame_topleft.png has changed
Binary file demos/shared/images/frame_topright.png has changed
Binary file demos/shared/images/groupframe_bottom_left.png has changed
Binary file demos/shared/images/groupframe_bottom_right.png has changed
Binary file demos/shared/images/groupframe_bottom_stretch.png has changed
Binary file demos/shared/images/groupframe_left_stretch.png has changed
Binary file demos/shared/images/groupframe_right_stretch.png has changed
Binary file demos/shared/images/groupframe_top_stretch.png has changed
Binary file demos/shared/images/groupframe_topleft.png has changed
Binary file demos/shared/images/groupframe_topright.png has changed
Binary file demos/shared/images/line_dash_dot.png has changed
Binary file demos/shared/images/line_dash_dot_dot.png has changed
Binary file demos/shared/images/line_dashed.png has changed
Binary file demos/shared/images/line_dotted.png has changed
Binary file demos/shared/images/line_solid.png has changed
Binary file demos/shared/images/radiobutton-off.png has changed
Binary file demos/shared/images/radiobutton-on.png has changed
Binary file demos/shared/images/radiobutton_off.png has changed
Binary file demos/shared/images/radiobutton_on.png has changed
Binary file demos/shared/images/slider_bar.png has changed
Binary file demos/shared/images/slider_thumb_off.png has changed
Binary file demos/shared/images/slider_thumb_on.png has changed
Binary file demos/shared/images/title_cap_left.png has changed
Binary file demos/shared/images/title_cap_right.png has changed
Binary file demos/shared/images/title_stretch.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/shared/shared.qrc	Wed Jun 17 22:40:56 2009 +0000
@@ -0,0 +1,39 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/res">
+   <file>images/button_normal_cap_left.png</file>
+   <file>images/button_normal_cap_right.png</file>
+   <file>images/button_normal_stretch.png</file>
+   <file>images/button_pressed_cap_left.png</file>
+   <file>images/button_pressed_cap_right.png</file>
+   <file>images/button_pressed_stretch.png</file>
+   <file>images/radiobutton-on.png</file>
+   <file>images/radiobutton_on.png</file>
+   <file>images/radiobutton_off.png</file>
+   <file>images/slider_bar.png</file>
+   <file>images/slider_thumb_on.png</file>
+   <file>images/groupframe_topleft.png</file>
+   <file>images/groupframe_topright.png</file>
+   <file>images/groupframe_bottom_left.png</file>
+   <file>images/groupframe_bottom_right.png</file>
+   <file>images/groupframe_top_stretch.png</file>
+   <file>images/groupframe_bottom_stretch.png</file>
+   <file>images/groupframe_left_stretch.png</file>
+   <file>images/groupframe_right_stretch.png</file>
+   <file>images/frame_topleft.png</file>
+   <file>images/frame_topright.png</file>
+   <file>images/frame_bottomleft.png</file>
+   <file>images/frame_bottomright.png</file>
+   <file>images/frame_left.png</file>
+   <file>images/frame_top.png</file>
+   <file>images/frame_right.png</file>
+   <file>images/frame_bottom.png</file>
+   <file>images/title_cap_left.png</file>
+   <file>images/title_cap_right.png</file>
+   <file>images/title_stretch.png</file>
+   <file>images/line_dash_dot.png</file>
+   <file>images/line_dotted.png</file>
+   <file>images/line_dashed.png</file>
+   <file>images/line_solid.png</file>
+   <file>images/line_dash_dot_dot.png</file>
+</qresource>
+</RCC>