[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi
From:       Jarosław Staniek <staniek () kde ! org>
Date:       2009-10-20 23:31:00
Message-ID: 1256081460.645921.6539.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1038278 by staniek:

Form
* added editingMode attribute to FormWidgetInterface, and used it to alter paining of \
the widget while the inline editing is active



 M  +3 -0      doc/dev/CHANGELOG-Kexi-js  
 M  +12 -1     formeditor/FormWidgetInterface.cpp  
 M  +9 -2      formeditor/FormWidgetInterface.h  
 M  +7 -1      formeditor/form.cpp  
 M  +5 -0      formeditor/widgetlibrary.cpp  
 M  +12 -0     plugins/forms/widgets/kexidblabel.cpp  


--- trunk/koffice/kexi/doc/dev/CHANGELOG-Kexi-js #1038277:1038278
@@ -58,6 +58,9 @@
 Forms
 * added FormWidgetInterface: adds common designMode attribute to widgets what \
                enables display customization depending on the mode (e.g. displaying \
                frames)
 * draw frame for frameless widgets like label in design mode
+* use semitransparent background when editing text for labels
+* make grid simpler
+* added editingMode attribute to FormWidgetInterface, and used it to alter paining \
of the widget while the inline editing is active  TODO: add option to switch it off
 Main Window
 * fix updating shared actions availability after switching to a new tab
--- trunk/koffice/kexi/formeditor/FormWidgetInterface.cpp #1038277:1038278
@@ -26,8 +26,9 @@
 class FormWidgetInterface::Private
 {
 public:
-    Private() : design(false) {}
+    Private() : design(false), editing(false) {}
     bool design;
+    bool editing;
 };
 
 FormWidgetInterface::FormWidgetInterface()
@@ -50,3 +51,13 @@
     d->design = design;
     dynamic_cast<QWidget*>(this)->setCursor(design ? QCursor(Qt::ArrowCursor) : \
QCursor());  }
+
+bool FormWidgetInterface::editingMode() const
+{
+    return d->editing;
+}
+
+void FormWidgetInterface::setEditingMode(bool editing)
+{
+    d->editing = editing;
+}
--- trunk/koffice/kexi/formeditor/FormWidgetInterface.h #1038277:1038278
@@ -26,8 +26,9 @@
 {
 
 //! Base class for all form widgets.
-/*! Provides "design" flag that can affect rendering of the widget and other \
                behaviour depending 
- on whether the parent form is in design or data mode.
+/*! Provides "design" and "editing" flags that can affect rendering
+ of the widget and other behaviour depending on whether the parent form is in design \
or data mode + and edting mode.
  */
 class KFORMEDITOR_EXPORT FormWidgetInterface
 {
@@ -43,6 +44,12 @@
     //! Sets design mode on or off. Sets the arrow mouse cursor for design mode.
     virtual void setDesignMode(bool design);
 
+    //! @return true if this widget is in inline editing mode 
+    virtual bool editingMode() const;
+
+    //! Sets inline editing mode on or off.
+    virtual void setEditingMode(bool editing);
+
 protected:
     class Private;
     Private *d;
--- trunk/koffice/kexi/formeditor/form.cpp #1038277:1038278
@@ -3640,6 +3640,12 @@
     QWidget *ed = d->inlineEditor;
     QWidget *widget = selectedWidget();
     if (widget) {
+        FormWidgetInterface* fwiface = dynamic_cast<FormWidgetInterface*>(widget);
+
+        if (fwiface)
+            fwiface->setEditingMode(false);
+
+
         ObjectTreeItem *tree = objectTree()->lookup(widget->objectName());
         if (!tree) {
             kWarning() << "Cannot find tree item for widget" << \
widget->objectName(); @@ -3649,7 +3655,7 @@
         if (widget) {// && !ed)
             setRecursiveCursor(widget, this);
             if (widget->inherits("QLineEdit") || widget->inherits("QTextEdit")) { \
                //fix weird behaviour
-                widget->unsetCursor();
+//                widget->unsetCursor();
                 widget->setCursor(Qt::ArrowCursor);
             }
         }
--- trunk/koffice/kexi/formeditor/widgetlibrary.cpp #1038277:1038278
@@ -431,10 +431,13 @@
     if (!wclass)
         return false;
 
+    FormWidgetInterface* fwiface = dynamic_cast<FormWidgetInterface*>(w);
     {
         KFormDesigner::WidgetFactory::InlineEditorCreationArguments args(classname, \
w, container);  if (wclass->factory()->startInlineEditing(args)) {
             args.container->form()->createInlineEditor(args);
+            if (fwiface)
+                fwiface->setEditingMode(true);
             return true;
         }
     }
@@ -443,6 +446,8 @@
         KFormDesigner::WidgetFactory::InlineEditorCreationArguments \
                args(wclass->className(), w, container);
         if (wclass->inheritedClass()->factory()->startInlineEditing(args)) {
             args.container->form()->createInlineEditor(args);
+            if (fwiface)
+                fwiface->setEditingMode(true);
             return true;
         }
     }
--- trunk/koffice/kexi/plugins/forms/widgets/kexidblabel.cpp #1038277:1038278
@@ -514,7 +514,19 @@
     }
     KexiDBTextWidgetInterface::paint(this, &p, text().isEmpty(), alignment(), \
false);  p.end();
+
+    QPalette origPal;
+    if (editingMode()) {
+        origPal = palette();
+        QPalette pal(palette());
+        pal.setBrush(QPalette::WindowText, Qt::transparent);
+        setPalette(pal);
+    }
     QLabel::paintEvent(e);
+    if (editingMode()) {
+        setPalette(origPal);
+    }
+
     const bool hasFrame = frameWidth() >= 1 && frameShape() != QFrame::NoFrame;
     if (designMode() && !hasFrame) {
         p.begin(this);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic