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. QEvent::Wheel working on a deactivated window.
Forum Updated to NodeBB v4.3 + New Features

QEvent::Wheel working on a deactivated window.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k 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.
  • C Offline
    C Offline
    Cayan
    wrote on last edited by
    #1

    I found it very weird when I saw it working.
    Here is the thing:
    Components like QComboBox, QSpinBox, etc. that accepts and changes its data through the QEvent::Wheel also changes their data when their parent window state is deactivated.

    I think this is a real bug.
    I could solve the QComboBox adding this code on eventFilter
    @bool Dialog::eventFilter(QObject *object, QEvent event)
    {
    if((QDialog
    )object)
    {
    if(event->type() == QEvent::FocusOut)
    {
    disabled = true;
    }
    else if(event->type() == QEvent::FocusIn)
    {
    disabled = false;
    }
    }

    if(object->isWidgetType() &&(event->type() == QEvent::Wheel)
    {
        if(disabled)
        {
            return true;
        }
    }
    
    return false;
    

    }@

    Unfortunately it does not work for QSpinBox, QDoubleSpinBox... it seems like they do not trigger QEvent::Wheel, so I had to connect a function to each of those components valueChanged signal, check a property I made with it's last value and reset it, in case of disable == true.

    Cayan.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Well, for QSpinBox and QDoubleSpinBox, it is the QLineEdit instead of Q..SpinBox receive the Wheel event.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Cayan
        wrote on last edited by
        #3

        Well, I subclasses both of those, made a function to return the pointer for their lineEdit and installed the event filter, still not working =[

        I'm about to sleep, I'll study more regarding these QLineEdits tomorrow.

        Thanks anyway

        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