if (v->has_toolbar())
dock_main->addToolBar(v->create_toolbar(dock_main));
+ if (v->minimum_width() > 0)
+ dock->setMinimumSize(v->minimum_width(), 0);
+
return v;
}
#include <algorithm>
+#include <QApplication>
#include <QDebug>
+#include <QFontMetrics>
#include <QInputDialog>
#include <QLabel>
#include <QLineEdit>
namespace subwindows {
namespace decoder_selector {
+const QString initial_notice = QApplication::tr("Select a decoder to see its description here.");
+const int min_width_margin = 75;
+
bool QCustomSortFilterProxyModel::filterAcceptsRow(int source_row,
const QModelIndex& source_parent) const
info_label_header_->setTextInteractionFlags(flags);
info_label_body_->setWordWrap(true);
info_label_body_->setTextInteractionFlags(flags);
- info_label_body_->setText(tr("Select a decoder to see its description here."));
+ info_label_body_->setText(initial_notice);
info_label_footer_->setWordWrap(true);
info_label_footer_->setTextInteractionFlags(flags);
return toolbar;
}
+int SubWindow::minimum_width() const
+{
+ QFontMetrics m(info_label_body_->font());
+ const int label_width = m.width(initial_notice);
+
+ return label_width + min_width_margin;
+}
+
vector<const char*> SubWindow::get_decoder_inputs(const srd_decoder* d) const
{
vector<const char*> ret_val;
bool has_toolbar() const;
QToolBar* create_toolbar(QWidget *parent) const;
+ int minimum_width() const;
+
/**
* Returns a list of input types that a given protocol decoder requires
* ("logic", "uart", etc.)