mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 14:20:04 +00:00 
			
		
		
		
	Ignore recursive paint events
This commit is contained in:
		
							parent
							
								
									3df6363211
								
							
						
					
					
						commit
						b56c43197f
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		|  | @ -217,6 +217,7 @@ public: | |||
|    common::Level2Product selectedLevel2Product_; | ||||
| 
 | ||||
|    bool            hasMouse_ {false}; | ||||
|    bool            isPainting_ {false}; | ||||
|    bool            lastItemPicked_ {false}; | ||||
|    QPointF         lastPos_ {}; | ||||
|    QPointF         lastGlobalPos_ {}; | ||||
|  | @ -1225,6 +1226,14 @@ void MapWidgetImpl::AddLayer(const std::string&            id, | |||
| 
 | ||||
| bool MapWidget::event(QEvent* e) | ||||
| { | ||||
|    if (e->type() == QEvent::Type::Paint && p->isPainting_) | ||||
|    { | ||||
|       logger_->error("Recursive paint event ignored"); | ||||
| 
 | ||||
|       // Ignore recursive paint events
 | ||||
|       return true; | ||||
|    } | ||||
| 
 | ||||
|    if (p->pickedEventHandler_ != nullptr && | ||||
|        p->pickedEventHandler_->event_ != nullptr) | ||||
|    { | ||||
|  | @ -1379,6 +1388,8 @@ void MapWidget::initializeGL() | |||
| 
 | ||||
| void MapWidget::paintGL() | ||||
| { | ||||
|    p->isPainting_ = true; | ||||
| 
 | ||||
|    auto defaultFont = manager::FontManager::Instance().GetImGuiFont( | ||||
|       types::FontCategory::Default); | ||||
| 
 | ||||
|  | @ -1437,6 +1448,8 @@ void MapWidget::paintGL() | |||
| 
 | ||||
|    // Paint complete
 | ||||
|    Q_EMIT WidgetPainted(); | ||||
| 
 | ||||
|    p->isPainting_ = false; | ||||
| } | ||||
| 
 | ||||
| void MapWidgetImpl::ImGuiCheckFonts() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat