mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-22 06:33:46 +00:00
Add Icons to ClassWidget
This commit is contained in:
parent
af20c35ab0
commit
c54f7df3cb
@ -14,19 +14,14 @@ SvgIconEngine::SvgIconEngine(const QString &filename)
|
||||
this->svgData = file.readAll();
|
||||
}
|
||||
|
||||
SvgIconEngine::SvgIconEngine(const QByteArray &svgData)
|
||||
{
|
||||
this->svgData = svgData;
|
||||
}
|
||||
|
||||
SvgIconEngine::SvgIconEngine(const QString &filename, QColor tintColor) : SvgIconEngine(filename)
|
||||
SvgIconEngine::SvgIconEngine(const QString &filename, const QColor &tintColor) : SvgIconEngine(filename)
|
||||
{
|
||||
this->svgData = qhelpers::applyColorToSvg(svgData, tintColor);
|
||||
}
|
||||
|
||||
SvgIconEngine::SvgIconEngine(const QByteArray &svgData, QColor tintColor)
|
||||
SvgIconEngine::SvgIconEngine(const QString &filename, QPalette::ColorRole colorRole)
|
||||
: SvgIconEngine(filename, QPalette().color(colorRole))
|
||||
{
|
||||
this->svgData = qhelpers::applyColorToSvg(svgData, tintColor);
|
||||
}
|
||||
|
||||
void SvgIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode /*mode*/,
|
||||
@ -48,7 +43,7 @@ QPixmap SvgIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State
|
||||
QPixmap pix = QPixmap::fromImage(img, Qt::NoFormatConversion);
|
||||
{
|
||||
QPainter painter(&pix);
|
||||
QRect r(QPoint(0.0, 0.0), size);
|
||||
QRect r(QPoint(0, 0), size);
|
||||
this->paint(&painter, r, mode, state);
|
||||
}
|
||||
return pix;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define SVGICONENGINE_H
|
||||
|
||||
#include <QIconEngine>
|
||||
#include <QPalette>
|
||||
|
||||
class SvgIconEngine: public QIconEngine
|
||||
{
|
||||
@ -11,10 +12,9 @@ private:
|
||||
|
||||
public:
|
||||
explicit SvgIconEngine(const QString &filename);
|
||||
explicit SvgIconEngine(const QByteArray &svgData);
|
||||
|
||||
SvgIconEngine(const QString &filename, QColor tintColor);
|
||||
SvgIconEngine(const QByteArray &svgData, QColor tintColor);
|
||||
SvgIconEngine(const QString &filename, const QColor &tintColor);
|
||||
SvgIconEngine(const QString &filename, QPalette::ColorRole colorRole);
|
||||
|
||||
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
|
||||
QIconEngine *clone() const override;
|
||||
|
12
src/img/icons/fork.svg
Normal file
12
src/img/icons/fork.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="28px" height="32px" viewBox="0 0 28 32" enable-background="new 0 0 28 32" xml:space="preserve">
|
||||
<g>
|
||||
<path fill="#010101" d="M20,0v3.9c0,1.6-0.62,3.1-1.8,4.2l-11,11c-1.9,2-2.8,4-3,7h-4l6,6l6-6h-4c0.1-1.399,0.68-2.8,1.7-3.8l11-11
|
||||
c2-1.9,3-4.5,3-7.1V0.3h-4L20,0z"/>
|
||||
<path fill="#010101" d="M24,26c-0.109-2.5-1.1-4.8-2.9-6.6L18.9,17.2l-3,3l2.199,2.2c1,1,1.601,2.399,1.7,3.8h-4l6,6l6-6h-4L24,26z
|
||||
"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 793 B |
13
src/img/icons/list.svg
Normal file
13
src/img/icons/list.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg style="enable-background:new 0 0 31.998 28" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="28px" width="32px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 31.998 28">
|
||||
<g fill="#010101">
|
||||
<circle cx="2" r="2" cy="2"/>
|
||||
<circle cx="2" r="2" cy="10"/>
|
||||
<circle cx="2" r="2" cy="18"/>
|
||||
<circle cx="2" r="2" cy="26"/>
|
||||
<rect x="8" height="4" width="24"/>
|
||||
<rect height="4" width="24" y="8" x="8"/>
|
||||
<rect height="4" width="24" y="16" x="8"/>
|
||||
<rect height="4" width="24" y="24" x="8"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 667 B |
@ -82,6 +82,8 @@
|
||||
<file>img/icons/copy.svg</file>
|
||||
<file>img/icons/delete.svg</file>
|
||||
<file>img/icons/previous.svg</file>
|
||||
<file>img/icons/list.svg</file>
|
||||
<file>img/icons/fork.svg</file>
|
||||
<file>python/cutter.py</file>
|
||||
<file>python/reg_qtres_importer.py</file>
|
||||
</qresource>
|
||||
|
@ -343,6 +343,11 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
if (index.column() == NAME) {
|
||||
return QIcon(new SvgIconEngine(QString(":/img/icons/home.svg"), QPalette::WindowText));
|
||||
}
|
||||
return QVariant();
|
||||
case NameRole:
|
||||
return base.className;
|
||||
case TypeRole:
|
||||
@ -368,6 +373,11 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
if (index.column() == NAME) {
|
||||
return QIcon(new SvgIconEngine(QString(":/img/icons/fork.svg"), QPalette::WindowText));
|
||||
}
|
||||
return QVariant();
|
||||
case OffsetRole:
|
||||
return QVariant::fromValue(meth.addr);
|
||||
case VTableOffsetRole:
|
||||
@ -395,6 +405,11 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
if (index.column() == NAME) {
|
||||
return QIcon(new SvgIconEngine(QString(":/img/icons/list.svg"), QPalette::WindowText));
|
||||
}
|
||||
return QVariant();
|
||||
case OffsetRole:
|
||||
return QVariant::fromValue(vtable.addr);
|
||||
case TypeRole:
|
||||
|
Loading…
Reference in New Issue
Block a user