How to override QgsMapCanvas default zoom behavior?
What makes accurate emulation of old systems a difficult task?
Find a stone which is not the lightest one
Multiple fireplaces in an apartment building?
What is the term for a person whose job is to place products on shelves in stores?
Find the identical rows in a matrix
Why must Chinese maps be obfuscated?
How to not starve gigantic beasts
How important is it that $TERM is correct?
Co-worker works way more than he should
A Note on N!
What *exactly* is electrical current, voltage, and resistance?
Does the damage from the Absorb Elements spell apply to your next attack, or to your first attack on your next turn?
Will I lose my paid in full property
My bank got bought out, am I now going to have to start filing tax returns in a different state?
Is there really no use for MD5 anymore?
Work requires me to come in early to start computer but wont let me clock in to get paid for it
NPN: Not fully sinking to GND
Extracting Dirichlet series coefficients
Double-nominative constructions and “von”
Is it acceptable to use working hours to read general interest books?
How much cash can I safely carry into the USA and avoid civil forfeiture?
What is the unit of time_lock_delta in LND?
How long after the last departure shall the airport stay open for an emergency return?
How exactly does Hawking radiation decrease the mass of black holes?
How to override QgsMapCanvas default zoom behavior?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm writing a standalone QGIS Python app. I've subclassed QgsMapTool and have successfully implemented some selection capabilities. Now I'm trying to implement my own zoom behavior, using the same map tool, but QgsMapCanvas seems to have some built-in zooming behavior. How can disable the built-in zooming and get complete control over the mouse wheel?
class MyMapTool(QgsMapTool):
...
def wheelEvent(self, event):
new_extent = QgsRectangle(...)
self.canvas.setExtent(new_extent)
# Something else is messing with the extent.
# How can I disable it and use my new_extent?
# Set the tool to the canvas. This is the only Map Tool I use.
tool = MyMapTool(self.canvas)
self.canvas.setMapTool(tool)
qgis python
add a comment |
I'm writing a standalone QGIS Python app. I've subclassed QgsMapTool and have successfully implemented some selection capabilities. Now I'm trying to implement my own zoom behavior, using the same map tool, but QgsMapCanvas seems to have some built-in zooming behavior. How can disable the built-in zooming and get complete control over the mouse wheel?
class MyMapTool(QgsMapTool):
...
def wheelEvent(self, event):
new_extent = QgsRectangle(...)
self.canvas.setExtent(new_extent)
# Something else is messing with the extent.
# How can I disable it and use my new_extent?
# Set the tool to the canvas. This is the only Map Tool I use.
tool = MyMapTool(self.canvas)
self.canvas.setMapTool(tool)
qgis python
add a comment |
I'm writing a standalone QGIS Python app. I've subclassed QgsMapTool and have successfully implemented some selection capabilities. Now I'm trying to implement my own zoom behavior, using the same map tool, but QgsMapCanvas seems to have some built-in zooming behavior. How can disable the built-in zooming and get complete control over the mouse wheel?
class MyMapTool(QgsMapTool):
...
def wheelEvent(self, event):
new_extent = QgsRectangle(...)
self.canvas.setExtent(new_extent)
# Something else is messing with the extent.
# How can I disable it and use my new_extent?
# Set the tool to the canvas. This is the only Map Tool I use.
tool = MyMapTool(self.canvas)
self.canvas.setMapTool(tool)
qgis python
I'm writing a standalone QGIS Python app. I've subclassed QgsMapTool and have successfully implemented some selection capabilities. Now I'm trying to implement my own zoom behavior, using the same map tool, but QgsMapCanvas seems to have some built-in zooming behavior. How can disable the built-in zooming and get complete control over the mouse wheel?
class MyMapTool(QgsMapTool):
...
def wheelEvent(self, event):
new_extent = QgsRectangle(...)
self.canvas.setExtent(new_extent)
# Something else is messing with the extent.
# How can I disable it and use my new_extent?
# Set the tool to the canvas. This is the only Map Tool I use.
tool = MyMapTool(self.canvas)
self.canvas.setMapTool(tool)
qgis python
qgis python
asked 1 min ago
mark78mark78
161
161
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f320895%2fhow-to-override-qgsmapcanvas-default-zoom-behavior%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f320895%2fhow-to-override-qgsmapcanvas-default-zoom-behavior%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown