コード例 #1
0
ContourLinesEditor::ContourLinesEditor(const QLocale& locale, int precision, QWidget* parent)
				: QWidget(parent),
                                  table(NULL),
                                  insertBtn(NULL),
                                  deleteBtn(NULL),
                                  d_spectrogram(NULL),
                                  d_locale(locale),
                                  d_precision(precision),
                                  penDialog(NULL),
                                  penColorBox(NULL),
                                  penStyleBox(NULL),
                                  penWidthBox(NULL),
                                  applyAllColorBox(NULL),
                                  applyAllWidthBox(NULL),
                                  applyAllStyleBox(NULL),
                                  d_pen_index(0),
                                  d_pen_list()
{
	table = new QTableWidget();
	table->setColumnCount(2);
	table->hideColumn(1);
	table->setSelectionMode(QAbstractItemView::SingleSelection);
	table->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	table->horizontalHeader()->setClickable( false );
	table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
	table->viewport()->setMouseTracking(true);
	table->viewport()->installEventFilter(this);
	table->setHorizontalHeaderLabels(QStringList() << tr("Level") << tr("Pen"));
	table->setMinimumHeight(6*table->horizontalHeader()->height() + 2);
	table->installEventFilter(this);

	connect(table, SIGNAL(cellClicked (int, int)), this, SLOT(showPenDialog(int, int)));

	insertBtn = new QPushButton(tr("&Insert"));
	insertBtn->setEnabled(false);
	connect(insertBtn, SIGNAL(clicked()), this, SLOT(insertLevel()));

	deleteBtn = new QPushButton(tr("&Delete"));
	deleteBtn->setEnabled(false);
	connect(deleteBtn, SIGNAL(clicked()), this, SLOT(deleteLevel()));

	QHBoxLayout* hb = new QHBoxLayout();
	hb->addWidget(insertBtn);
	hb->addWidget(deleteBtn);

	QVBoxLayout* vl = new QVBoxLayout(this);
	vl->setSpacing(0);
	vl->addWidget(table);
	vl->addLayout(hb);

	setFocusProxy(table);
	setMaximumWidth(200);

	penDialog = NULL;
}
コード例 #2
0
ColorMapEditor::ColorMapEditor(const QLocale& locale, int precision, QWidget* parent)
: QWidget(parent),
  color_map(QwtLinearColorMap()),
  min_val(0),
  max_val(1),
  d_locale(locale),
  d_precision(precision)
{
  table = new QTableWidget();
  table->setColumnCount(2);
  table->setSelectionMode(QAbstractItemView::SingleSelection);
  table->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
  table->verticalHeader()->hide();
  table->horizontalHeader()->setClickable( false );
  table->horizontalHeader()->setResizeMode(0, QHeaderView::Interactive);
  table->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
  table->horizontalHeader()->setStretchLastSection(true);
  table->viewport()->setMouseTracking(true);
  table->viewport()->installEventFilter(this);
  table->setHorizontalHeaderLabels(QStringList() << tr("Level") << tr("Color"));
  table->setMinimumHeight(6*table->horizontalHeader()->height() + 2);
  table->installEventFilter(this);

  connect(table, SIGNAL(cellClicked (int, int)), this, SLOT(showColorDialog(int, int)));

  insertBtn = new QPushButton(tr("&Insert"));
  insertBtn->setEnabled(false);
  connect(insertBtn, SIGNAL(clicked()), this, SLOT(insertLevel()));

  deleteBtn = new QPushButton(tr("&Delete"));
  deleteBtn->setEnabled(false);
  connect(deleteBtn, SIGNAL(clicked()), this, SLOT(deleteLevel()));

  QHBoxLayout* hb = new QHBoxLayout();
  hb->addWidget(insertBtn);
  hb->addWidget(deleteBtn);

  scaleColorsBox = new QCheckBox(tr("&Scale Colors"));
  scaleColorsBox->setChecked(true);
  connect(scaleColorsBox, SIGNAL(toggled(bool)), this, SLOT(setScaledColors(bool)));

  QVBoxLayout* vl = new QVBoxLayout(this);
  vl->setSpacing(0);
  vl->addWidget(table);
  vl->addLayout(hb);
  vl->addWidget(scaleColorsBox);

  setFocusProxy(table);
  setMaximumWidth(200);
}