Fix the struct view text color in dark mode
This commit is contained in:
		
							parent
							
								
									bc88c85377
								
							
						
					
					
						commit
						63b784f97e
					
				| 
						 | 
				
			
			@ -226,6 +226,7 @@ StackSelectionColor=#414141
 | 
			
		|||
StackTextColor=#E0E0E0
 | 
			
		||||
StructAlternateBackgroundColor=#313131
 | 
			
		||||
StructBackgroundColor=#212121
 | 
			
		||||
StructTextColor=#E0E0E0
 | 
			
		||||
SymbolUserTextColor=#E0E0E0
 | 
			
		||||
SymbolSystemTextColor=#E0E0E0
 | 
			
		||||
SymbolLoadedTextColor=#E0E0E0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -592,6 +592,7 @@ void AppearanceDialog::colorInfoListInit()
 | 
			
		|||
    colorInfoListAppend(tr("Memory Map Breakpoint"), "MemoryMapBreakpointColor", "MemoryMapBreakpointBackgroundColor");
 | 
			
		||||
    colorInfoListAppend(tr("Memory Map %1").arg(ArchValue(tr("EIP"), tr("RIP"))), "MemoryMapCipColor", "MemoryMapCipBackgroundColor");
 | 
			
		||||
    colorInfoListAppend(tr("Memory Map Section Text"), "MemoryMapSectionTextColor", "");
 | 
			
		||||
    colorInfoListAppend(tr("Struct text"), "StructTextColor", "");
 | 
			
		||||
    colorInfoListAppend(tr("Struct primary background"), "StructBackgroundColor", "");
 | 
			
		||||
    colorInfoListAppend(tr("Struct secondary background"), "StructAlternateBackgroundColor", "");
 | 
			
		||||
    colorInfoListAppend(tr("Breakpoint Summary Parentheses"), "BreakpointSummaryParenColor", "");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,9 @@
 | 
			
		|||
#include <QAbstractTextDocumentLayout>
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
 | 
			
		||||
RichTextItemDelegate::RichTextItemDelegate(QObject* parent)
 | 
			
		||||
    : QStyledItemDelegate(parent)
 | 
			
		||||
RichTextItemDelegate::RichTextItemDelegate(QColor* textColor, QObject* parent)
 | 
			
		||||
    : QStyledItemDelegate(parent),
 | 
			
		||||
      mTextColor(textColor)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +33,7 @@ void RichTextItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &
 | 
			
		|||
 | 
			
		||||
    QTextDocument doc;
 | 
			
		||||
    doc.setDefaultTextOption(textOption);
 | 
			
		||||
    doc.setHtml(option.text);
 | 
			
		||||
    doc.setHtml(QString("<font color=\"%1\">%2</font>").arg(mTextColor->name(), option.text));
 | 
			
		||||
    doc.setDefaultFont(option.font);
 | 
			
		||||
    doc.setDocumentMargin(0);
 | 
			
		||||
    doc.setTextWidth(option.rect.width());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,10 +8,13 @@ class RichTextItemDelegate : public QStyledItemDelegate
 | 
			
		|||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit RichTextItemDelegate(QObject* parent = nullptr);
 | 
			
		||||
    explicit RichTextItemDelegate(QColor* textColor, QObject* parent = nullptr);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    void paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex & index) const override;
 | 
			
		||||
    QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    QColor* mTextColor = nullptr;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,8 +21,8 @@ StructWidget::StructWidget(QWidget* parent) :
 | 
			
		|||
    ui(new Ui::StructWidget)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    ui->treeWidget->setStyleSheet("QTreeWidget { color: #000000; background-color: #FFF8F0; alternate-background-color: #DCD9CF; }");
 | 
			
		||||
    ui->treeWidget->setItemDelegate(new RichTextItemDelegate(ui->treeWidget));
 | 
			
		||||
    ui->treeWidget->setStyleSheet("QTreeWidget { background-color: #FFF8F0; alternate-background-color: #DCD9CF; }");
 | 
			
		||||
    ui->treeWidget->setItemDelegate(new RichTextItemDelegate(&mTextColor, ui->treeWidget));
 | 
			
		||||
    connect(Bridge::getBridge(), SIGNAL(typeAddNode(void*, const TYPEDESCRIPTOR*)), this, SLOT(typeAddNode(void*, const TYPEDESCRIPTOR*)));
 | 
			
		||||
    connect(Bridge::getBridge(), SIGNAL(typeClear()), this, SLOT(typeClear()));
 | 
			
		||||
    connect(Bridge::getBridge(), SIGNAL(typeUpdateWidget()), this, SLOT(typeUpdateWidget()));
 | 
			
		||||
| 
						 | 
				
			
			@ -71,10 +71,10 @@ void StructWidget::loadWindowSettings()
 | 
			
		|||
 | 
			
		||||
void StructWidget::colorsUpdatedSlot()
 | 
			
		||||
{
 | 
			
		||||
    auto color = ConfigColor("AbstractTableViewTextColor");
 | 
			
		||||
    mTextColor = ConfigColor("StructTextColor");
 | 
			
		||||
    auto background = ConfigColor("StructBackgroundColor");
 | 
			
		||||
    auto altBackground = ConfigColor("StructAlternateBackgroundColor");
 | 
			
		||||
    auto style = QString("QTreeWidget { color: %1; background-color: %2; alternate-background-color: %3; }").arg(color.name(), background.name(), altBackground.name());
 | 
			
		||||
    auto style = QString("QTreeWidget { background-color: %1; alternate-background-color: %2; }").arg(background.name(), altBackground.name());
 | 
			
		||||
    ui->treeWidget->setStyleSheet(style);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@ private:
 | 
			
		|||
    Ui::StructWidget* ui;
 | 
			
		||||
    MenuBuilder* mMenuBuilder;
 | 
			
		||||
    GotoDialog* mGotoDialog = nullptr;
 | 
			
		||||
    QColor mTextColor;
 | 
			
		||||
 | 
			
		||||
    void setupColumns();
 | 
			
		||||
    void setupContextMenu();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -232,6 +232,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
 | 
			
		|||
    defaultColors.insert("MemoryMapSectionTextColor", QColor("#8B671F"));
 | 
			
		||||
    defaultColors.insert("SearchListViewHighlightColor", QColor("#FF0000"));
 | 
			
		||||
    defaultColors.insert("SearchListViewHighlightBackgroundColor", Qt::transparent);
 | 
			
		||||
    defaultColors.insert("StructTextColor", QColor("#000000"));
 | 
			
		||||
    defaultColors.insert("StructBackgroundColor", QColor("#FFF8F0"));
 | 
			
		||||
    defaultColors.insert("StructAlternateBackgroundColor", QColor("#DCD9CF"));
 | 
			
		||||
    defaultColors.insert("LogLinkColor", QColor("#00CC00"));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue