-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving map sometimes doesn't repaint correctly #174
Comments
This went away for me when I turned on "Hardware accelerated drawing (Open GL)" in the preferences menu. |
@jakerr Yeah, in general you will not have repaint issues when enabling OpenGL mode because in that mode the whole map view gets repainted if anything changed, while in software rendering mode only the changing parts get repainted. |
This bug is especially annoying when scrolling large maps with a trackpad or mouse wheel on a Mac. (I haven't tried it on Linux yet.) It doesn't happen in 0.8.1. |
@parasyte Hmm, if your issue doesn't happen on 0.8.1 then I think you're talking about a new bug, since this one has been happening forever and on all platforms. Any idea what the difference could be? Could you show a screenshot? |
@bjorn sorry about that. It seemed to be related. The easiest to reproduce case is creating a new large map (I used 100x100 tiles, 32x32 px each) and just scrolling the map with the brush tool. Even with no tile selected for the brush, the "highlight" graphic will not be refreshed properly. Two screens: one with a tile selected, and one without. All I did was scroll the map up and down without moving the mouse cursor. The cursor wasn't captured in the screen shots, so I simulated it by adding a black arrow. |
@parasyte Arg, how very annoying. That is indeed a different and rather more severe bug. Could you tell me the Qt version (listed in Help -> About Qt) that was used for both 0.8.1 and 0.9.0? I'm afraid we may have to open an issue about this on the Qt bug tracker... |
@bjorn Thanks! 0.8.1 uses Qt 4.7.4 |
This also seems to be an issue in Tiled 0.9.1, using Qt 4.8.5 on OS X 10.9.4. OpenGL mode does seem to work well for me, though. |
@andykorth Please try whether it's better with a daily build of Tiled that is built against Qt 5.3 (though there are new issues with OpenGL, so you may want to turn that off again for this version). |
@bjorn Ooh, it does seem to be fixed in Tiled 2014-06-15. Thanks! (which reports Qt 5.3.0) |
+1, just downloaded Tiled from the website last night and I'm seeing this issue. (Tiled 0.9.1, QT 4.8.5) |
Update based upon the comments above...realized I could turn on OpenGL mode, and that fixes the issue. |
@bjorn I am still experiencing this issue on build 0.14.2. I'm on a Mac running El Capitan. I have included a few screenshots. Oddly, I can't turn on OpenGL mode. I'm not sure of the Qt version, it doesn't seem to be an available option in Help anymore. This is on a fresh install of Tiled. |
Yeah, unfortunately this is almost certainly a bug on the Qt side. A simple example application demonstrating the issue may help to get it fixed, but unfortunately this part of Qt has been rather unmaintained in the past years. The issue did get a lot less severe than the initial bug seen in the screenshots posted by @parasyte, right? You can't turn on OpenGL because I disabled it on OS X. There is no version of Qt 5 where OpenGL has worked in any usable way (see for example issue #529).
Right, I thought it was not important enough to have its own menu item, but I should probably at least put the Qt version into the About dialog. In any case I'm sure it's Qt 5.5.0. |
Thanks @bjorn for the quick reply. The severity seems on par with that shown by @parasyte I would say. Makes sense to have it disabled, and makes equal sense for Qt to not have a menu anymore - I was only wanting to include it to make sure my issue was complete. It's a shame that it's a bug with the underlying framework, but it's tolerable. Thanks again, and amazing product! Goodluck with the patreon support. |
I've created a small example application that reproduces this issue, which confirms it's an issue in Qt: #include <QApplication>
#include <QGraphicsRectItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsView>
#include <cmath>
class Scene : public QGraphicsScene
{
public:
/**
* Sets up the scene with a "canvas" and a "cursor".
*/
Scene()
{
addRect(QRectF(0, 0, 1024, 1024));
cursor = addRect(QRectF(0, 0, 32, 32), QPen(), Qt::lightGray);
}
protected:
/**
* Changes the position of the cursor to stay below the mouse, snapped to a
* virtual grid.
*
* Changing the position of an item in response to a mouse event is
* normally not a problem, but it causes visible repainting issues when
* that mouse move event was generated due to handling a mouse wheel event.
*
* The snapping is necessary in triggering the issue, because otherwise the
* item position on the screen would not change at all while scrolling.
*/
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override
{
auto snapped = mouseEvent->scenePos() / 32;
snapped.setX(std::floor(snapped.x()));
snapped.setY(std::floor(snapped.y()));
cursor->setPos(snapped * 32);
QGraphicsScene::mouseMoveEvent(mouseEvent);
}
private:
QGraphicsRectItem *cursor;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Scene scene;
QGraphicsView view;
view.setScene(&scene);
view.viewport()->setMouseTracking(true);
view.resize(256, 256); // make sure the view can be scrolled with wheel
view.show();
return a.exec();
} Zipped up together with a project file: repaintbug.zip |
(Moving https://sourceforge.net/apps/mantisbt/tiled/view.php?id=84 to the new issue tracker here)
When the map is being dragged around by either middleclick or by space bar and left mouseclick, sometimes
artifacts (the current stampbrush) is painted on the map and not removed correctly.
That happens when you scroll against a border (so mouse moves, but map does not move, because map border is reached)
and once you are done scrolling, the area is not repainted until you move the mouse.
The text was updated successfully, but these errors were encountered: