mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:00:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			352 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			352 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <QSpinBox>
 | |
| #include <QWheelEvent>
 | |
| 
 | |
| class QFocusedSpinBox : public QSpinBox
 | |
| {
 | |
|    Q_OBJECT
 | |
| 
 | |
| public:
 | |
|    using QSpinBox::QSpinBox;
 | |
| 
 | |
| protected:
 | |
|    void wheelEvent(QWheelEvent* event) override
 | |
|    {
 | |
|       if (hasFocus())
 | |
|       {
 | |
|          QSpinBox::wheelEvent(event);
 | |
|       }
 | |
|       else
 | |
|       {
 | |
|          event->ignore();
 | |
|       }
 | |
|    }
 | |
| };
 | 
