I am new to achartenging, and I am using achartengine to draw a pie chart.
There is an onclick listener listening to the click on the chartview, it get the series index and value correct when first initialized.
But, after the data updated and chartview repainted, it returns the wrong index and value. And it seems like something is cached, because I found that it returned the index and value before repainting.
I tried mChartView.setDrawingCacheEnabled(false); but it wont work. anyone knows why?
thanks in advance
I tried to recreate chartview rather than call repaint, and it works.
but, I think that's not the best way to the problem, maybe that is a bug in achartengine v1.1.0
Related
Can anyone please help me in understanding how the flick function works when called flick(objectOrName, x, y, dx, dy, cdx, cdy) using python. When I tried it, it is not working; it is throwing an error:
Cannot call flick with null declarative item
first lets define this flick, applied on objects: http://doc.qt.io/qt-4.8/qml-flickable.html
second, from your error, I only got the feeling that your item, it's not of flickable type. Please go to http://doc.froglogic.com/squish/latest/, and search for flick() .... and you will see that
... It initiates a flick of the specified objectOrName item—which must be a QML Flickable ...
If you have those things cleared, please send an email to contact#froglogic.com, I'm sure it's more quicker this way.
I have an observer to a value "App.selectedValue". I also have another Ember object that has a binding (App.someObj.appValueBinding) to App.selectedValue. However, when my observer is called, the binding of App.someObj is not updated.
This is illustrated in http://jsfiddle.net/Ur2Qj/8/
In the jsfiddle, you can see in the Chrome debugger or FireBug, that App.selectedValue and App.someObj.appValue have different values, even tho' the latter is bound to the former.
Seems like the binding should be updated when the observer is called. Is this expected behavior in Emberjs or is it a bug? Is there a work-around?
Thanks for looking at this!
Take a look at this: http://jsfiddle.net/ud3323/GUHCD/ (in JavaScript; I don't like CoffeeScript... sorry).
The two main things you've got wrong here is not using get() and set() properly and in your observer you need to set App.someController.content after the end of the current runloop (which means after all the other bindings have taken place). You do this by using Ember.run.next(). You could also use Ember.run.sync() there as well.
Oh and you need to use jQuery 1.7.1. Version 1.5.2 is not compatible with Ember.
I'm calling QCursor.setPos() while the cursor is inside my widget. When I do, mouseMoveEvent is called, when I don't want it to be. In Java/Swing I can move the cursor without sending events. Can I do something similar so calls to QCursor.setPos() so don't send a mouseMoveEvent?
This seems to work for me:
myWidget->clearFocus();
QCursor::setPos(pos);
myWidget->setFocus();
Looks like there is no way to setPos without trigger mouseMoveEvent,
maybe you consider create a :
bool disableMoveProcess;
and make it as a flag for provent your logic running?
I use this method for calling QListWidgetItem::setSelected
without make QListWidget::itemSelectionChanged trigger my code.
I ended up just keeping track of the difference in between mouse movements, so if I get a mouse movement of 5 to the right, for example, I store the five and ignore the next event if it moves me 5 to the left (which means it's probably called by setPos). Not really elegant, but it appears to work reliably.
Very simple Qt GUI application:
On the scene I have multiple circles implemented as QGraphicsItem
boundingRect returns square around
this circle.
Method 'shape' is not overridden.
The problem appears when in paint() method I've added:
if (isSelected()) {
painter->drawRect(re);
}
Selection is drawn well, but unselection doesn't cause redrawing. At log level I can see that item really lost selection flag.
Calling update() from itemChange is useless also.
Thank you in advance for any suggestion.
After 10 days I returned back to this problem and discovered that my QGraphicsItem constructed with
setCacheMode(DeviceCoordinateCache);
OMG! Stupid mistake, when this line was removed (by default QGraphicsItem::NoCache used) selection is redrawn well.
You can also try to change the default QGraphicsView::MinimalViewportUpdate to FullViewportUpdate with setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
Or you can call scene()->update(); from the item to schedule a repaint.
One of them was required at least when I kept changing the QGraphicsItem::ItemHasNoContents flag on an item.
I'm having some issues when calling getItemIndex on an ArrayCollection with a filterFunction set.
I do something like myAC.removeItemAt(myAC.getItemIndex(myObject)), which works fine when the filtering hasn't been applied. As soon as filtering is applied, getItemIndex seems to return -1 in every case.
Has anyone come across this before? What the best way to remove an item form a filtered ArrayCollection?
Thanks a lot.
Evan
What exactly is your filter filtering out? If you've filtered out everything, getItemIndex should return -1.
Are you hoping to remove items that are still visible when your filter has been applied? If you still want to remove an item that's filtered out, you could temporarily disable the filter:
var filter:Function = ac.filterFunction;
ac.fiterFunction = null;
ac.refresh();
// remove item
ac.filterFunction = filter;
ac.refresh();
I think you'll find there is a source object within the ArrayCollection. What you are seeing is a view of the underlying data with a sort or filter applied. You really want to delete from the underlying source object.
Any time I've dealt with adding and removing items from ArrayCollections in Flex, I've always kept a copy of the original ArrayCollection. Any adding or removing of items happen to that original copy.
Once the changes have been made to the original, I move those forward to the filtered list.
Remove it from source directly
arrayCollection.source.splice(i, 1)
Yeah, so I did find out that I was changing the property of the object - to one that would have it filtered out - prior to trying to remove it. Of course I would get -1 in that case. My mistake.
Ended up going with your suggestion, Stiggler. Seems to work fine, though it seems like there should be a less hackish way to handle this type of thing. Perhaps a parameter you could pass to removeItemAt that would let you access the unfiltered collection.
Anyway, thanks to both of you for your responses. Much appreciated.