2
0
forked from Ivasoft/DSView

fix: decoder dialog scroll bar

This commit is contained in:
dreamsourcelabTAI
2022-06-14 11:14:09 +08:00
parent 3ae7650602
commit 83ad020bda
7 changed files with 33 additions and 8 deletions

View File

@@ -180,7 +180,7 @@ void DecoderOptionsDlg::load_options(view::DecodeTrace *trace, bool isNew)
float sk = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96;
int srcHeight = 600;
container_panel->setFixedHeight(_contentHeight);
container_panel->setFixedHeight(_contentHeight + 10);
if (dlgHeight * sk > srcHeight)
{

View File

@@ -36,6 +36,10 @@ const std::vector<Property*>& Binding::properties()
return _properties;
}
Binding::Binding(){
_row_num = 0;
}
void Binding::commit()
{
for(auto &p : _properties) {
@@ -55,15 +59,18 @@ void Binding::add_properties_to_form(QFormLayout *layout,
QWidget *const widget = p->get_widget(layout->parentWidget(), auto_commit);
if (p->labeled_widget())
if (p->labeled_widget()){
layout->addRow(widget);
_row_num++;
}
else{
const QString &lbstr = p->label();
//remove data format options
if (lbstr == "Data format"){
continue;
}
layout->addRow(p->label(), widget);
layout->addRow(p->label(), widget);
_row_num++;
}
}
}

View File

@@ -44,6 +44,8 @@ namespace binding {
class Binding
{
public:
Binding();
const std::vector<Property*>& properties();
void commit();
@@ -58,10 +60,16 @@ public:
static QString print_gvariant(GVariant *const gvar);
inline int get_row_count(){
return _row_num;
}
protected:
std::vector<Property*> _properties;
QWidget *_form;
int _row_num;
};
} // binding

View File

@@ -39,9 +39,8 @@ namespace pv {
namespace prop {
namespace binding {
DecoderOptions::DecoderOptions(
pv::data::DecoderStack* decoder_stack,
data::decode::Decoder *decoder) :
DecoderOptions::DecoderOptions(pv::data::DecoderStack* decoder_stack, data::decode::Decoder *decoder) :
Binding(),
_decoder_stack(decoder_stack),
_decoder(decoder)
{

View File

@@ -40,8 +40,8 @@ namespace pv {
namespace prop {
namespace binding {
ProbeOptions::ProbeOptions(struct sr_dev_inst *sdi,
struct sr_channel *probe) :
ProbeOptions::ProbeOptions(struct sr_dev_inst *sdi, struct sr_channel *probe) :
Binding(),
_sdi(sdi),
_probe(probe)
{

View File

@@ -48,6 +48,8 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
QWidget *parent) :
QWidget(parent)
{
_row_num = 0;
_dec = dec;
_decoder_stack = decoder_stack;
_widget = new QWidget(this);
@@ -88,6 +90,8 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
_layout->addWidget(_show_button, 0, 2);
_row_num++;
// add row show/hide
int index = 0;
@@ -107,6 +111,8 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
_layout->addWidget(show_button, _row_show_button.size(), 2);
}
index++;
_row_num++;
}
_layout->addLayout(dec_layout, _row_show_button.size()+1, 0, 1, 3);

View File

@@ -52,6 +52,10 @@ public:
~DecoderGroupBox();
bool eventFilter(QObject *o, QEvent *e);
inline int get_row_count(){
return _row_num;
}
signals:
void show_hide_decoder();
void show_hide_row();
@@ -72,6 +76,7 @@ private:
QPushButton *_del_button;
QPushButton *_show_button;
std::list <QPushButton *> _row_show_button;
int _row_num;
};
} // widgets