Bug 86116 - Context menu not fully removed.
Summary: Context menu not fully removed.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-27 20:40 UTC by Andrew Walker
Modified: 2004-07-28 20:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2004-07-27 20:40:59 UTC
Version:           0.98 (using KDE KDE 3.2.1)
OS:                Linux

The right-click context menu associated with a plot group is not painted over.

STEPS TO REPRODUCE:
Start Kst and create a window with 2 plots.
Switch to layout mode and place one plot in the top left corner of the window.
Place the other plot in the bottom right corner.
Group the two plots.
Right-click within the plot group, but outside of either plot.
When the context menu is supposed to close any part of within the group and outside of either plot remains.

NOTE:
This problem is actually more general that the described scenario, in that the described region is never repainted, so will display "ghosts" of previous windows when Kst is brought to the foreground (for example).
Comment 1 George Staikos 2004-07-28 20:02:03 UTC
CVS commit by staikos: 

- plot groups need to fully paint themselves
- background colour should be loaded by viewobject base class
CCMAIL: 86116-done@bugs.kde.org


  M +0 -9      kst2dplot.cpp   1.185
  M +14 -5     kstplotgroup.cpp   1.14
  M +5 -0      kstviewobject.cpp   1.79


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.184:1.185
@@ -73,8 +73,4 @@ Kst2DPlot::Kst2DPlot(const QString& in_t
   commonConstructor(in_tag, yscale_in, xscale_in, xmin_in, ymin_in,
                     xmax_in, ymax_in);
-
-  // Use default foreground and background colours in KstSettings
-  _foregroundColor = KstSettings::globalSettings()->foregroundColor;
-  _backgroundColor = KstSettings::globalSettings()->backgroundColor;
 }
 
@@ -91,9 +87,4 @@ Kst2DPlot::Kst2DPlot(QDomElement& e)
   bool x_log = false, y_log = false;
 
-  // Use default foreground and background colours in KstSettings
-  //  if there are no colurs in the xml file...
-  _foregroundColor = KstSettings::globalSettings()->foregroundColor;
-  _backgroundColor = KstSettings::globalSettings()->backgroundColor;
-
   // Must stay here for plot loading correctness
   _pos_x = 0.0;

--- kdeextragear-2/kst/kst/kstplotgroup.cpp  #1.13:1.14
@@ -51,7 +51,6 @@ KstObject::UpdateType KstPlotGroup::upda
 bool KstPlotGroup::removeChild(KstViewObjectPtr obj, bool recursive) {
   KstViewObjectList::Iterator it;
-  bool bRetVal = false;
 
-  if (KstViewObject::removeChild(obj,recursive)) {
+  if (KstViewObject::removeChild(obj, recursive)) {
     if (_children.count() > 1) {
       QRect gg = _children.first()->geometry();
@@ -63,5 +62,5 @@ bool KstPlotGroup::removeChild(KstViewOb
       updateAspect();
       for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-        updateAspect( );
+        updateAspect();
       }
     } else {
@@ -69,8 +68,8 @@ bool KstPlotGroup::removeChild(KstViewOb
     }
 
-    bRetVal = true;
+    return true;
   }
 
-  return bRetVal;
+  return false;
 }
 
@@ -78,4 +77,5 @@ bool KstPlotGroup::removeChild(KstViewOb
 void KstPlotGroup::flatten() {
   assert(_parent);
+  // FIXME: remove dependency on _parent
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     (*i)->setSelected(false);
@@ -102,5 +102,14 @@ void KstPlotGroup::saveTag(QTextStream& 
 
 void KstPlotGroup::paint(KstPaintType type, QPainter& p) {
+  QRegion clipRegion(geometry());
+  p.setClipRegion(clipRegion);
   KstMetaPlot::paint(type, p);
+  for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+    clipRegion = clipRegion.subtract(QRegion((*i)->geometry()));
+  }
+  p.setClipRegion(clipRegion);
+  QBrush brush(_backgroundColor);
+  p.fillRect(geometry(), brush);
+  p.setClipping(false);
 }
 

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.78:1.79
@@ -38,4 +38,5 @@
 #include "kstdoc.h"
 #include "kstplotgroup.h"
+#include "kstsettings.h"
 #include "kstviewobject.h"
 #include "kstviewobjectfactory.h"
@@ -51,8 +52,12 @@ KstViewObject::KstViewObject(const QStri
   _focus = false;
   _selected = false;
+  _foregroundColor = KstSettings::globalSettings()->foregroundColor;
+  _backgroundColor = KstSettings::globalSettings()->backgroundColor;
 }
 
 
 KstViewObject::KstViewObject(QDomElement& e) : KstObject() {
+  _foregroundColor = KstSettings::globalSettings()->foregroundColor;
+  _backgroundColor = KstSettings::globalSettings()->backgroundColor;
   load(e);
 }