Skip to content
Snippets Groups Projects
Commit 7d94d938 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

ScenarioManager: changed size of scenario button

parent d26d0f6c
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@
#include <QApplication>
#include <QMouseEvent>
ButtonDelegate::ButtonDelegate(QObject* parent) : QStyledItemDelegate(parent),
startPixmap(":/icons/media-playback-start.ico"),
stopPixmap(":/icons/process-stop-7.ico"),
......@@ -48,21 +49,25 @@ void ButtonDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
button.rect = option.rect;
button.features = QStyleOptionButton::AutoDefaultButton;
int size = appIconSize;
if (!index.parent().isValid())
{
size = scenarioIconSize;
}
if (index.data().toString().compare("Start") == 0)
{
button.icon = startPixmap;
button.iconSize = QSize(15, 15);
button.iconSize = QSize(size, size);
}
else if (index.data().toString().compare("Stop") == 0)
{
button.icon = stopPixmap;
button.iconSize = QSize(15, 15);
button.iconSize = QSize(size, size);
}
else if (index.data().toString().compare("Restart") == 0)
{
button.icon = restartPixmap;
button.iconSize = QSize(15, 15);
button.iconSize = QSize(size, size);
}
else
{
......@@ -102,8 +107,33 @@ void ButtonDelegate::emitClicketData(int row, int column, QModelIndex parent)
emit buttonClicked(row, column, parent);
}
int ButtonDelegate::getAppIconSize() const
{
return appIconSize;
}
void ButtonDelegate::setAppIconSize(int value)
{
appIconSize = value;
}
int ButtonDelegate::getScenarioIconSize() const
{
return scenarioIconSize;
}
void ButtonDelegate::setScenarioIconSize(int value)
{
scenarioIconSize = value;
}
QSize ButtonDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
return QSize(option.rect.width(), option.rect.height() + 20);
int size = appIconSize;
if (!index.parent().isValid())
{
size = scenarioIconSize;
}
return QSize(option.rect.width(), option.rect.height() + size + 6);
//QItemDelegate::sizeHint(option,index);
}
......@@ -60,6 +60,13 @@ public:
*/
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
int getScenarioIconSize() const;
void setScenarioIconSize(int value);
int getAppIconSize() const;
void setAppIconSize(int value);
signals:
void buttonClicked(int row, int column, QModelIndex parent);
......@@ -74,6 +81,9 @@ private:
QPixmap startPixmap;
QPixmap stopPixmap;
QPixmap restartPixmap;
int scenarioIconSize = 24;
int appIconSize = 16;
};
......
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