mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 13:30:52 -05:00 
			
		
		
		
	
		
			
	
	
		
			27 lines
		
	
	
		
			695 B
		
	
	
	
		
			C++
		
	
	
	
	
	
		
		
			
		
	
	
			27 lines
		
	
	
		
			695 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| 
								 | 
							
								#include "qt_helpers.hpp"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <QString>
							 | 
						||
| 
								 | 
							
								#include <QFont>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								QString font_as_stylesheet (QFont const& font)
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								  QString font_weight;
							 | 
						||
| 
								 | 
							
								  switch (font.weight ())
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								    case QFont::Light: font_weight = "light"; break;
							 | 
						||
| 
								 | 
							
								    case QFont::Normal: font_weight = "normal"; break;
							 | 
						||
| 
								 | 
							
								    case QFont::DemiBold: font_weight = "demibold"; break;
							 | 
						||
| 
								 | 
							
								    case QFont::Bold: font_weight = "bold"; break;
							 | 
						||
| 
								 | 
							
								    case QFont::Black: font_weight = "black"; break;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								  return QString {"* {\n"
							 | 
						||
| 
								 | 
							
								      " font-family: %1;\n"
							 | 
						||
| 
								 | 
							
								      " font-size: %2pt;\n"
							 | 
						||
| 
								 | 
							
								      " font-style: %3;\n"
							 | 
						||
| 
								 | 
							
								      " font-weight: %4;}\n"}
							 | 
						||
| 
								 | 
							
								  .arg (font.family ())
							 | 
						||
| 
								 | 
							
								     .arg (font.pointSize ())
							 | 
						||
| 
								 | 
							
								     .arg (font.styleName ())
							 | 
						||
| 
								 | 
							
								     .arg (font_weight);
							 | 
						||
| 
								 | 
							
								}
							 |