Skip to content
Snippets Groups Projects
Commit b3694823 authored by Peter Albrecht's avatar Peter Albrecht
Browse files

Added icon finder utility

parent fd972f3b
No related branches found
No related tags found
1 merge request!406Refactor skill memory GUI
#include "gui_utils.h"
#include <mutex>
#include <QLayout>
#include <QLayoutItem>
#include <QSplitter>
......@@ -7,6 +9,7 @@
#include <QWidget>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/system/ArmarXDataPath.h>
void
armarx::gui::clearLayout(QLayout* layout)
......@@ -107,3 +110,26 @@ armarx::gui::clearSplitter(QSplitter* splitter)
splitter->widget(i)->deleteLater();
}
}
QIcon
armarx::gui::getIcon(std::string name)
{
// is the path already found?
if (armarXGuiPath.empty())
{
std::scoped_lock l(m_armarXGuiPath);
armarXGuiPath = "ArmarXGui";
ArmarXDataPath::getAbsolutePath(armarXGuiPath, armarXGuiPath);
}
std::cout << armarXGuiPath;
// now we can use the path!
// what in god's good name is "armarx/ArmarXGui/data/ArmarXGui"? And why does the util
// say ArmarXGui is in there???????
// anyways. workaround until I figure out what the hell happens here.
QPixmap pix(QString::fromStdString(
armarXGuiPath + "/../../source/ArmarXGui/libraries/ArmarXGuiBase/icons/" + name));
return QIcon(pix);
}
......@@ -13,6 +13,17 @@
namespace armarx::gui
{
// we only need to fetch the path once => fetch once, use many times
static std::string armarXGuiPath = "";
static std::mutex m_armarXGuiPath;
/**
* @brief Get an icon in ArmarXGuiBase.
* @param name The name of the icon.
* @return The icon.
*/
QIcon getIcon(std::string name);
/**
* @brief Clear a layout.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment