Set list item colors to system default

This commit is contained in:
Florian Märkl 2017-12-02 20:15:12 +01:00
parent 0a8755f471
commit 096db4b7e4
18 changed files with 70 additions and 305 deletions

View File

@ -14,8 +14,7 @@ CommentsWidget::CommentsWidget(MainWindow *main, QWidget *parent) :
{
ui->setupUi(this);
ui->commentsTreeWidget->hideColumn(0);
ui->commentsTreeWidget->sortByColumn(3, Qt::AscendingOrder);
ui->commentsTreeWidget->sortByColumn(2, Qt::AscendingOrder);
QTabBar *tabs = ui->tabWidget->tabBar();
tabs->setVisible(false);
@ -43,7 +42,6 @@ void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *it
// Get offset and name of item double clicked
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
CutterCore::getInstance()->seek(comment.offset);
//CutterCore::getInstance()->seek(comment.offset, comment.name, true);
}
void CommentsWidget::on_toolButton_clicked()
@ -118,10 +116,13 @@ void CommentsWidget::refreshTree()
for (CommentDescription comment : comments)
{
//this->main->add_debug_output(RAddressString(comment.offset));
QString fcn_name = CutterCore::getInstance()->cmdFunctionAt(comment.offset);
QTreeWidgetItem *item = qhelpers::appendRow(ui->commentsTreeWidget, RAddressString(comment.offset), fcn_name, comment.name);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(comment.offset));
item->setText(1, fcn_name);
item->setText(2, comment.name);
item->setData(0, Qt::UserRole, QVariant::fromValue(comment));
ui->commentsTreeWidget->addTopLevelItem(item);
}
qhelpers::adjustColumns(ui->commentsTreeWidget);

View File

@ -222,35 +222,19 @@ border-top: 0px;
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Dummy</string>
</property>
</column>
<column>
<property name="text">
<string>Offset</string>
@ -295,26 +279,8 @@ QTreeWidget::item:hover
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}
QTreeWidget::branch:selected
{
background: gray;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QToolTip {

View File

@ -19,12 +19,6 @@ EntrypointWidget::EntrypointWidget(MainWindow *main, QWidget *parent) :
{
ui->setupUi(this);
// Delegate
//CMyDelegate* delegate = new CMyDelegate(ui->importsTreeWidget);
//ui->importsTreeWidget->setItemDelegate(delegate);
ui->entrypointTreeWidget->hideColumn(0);
setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillEntrypoint()));
@ -37,8 +31,11 @@ void EntrypointWidget::fillEntrypoint()
ui->entrypointTreeWidget->clear();
for (auto i : CutterCore::getInstance()->getAllEntrypoint())
{
QTreeWidgetItem *item = qhelpers::appendRow(ui->entrypointTreeWidget, RAddressString(i.vaddr), i.type);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(i.vaddr));
item->setText(1, i.type);
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
ui->entrypointTreeWidget->addTopLevelItem(item);
}
qhelpers::adjustColumns(ui->entrypointTreeWidget, 0, 10);
@ -53,5 +50,4 @@ void EntrypointWidget::on_entrypointTreeWidget_itemDoubleClicked(QTreeWidgetItem
{
EntrypointDescription ep = item->data(0, Qt::UserRole).value<EntrypointDescription>();
CutterCore::getInstance()->seek(ep.vaddr);
//CutterCore::getInstance()->seek(ep.vaddr, ep.type, true);
}

View File

@ -32,22 +32,8 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -56,17 +42,15 @@ QTreeWidget::item:selected
<property name="lineWidth">
<number>0</number>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount">
<number>3</number>
<number>2</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">Address</string>

View File

@ -32,22 +32,8 @@
<property name="styleSheet">
<string notr="true">QTreeView::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeView::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeView::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -57,7 +43,7 @@ QTreeView::item:selected
<number>0</number>
</property>
<property name="indentation">
<number>0</number>
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>

View File

@ -35,22 +35,8 @@
<property name="styleSheet">
<string notr="true">QTreeView::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeView::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeView::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -60,7 +46,7 @@ QTreeView::item:selected
<bool>true</bool>
</property>
<property name="indentation">
<number>0</number>
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>

View File

@ -104,22 +104,8 @@ border-top: 0px;
<property name="styleSheet">
<string notr="true">QTreeView::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeView::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeView::item:selected
{
background: gray;
color: white;
}
QToolTip
@ -140,7 +126,7 @@ QToolTip
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="indentation">
<number>0</number>
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
@ -187,30 +173,7 @@ QToolTip
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QTreeView::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeView::item:selected
{
background: gray;
color: white;
}
QTreeView::branch:selected
{
background: gray;
}
QTreeView::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
<string notr="true">
QToolTip {
background-color: #444;
border: 3px solid #444;

View File

@ -39,12 +39,7 @@ ImportsWidget::ImportsWidget(MainWindow *main, QWidget *parent) :
{
ui->setupUi(this);
// Delegate
//CMyDelegate* delegate = new CMyDelegate(ui->importsTreeWidget);
//ui->importsTreeWidget->setItemDelegate(delegate);
ui->importsTreeWidget->hideColumn(0);
ui->importsTreeWidget->sortByColumn(4, Qt::AscendingOrder);
ui->importsTreeWidget->sortByColumn(3, Qt::AscendingOrder);
setScrollMode();
@ -58,8 +53,13 @@ void ImportsWidget::fillImports()
ui->importsTreeWidget->clear();
for (auto i : CutterCore::getInstance()->getAllImports())
{
QTreeWidgetItem *item = qhelpers::appendRow(ui->importsTreeWidget, RAddressString(i.plt), i.type, "", i.name);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(i.plt));
item->setText(1, i.type);
item->setText(2, "");
item->setText(3, i.name);
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
ui->importsTreeWidget->addTopLevelItem(item);
}
highlightUnsafe();
@ -85,7 +85,7 @@ void ImportsWidget::highlightUnsafe()
QList<QTreeWidgetItem *> clist = ui->importsTreeWidget->findItems(banned, Qt::MatchRegExp, 4);
foreach (QTreeWidgetItem *item, clist)
{
item->setText(3, "Unsafe");
item->setText(2, "Unsafe");
//item->setBackgroundColor(4, QColor(255, 129, 123));
//item->setForeground(4, Qt::white);
item->setForeground(4, QColor(255, 129, 123));

View File

@ -32,22 +32,8 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -56,14 +42,12 @@ QTreeWidget::item:selected
<property name="lineWidth">
<number>0</number>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Dummy</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>

View File

@ -14,8 +14,6 @@ RelocsWidget::RelocsWidget(MainWindow *main, QWidget *parent) :
// Radare core found in:
this->main = main;
ui->relocsTreeWidget->hideColumn(0);
setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillTreeWidget()));
@ -38,8 +36,12 @@ void RelocsWidget::fillTreeWidget()
for (auto i : CutterCore::getInstance()->getAllRelocs())
{
QTreeWidgetItem *item = qhelpers::appendRow(ui->relocsTreeWidget, RAddressString(i.vaddr), i.type, i.name);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(i.vaddr));
item->setText(1, i.type);
item->setText(2, i.name);
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
ui->relocsTreeWidget->addTopLevelItem(item);
}
qhelpers::adjustColumns(ui->relocsTreeWidget);

View File

@ -32,35 +32,19 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Dummy</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>

View File

@ -61,7 +61,7 @@
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/img/icons/arrow_right.png</normaloff>:/img/icons/arrow_right.png</iconset>
<normaloff>:/img/icons/arrow_right.svg</normaloff>:/img/icons/arrow_right.svg</iconset>
</property>
</widget>
</item>
@ -79,7 +79,7 @@
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/unlock</normaloff>:/unlock</iconset>
<normaloff>:/img/icons/unlock_white.svg</normaloff>:/img/icons/unlock_white.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -94,32 +94,10 @@
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="styleSheet">
<string notr="true">QHeaderView::section {
color: drakgray;
padding: 3px;
padding-left: 10px;
background-color: rgb(232, 232, 232);
border: 2px solid white;
}
QTreeWidget::item
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -132,7 +110,7 @@ QTreeWidget::item:selected
<number>0</number>
</property>
<property name="indentation">
<number>10</number>
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>false</bool>

View File

@ -15,8 +15,6 @@ SectionsWidget::SectionsWidget(MainWindow *main, QWidget *parent) :
setupViews();
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
//setStyleSheet("QSplitter::handle:horizontal { width: 3px; } QSplitter::handle:vertical { height: 3px; }");
//setStyleSheet("QSplitter::handle { height: 2px; background-color: rgb(255, 255, 255); image: url(:/img/icons/tabs.svg); }");
tree->sortByColumn(0, Qt::AscendingOrder);
@ -36,8 +34,6 @@ void SectionsWidget::refreshSections()
fillSections(row++, section);
}
//adjustColumns(sectionsWidget->tree);
//this->sectionsDock->sectionsWidget->adjustColumns();
qhelpers::adjustColumns(tree);
}
@ -46,15 +42,12 @@ void SectionsWidget::setupViews()
// Table view
this->tree = new QTreeWidget;
this->tree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//this->tree->setFont(QFont("Lucida Grande UI", 12));
//this->tree->setFont(QFont("Courier New", 11));
this->tree->setIndentation(10);
//this->tree->setStyleSheet("QTreeWidget::item { padding-top: 1px; padding-bottom: 1px; padding-left:10px; border-left:10px;} QTreeWidget::item:selected { background: gray; color: white; } QTreeWidget::item:hover { background: rgb(242, 246, 248); color: black; }");
// Setup TreeWidget
this->tree->setColumnCount(4);
QList<QString> headers;
headers << "Name" << "Size" << "Address" << "End Address";
headers << tr("Name") << tr("Size") << tr("Address") << tr("End Address");
this->tree->setHeaderLabels(headers);
this->tree->setFrameShape(QFrame::NoFrame);

View File

@ -379,22 +379,8 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}
QToolTip {
@ -414,7 +400,7 @@ QToolTip {
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="indentation">
<number>0</number>
<number>8</number>
</property>
<column>
<property name="text">
@ -493,22 +479,8 @@ QToolTip {
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}
QToolTip {
@ -528,7 +500,7 @@ QToolTip {
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="indentation">
<number>0</number>
<number>8</number>
</property>
<column>
<property name="text">

View File

@ -14,11 +14,9 @@ StringsWidget::StringsWidget(MainWindow *main, QWidget *parent) :
{
ui->setupUi(this);
ui->stringsTreeWidget->hideColumn(0);
setScrollMode();
ui->stringsTreeWidget->sortByColumn(2, Qt::AscendingOrder);
ui->stringsTreeWidget->sortByColumn(1, Qt::AscendingOrder);
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillTreeWidget()));
}
@ -29,8 +27,6 @@ void StringsWidget::on_stringsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item
{
Q_UNUSED(column);
// Get offset and name of item double clicked
// TODO: use this info to change disasm contents
StringDescription str = item->data(0, Qt::UserRole).value<StringDescription>();
CutterCore::getInstance()->seek(str.vaddr);
}
@ -40,7 +36,13 @@ void StringsWidget::fillTreeWidget()
ui->stringsTreeWidget->clear();
for (auto i : CutterCore::getInstance()->getAllStrings())
{
QTreeWidgetItem *item = qhelpers::appendRow(ui->stringsTreeWidget, RAddressString(i.vaddr), i.string);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(i.vaddr));
item->setText(1, i.string);
ui->stringsTreeWidget->insertTopLevelItem(0, item);
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
}
qhelpers::adjustColumns(ui->stringsTreeWidget);

View File

@ -38,22 +38,8 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</property>
<property name="frameShape">
@ -62,14 +48,12 @@ QTreeWidget::item:selected
<property name="lineWidth">
<number>0</number>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Dummy</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>

View File

@ -13,8 +13,7 @@ SymbolsWidget::SymbolsWidget(QWidget *parent) :
{
ui->setupUi(this);
ui->symbolsTreeWidget->hideColumn(0);
ui->symbolsTreeWidget->sortByColumn(3, Qt::AscendingOrder);
ui->symbolsTreeWidget->sortByColumn(2, Qt::AscendingOrder);
setScrollMode();
@ -38,12 +37,12 @@ void SymbolsWidget::fillSymbols()
ui->symbolsTreeWidget->clear();
for (auto symbol : CutterCore::getInstance()->getAllSymbols())
{
QTreeWidgetItem *item = qhelpers::appendRow(ui->symbolsTreeWidget,
RAddressString(symbol.vaddr),
QString("%1 %2").arg(symbol.bind, symbol.type).trimmed(),
symbol.name);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(symbol.vaddr));
item->setText(1, QString("%1 %2").arg(symbol.bind, symbol.type).trimmed());
item->setText(2, symbol.name);
item->setData(0, Qt::UserRole, QVariant::fromValue(symbol));
ui->symbolsTreeWidget->addTopLevelItem(item);
}
qhelpers::adjustColumns(ui->symbolsTreeWidget);
}

View File

@ -32,23 +32,10 @@
<property name="styleSheet">
<string notr="true">QTreeWidget::item
{
padding-left:10px;
padding-top: 1px;
padding-bottom: 1px;
border-left: 10px;
}
QTreeWidget::item:hover
{
background: rgb(242, 246, 248);
color: black;
}
QTreeWidget::item:selected
{
background: gray;
color: white;
}</string>
</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
@ -56,14 +43,12 @@ QTreeWidget::item:selected
<property name="lineWidth">
<number>0</number>
</property>
<property name="indentation">
<number>8</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Dummy</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>