Smooth out scrolling for graphics views nested in scroll areas
This commit is contained in:
parent
d7f25f9ae5
commit
13f14757be
4 changed files with 31 additions and 9 deletions
|
@ -14,6 +14,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
|||
|
||||
### Fixed
|
||||
- Fix some minor visual issues with the various zoom sliders.
|
||||
- Smooth out scrolling when mouse is over tile/metatile images.
|
||||
- Fix the Tileset Editor selectors getting extra white space when changing tilesets.
|
||||
- Fix a crash when adding disabled events with the Pencil tool.
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="graphicsView_BorderMetatile">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_BorderMetatile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -922,7 +922,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="graphicsView_currentMetatileSelection">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_currentMetatileSelection">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -1032,7 +1032,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_Metatiles">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -1227,7 +1227,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QGraphicsView" name="graphicsView_Collision">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_Collision">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -3435,6 +3435,11 @@
|
|||
<extends>QWidget</extends>
|
||||
<header>mapview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>NoScrollGraphicsView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header>mapview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources/images.qrc"/>
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_Metatiles">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
|
@ -560,7 +560,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGraphicsView" name="graphicsView_Tiles">
|
||||
<widget class="NoScrollGraphicsView" name="graphicsView_Tiles">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
|
@ -806,6 +806,11 @@
|
|||
<extends>QComboBox</extends>
|
||||
<header>noscrollcombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>NoScrollGraphicsView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header>mapview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources/images.qrc"/>
|
||||
|
|
|
@ -4,12 +4,23 @@
|
|||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class ClickableGraphicsView : public QGraphicsView
|
||||
class NoScrollGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickableGraphicsView() : QGraphicsView() {}
|
||||
ClickableGraphicsView(QWidget *parent) : QGraphicsView(parent) {}
|
||||
NoScrollGraphicsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent *event) {
|
||||
event->ignore();
|
||||
}
|
||||
};
|
||||
|
||||
class ClickableGraphicsView : public NoScrollGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickableGraphicsView(QWidget *parent = nullptr) : NoScrollGraphicsView(parent) {}
|
||||
|
||||
public:
|
||||
void mouseReleaseEvent(QMouseEvent *event) override {
|
||||
|
|
Loading…
Reference in a new issue