mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:30:05 +00:00 
			
		
		
		
	Ensure widgets are always updated on the main thread
Fixes crashes and widget freezes
This commit is contained in:
		
							parent
							
								
									194638f759
								
							
						
					
					
						commit
						ac40fd93b7
					
				
					 3 changed files with 48 additions and 35 deletions
				
			
		|  | @ -81,45 +81,57 @@ void LineLabel::set_border_width(std::size_t width) | |||
| { | ||||
|    p->borderWidth_ = width; | ||||
|    p->pixmapDirty_ = true; | ||||
|    updateGeometry(); | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod(this, &QWidget::updateGeometry); | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_highlight_width(std::size_t width) | ||||
| { | ||||
|    p->highlightWidth_ = width; | ||||
|    p->pixmapDirty_    = true; | ||||
|    updateGeometry(); | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod(this, &QWidget::updateGeometry); | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_line_width(std::size_t width) | ||||
| { | ||||
|    p->lineWidth_   = width; | ||||
|    p->pixmapDirty_ = true; | ||||
|    updateGeometry(); | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod(this, &QWidget::updateGeometry); | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_border_color(boost::gil::rgba8_pixel_t color) | ||||
| { | ||||
|    p->borderColor_ = color; | ||||
|    p->pixmapDirty_ = true; | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_highlight_color(boost::gil::rgba8_pixel_t color) | ||||
| { | ||||
|    p->highlightColor_ = color; | ||||
|    p->pixmapDirty_    = true; | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_line_color(boost::gil::rgba8_pixel_t color) | ||||
| { | ||||
|    p->lineColor_   = color; | ||||
|    p->pixmapDirty_ = true; | ||||
|    update(); | ||||
| 
 | ||||
|    QMetaObject::invokeMethod( | ||||
|       this, static_cast<void (QWidget::*)()>(&QWidget::update)); | ||||
| } | ||||
| 
 | ||||
| void LineLabel::set_line_settings(settings::LineSettings& lineSettings) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat