0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 00:31:02 +08:00

#0 [GUI] refactoring: removed SET_ICON macro

This commit is contained in:
Victor Zarubkin 2017-10-04 21:38:18 +03:00
parent 2e85a7b6f4
commit 3ab4b9e3c9
4 changed files with 19 additions and 17 deletions

View File

@ -590,11 +590,11 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
{
action = menu.addAction("Expand all");
connect(action, &QAction::triggered, this, &This::onExpandAllClicked);
SET_ICON(action, ":/Expand");
action->setIcon(QIcon(":/Expand"));
action = menu.addAction("Collapse all");
connect(action, &QAction::triggered, this, &This::onCollapseAllClicked);
SET_ICON(action, ":/Collapse");
action->setIcon(QIcon(":/Collapse"));
if (item != nullptr && col >= 0)
{
@ -602,11 +602,11 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
action = menu.addAction("Expand all children");
connect(action, &QAction::triggered, this, &This::onExpandAllChildrenClicked);
SET_ICON(action, ":/Expand");
action->setIcon(QIcon(":/Expand"));
action = menu.addAction("Collapse all children");
connect(action, &QAction::triggered, this, &This::onCollapseAllChildrenClicked);
SET_ICON(action, ":/Collapse");
action->setIcon(QIcon(":/Collapse"));
}
menu.addSeparator();
@ -633,13 +633,17 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
action->setCheckable(true);
action->setChecked(m_bColorRows);
connect(action, &QAction::triggered, this, &This::onColorizeRowsTriggered);
if (m_bColorRows) {
if (m_bColorRows)
{
auto f = action->font();
f.setBold(true);
action->setFont(f);
SET_ICON(action, ":/Color");
action->setIcon(QIcon(":/Color"));
}
else
{
action->setIcon(QIcon(":/NoColor"));
}
else SET_ICON(action, ":/NoColor");
if (item != nullptr && item->parent() != nullptr)
{

View File

@ -261,11 +261,11 @@ void EasyDescTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
QMenu menu;
menu.setToolTipsVisible(true);
auto action = menu.addAction("Expand all");
SET_ICON(action, ":/Expand");
action->setIcon(QIcon(":/Expand"));
connect(action, &QAction::triggered, this, &This::expandAll);
action = menu.addAction("Collapse all");
SET_ICON(action, ":/Collapse");
action->setIcon(QIcon(":/Collapse"));
connect(action, &QAction::triggered, this, &This::collapseAll);
menu.addSeparator();

View File

@ -233,8 +233,6 @@ inline ::profiler::BlocksTree& blocksTree(::profiler::block_index_t i) {
}
#endif
#define SET_ICON(objectName, iconName) { QIcon icon(iconName); if (!icon.isNull()) objectName->setIcon(icon); }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -275,12 +275,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_lastAddress("localhost"), m_lastP
auto f = action->font();
f.setBold(true);
action->setFont(f);
SET_ICON(action, ":/Stats");
action->setIcon(QIcon(":/Stats"));
}
else
{
action->setText("Statistics disabled");
SET_ICON(action, ":/Stats-off");
action->setIcon(QIcon(":/Stats-off"));
}
@ -1027,12 +1027,12 @@ void EasyMainWindow::onEnableDisableStatistics(bool _checked)
if (_checked)
{
action->setText("Statistics enabled");
SET_ICON(action, ":/Stats");
action->setIcon(QIcon(":/Stats"));
}
else
{
action->setText("Statistics disabled");
SET_ICON(action, ":/Stats-off");
action->setIcon(QIcon(":/Stats-off"));
}
}
}
@ -1386,7 +1386,7 @@ void EasyMainWindow::setDisconnected(bool _showMessage)
EASY_GLOBALS.connected = false;
m_captureAction->setEnabled(false);
SET_ICON(m_connectAction, ":/Connection");
m_connectAction->setIcon(QIcon(":/Connection"));
m_connectAction->setText(tr("Connect"));
m_eventTracingEnableAction->setEnabled(false);
@ -1943,7 +1943,7 @@ void EasyMainWindow::onConnectClicked(bool)
qInfo() << "Connected successfully";
EASY_GLOBALS.connected = true;
m_captureAction->setEnabled(true);
SET_ICON(m_connectAction, ":/Connection-on");
m_connectAction->setIcon(QIcon(":/Connection-on"));
m_connectAction->setText(tr("Disconnect"));
if (m_fpsViewer->isVisible())