// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MainWindow::createGroupDisplay:
//
// Create group box for displaying images.
//
QGroupBox*
MainWindow::createGroupDisplay()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox;
	groupBox->setMinimumWidth (700);
	groupBox->setMinimumHeight(700);
	groupBox->setStyleSheet(GroupBoxStyle);

	// create stacked widget for input/output images
	m_stackWidgetImages = new QStackedWidget;

	// add QLabels to image stacked widget to display input/output images
	for(int i = 0; i<2; ++i)
		m_stackWidgetImages->addWidget(new QLabel);

	// add centering alignment on both labels
	QLabel *label;
	label = (QLabel *) m_stackWidgetImages->widget(0); label->setAlignment(Qt::AlignCenter);
	label = (QLabel *) m_stackWidgetImages->widget(1); label->setAlignment(Qt::AlignCenter);

	// set stacked widget to default setting: input image
	m_stackWidgetImages->setCurrentIndex(0);

	// assemble stacked widget in vertical layout
	QVBoxLayout *vbox = new QVBoxLayout;
	vbox->addWidget(m_stackWidgetImages);
	groupBox->setLayout(vbox);

	return groupBox;
}
Exemple #2
0
void RatingWidget::createWidget()
{
	createLineEditWidget();
	createLineEditWidgetRate();

	m_CustomPlot = new CustomPlot(m_Rate, this);
	m_CustomPlot->setFocusPolicy(Qt::ClickFocus);

	QPushButton	*buttonRate = new QPushButton(tr("Oceń"), this);
	buttonRate->setDefault(true);
	//button->setAutoDefault(true);
	buttonRate->setShortcut(QKeySequence(Qt::Key_Return));
	buttonRate->setStatusTip(tr("Oceń stan izolacji"));
	connect(buttonRate, SIGNAL(clicked()), this, SLOT(rate()));

	QPushButton	*buttonInitialValue = new QPushButton(tr("Wartości początkowe"), this);
	buttonInitialValue->setStatusTip(tr("Przywróć wartości początkowe"));
	connect(buttonInitialValue, SIGNAL(clicked()), this, SLOT(restoreInitialValue()));

	QPushButton	*buttonPlotValue = new QPushButton(tr("Wartości z wykresu"), this);
	buttonPlotValue->setStatusTip(tr("Ustaw wartości z wykresu"));
	connect(buttonPlotValue, SIGNAL(clicked()), this, SLOT(setPlotValue()));

	QHBoxLayout *bLay = new QHBoxLayout(this);
	bLay->addWidget(buttonRate);
	bLay->addWidget(buttonInitialValue);
	bLay->addWidget(buttonPlotValue);

	QGroupBox *buttonBox = new QGroupBox(this);
	buttonBox->setLayout(bLay);

	QGridLayout *gBox = new QGridLayout(this);
	gBox->addWidget(m_LineEdit, 0, 0);
	gBox->addWidget(m_LineEditRate, 0, 1);
	gBox->addWidget(buttonBox, 1, 0);

	QGroupBox *groupBox = new QGroupBox(this);
	groupBox->setLayout(gBox);
	groupBox->setMinimumHeight(260);
	groupBox->setMaximumHeight(260);

	m_MainBox = new QVBoxLayout(this);
	m_MainBox->addWidget(groupBox);
	m_MainBox->addWidget(m_CustomPlot);
}