Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Holding Alt key and scolling with the scrollwheel only scrolls one way
Forum Updated to NodeBB v4.3 + New Features

Holding Alt key and scolling with the scrollwheel only scrolls one way

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 690 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • johnratiusJ Offline
    johnratiusJ Offline
    johnratius
    wrote on last edited by johnratius
    #1

    I don't know why, but whenever I hold down alt and scroll, I get 0 returned. No other key does this.

    This is code from my custom GraphicsView class:

    void View::wheelEvent(QWheelEvent * event)
    {
    if (keyAltDown)
    	{
    		std::cout << "Alt Scroll Amount: " << event->angleDelta().y() << "\n";
    		if (event->angleDelta().y() > 0)
    			verticalScrollBar()->setValue(verticalScrollBar()->value() + 150 * zoomDelta);
    		else
    			verticalScrollBar()->setValue(verticalScrollBar()->value() - 150 * zoomDelta);
    	}
    	else if (keyCtrlDown)
    	{
    		std::cout << "Ctrl Scroll Amount: " << event->angleDelta().y() << "\n";
    		if (event->angleDelta().y() > 0)
    			horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 150 * zoomDelta);
    		else
    			horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 150 * zoomDelta);
    	}
    }
    

    As you can see, I am printing the y() value to the console. Nothing changes except the key I hold down. When I hold Ctrl (Windows), I either get 120, or -120. When holding Alt, it's 0 both ways. Why is this happening?

    BTW, I am already overriding the wheelEvent function. Doesn't work when I add override or not.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What kind of values are you expecting ?

      And is it alt or alt gr ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      johnratiusJ 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What kind of values are you expecting ?

        And is it alt or alt gr ?

        johnratiusJ Offline
        johnratiusJ Offline
        johnratius
        wrote on last edited by
        #3

        @SGaist I should have clarified, that I am expecting to get 120 or -120. That's what I usually get when scrolling works successfully. I am unsure of what Alt gr is. I am just holding the left Alt key on my keyboard and this happens.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Alt usually serves to activate the menu accelerators. So there might be something with that.

          Alt Gr is usually the one at the right.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved