#include "decodergroupbox.h"
-#include <QAction>
#include <QHBoxLayout>
#include <QLabel>
-#include <QToolBar>
+#include <QPushButton>
#include <QVBoxLayout>
#include <assert.h>
DecoderGroupBox::DecoderGroupBox(QString title, QWidget *parent) :
QWidget(parent),
- _layout(new QGridLayout)
+ _layout(new QGridLayout),
+ _show_hide_button(QIcon(":/icons/decoder-shown.svg"), QString(), this)
{
_layout->setContentsMargins(0, 0, 0, 0);
setLayout(_layout);
- _layout->addWidget(new QLabel(QString("<h2>%1</h2><hl/>").arg(title)),
+ _layout->addWidget(new QLabel(QString("<h3>%1</h3>").arg(title)),
0, 0);
_layout->setColumnStretch(0, 1);
- QToolBar *const toolbar = new QToolBar;
- toolbar->setIconSize(QSize(16, 16));
- _layout->addWidget(toolbar, 0, 1);
+ QHBoxLayout *const toolbar = new QHBoxLayout;
+ _layout->addLayout(toolbar, 0, 1);
- QAction *const delete_action = new QAction(
- QIcon(":/icons/decoder-delete.svg"), tr("Delete"), this);
- connect(delete_action, SIGNAL(triggered()),
+ _show_hide_button.setFlat(true);
+ _show_hide_button.setIconSize(QSize(16, 16));
+ connect(&_show_hide_button, SIGNAL(clicked()),
+ this, SIGNAL(show_hide_decoder()));
+ toolbar->addWidget(&_show_hide_button);
+
+ QPushButton *const delete_button = new QPushButton(
+ QIcon(":/icons/decoder-delete.svg"), QString(), this);
+ delete_button->setFlat(true);
+ delete_button->setIconSize(QSize(16, 16));
+ connect(delete_button, SIGNAL(clicked()),
this, SIGNAL(delete_decoder()));
- toolbar->addAction(delete_action);
+ toolbar->addWidget(delete_button);
}
void DecoderGroupBox::add_layout(QLayout *layout)
_layout->addLayout(layout, 1, 0, 1, 2);
}
+void DecoderGroupBox::set_decoder_visible(bool visible)
+{
+ _show_hide_button.setIcon(QIcon(visible ?
+ ":/icons/decoder-shown.svg" :
+ ":/icons/decoder-hidden.svg"));
+}
+
} // widgets
} // pv