[TASK] Finally add cool scrollbars to the tabs.

This commit is contained in:
Jan Philipp Timme 2015-11-23 14:52:20 +01:00
parent 282fa987ed
commit e37bc42143
2 changed files with 91 additions and 57 deletions

View File

@ -482,9 +482,17 @@ void ImageViewer::succeedingHistogrammAdaption() {
void ImageViewer::generateControlPanels() { void ImageViewer::generateControlPanels() {
// Tab for first task // Tab for first task
task_tab_widget1 = new QWidget(); task_tab1_widget = new QWidget();
task_tab1 = new QVBoxLayout(); task_tab1_vboxlayout = new QVBoxLayout();
task_tab_widget1->setLayout(task_tab1); task_tab1_widget->setLayout(task_tab1_vboxlayout);
task_tab1_scrollwidget = new QWidget();
task_tab1_scrollarea = new QScrollArea();
task_tab1_scrollarea->setWidgetResizable(true);
task_tab1_scrollarea->setWidget(task_tab1_scrollwidget);
task_tab1_vboxlayout->addWidget(task_tab1_scrollarea);
task_tab1_scrolllayout = new QVBoxLayout();
task_tab1_scrolllayout->setSizeConstraint(QLayout::SetMaximumSize);
task_tab1_scrollwidget->setLayout(task_tab1_scrolllayout);
monochrome = new QPushButton(); monochrome = new QPushButton();
monochrome->setText("Convert to monochrome"); monochrome->setText("Convert to monochrome");
@ -516,23 +524,31 @@ void ImageViewer::generateControlPanels() {
line_slider->setValue(3); line_slider->setValue(3);
//QObject::connect(lineSlider, SIGNAL(valueChanged(int)), this, SLOT (drawRainbowCross())); //QObject::connect(lineSlider, SIGNAL(valueChanged(int)), this, SLOT (drawRainbowCross()));
task_tab1->addWidget(reset_working_copy); task_tab1_scrolllayout->addWidget(reset_working_copy);
task_tab1->addWidget(save_to_original); task_tab1_scrolllayout->addWidget(save_to_original);
task_tab1->addWidget(monochrome); task_tab1_scrolllayout->addWidget(monochrome);
task_tab1->addWidget(new QLabel("Let's draw something!")); task_tab1_scrolllayout->addWidget(new QLabel("Let's draw something!"));
task_tab1->addWidget(draw_black_line); task_tab1_scrolllayout->addWidget(draw_black_line);
task_tab1->addWidget(draw_rainbow_cross); task_tab1_scrolllayout->addWidget(draw_rainbow_cross);
task_tab1->addWidget(diagonal_cross); task_tab1_scrolllayout->addWidget(diagonal_cross);
task_tab1->addWidget(line_slider); task_tab1_scrolllayout->addWidget(line_slider);
task_tab1->addWidget(new QLabel("Sets the width of the cross.")); task_tab1_scrolllayout->addWidget(new QLabel("Sets the width of the cross."));
tabWidget->addTab(task_tab_widget1, "Task #1"); tabWidget->addTab(task_tab1_widget, "Task #1");
//Tab for second task // Tab for second task
task_tab_widget2 = new QWidget(); task_tab2_widget = new QWidget();
task_tab2 = new QVBoxLayout(); task_tab2_vboxlayout = new QVBoxLayout();
task_tab_widget2->setLayout(task_tab2); task_tab2_widget->setLayout(task_tab2_vboxlayout);
task_tab2_scrollwidget = new QWidget();
task_tab2_scrollarea = new QScrollArea();
task_tab2_scrollarea->setWidgetResizable(true);
task_tab2_scrollarea->setWidget(task_tab2_scrollwidget);
task_tab2_vboxlayout->addWidget(task_tab2_scrollarea);
task_tab2_scrolllayout = new QVBoxLayout();
task_tab2_scrolllayout->setSizeConstraint(QLayout::SetMaximumSize);
task_tab2_scrollwidget->setLayout(task_tab2_scrolllayout);
reference_histogramm_label = new QLabel(); reference_histogramm_label = new QLabel();
reference_histogramm_label->setBackgroundRole(QPalette::Base); reference_histogramm_label->setBackgroundRole(QPalette::Base);
@ -580,29 +596,38 @@ void ImageViewer::generateControlPanels() {
contrast_percentile_slider->setValue(10); contrast_percentile_slider->setValue(10);
QObject::connect(contrast_percentile_slider, SIGNAL(valueChanged(int)), this, SLOT(robustAutomaticContrastAdaption(int))); QObject::connect(contrast_percentile_slider, SIGNAL(valueChanged(int)), this, SLOT(robustAutomaticContrastAdaption(int)));
task_tab2->addWidget(new QLabel("Reference image")); task_tab2_scrolllayout->addWidget(new QLabel("Reference image"));
task_tab2->addWidget(reference_stats); task_tab2_scrolllayout->addWidget(reference_stats);
task_tab2->addWidget(reference_histogramm_label); task_tab2_scrolllayout->addWidget(reference_histogramm_label);
task_tab2->addWidget(new QLabel("Original image")); task_tab2_scrolllayout->addWidget(new QLabel("Original image"));
task_tab2->addWidget(original_stats); task_tab2_scrolllayout->addWidget(original_stats);
task_tab2->addWidget(original_histogramm_label); task_tab2_scrolllayout->addWidget(original_histogramm_label);
task_tab2->addWidget(new QLabel("Working copy")); task_tab2_scrolllayout->addWidget(new QLabel("Working copy"));
task_tab2->addWidget(stats); task_tab2_scrolllayout->addWidget(stats);
task_tab2->addWidget(histogramm_label); task_tab2_scrolllayout->addWidget(histogramm_label);
task_tab2->addWidget(analyze_image); task_tab2_scrolllayout->addWidget(analyze_image);
task_tab2->addWidget(new QLabel("Brightness")); task_tab2_scrolllayout->addWidget(new QLabel("Brightness"));
task_tab2->addWidget(brightness_slider); task_tab2_scrolllayout->addWidget(brightness_slider);
task_tab2->addWidget(new QLabel("Contrast")); task_tab2_scrolllayout->addWidget(new QLabel("Contrast"));
task_tab2->addWidget(contrast_slider); task_tab2_scrolllayout->addWidget(contrast_slider);
task_tab2->addWidget(new QLabel("Automatic Contrast Percentile")); task_tab2_scrolllayout->addWidget(new QLabel("Automatic Contrast Percentile"));
task_tab2->addWidget(contrast_percentile_slider); task_tab2_scrolllayout->addWidget(contrast_percentile_slider);
tabWidget->addTab(task_tab_widget2, "Task #2"); tabWidget->addTab(task_tab2_widget, "Task #2");
//Tab for third task
task_tab_widget3 = new QWidget(); // Tab for third task
task_tab3 = new QVBoxLayout(); task_tab3_widget = new QWidget();
task_tab_widget3->setLayout(task_tab3); task_tab3_vboxlayout = new QVBoxLayout();
task_tab3_widget->setLayout(task_tab3_vboxlayout);
task_tab3_scrollwidget = new QWidget();
task_tab3_scrollarea = new QScrollArea();
task_tab3_scrollarea->setWidgetResizable(true);
task_tab3_scrollarea->setWidget(task_tab3_scrollwidget);
task_tab3_vboxlayout->addWidget(task_tab3_scrollarea);
task_tab3_scrolllayout = new QVBoxLayout();
task_tab3_scrolllayout->setSizeConstraint(QLayout::SetMaximumSize);
task_tab3_scrollwidget->setLayout(task_tab3_scrolllayout);
reference_histogramm_cumulative_label = new QLabel(); reference_histogramm_cumulative_label = new QLabel();
reference_histogramm_cumulative_label->setBackgroundRole(QPalette::Base); reference_histogramm_cumulative_label->setBackgroundRole(QPalette::Base);
@ -634,18 +659,18 @@ void ImageViewer::generateControlPanels() {
succeeding_histogramm_adaption = new QPushButton("Do succeeding histogramm adaption"); succeeding_histogramm_adaption = new QPushButton("Do succeeding histogramm adaption");
QObject::connect(succeeding_histogramm_adaption, SIGNAL(clicked()), this, SLOT(succeedingHistogrammAdaption())); QObject::connect(succeeding_histogramm_adaption, SIGNAL(clicked()), this, SLOT(succeedingHistogrammAdaption()));
task_tab3->addWidget(new QLabel("Reference image")); task_tab3_scrolllayout->addWidget(new QLabel("Reference image"));
task_tab3->addWidget(reference_histogramm_cumulative_label); task_tab3_scrolllayout->addWidget(reference_histogramm_cumulative_label);
task_tab3->addWidget(new QLabel("Original image")); task_tab3_scrolllayout->addWidget(new QLabel("Original image"));
task_tab3->addWidget(original_histogramm_cumulative_label); task_tab3_scrolllayout->addWidget(original_histogramm_cumulative_label);
task_tab3->addWidget(new QLabel("Working copy")); task_tab3_scrolllayout->addWidget(new QLabel("Working copy"));
task_tab3->addWidget(histogramm_cumulative_label); task_tab3_scrolllayout->addWidget(histogramm_cumulative_label);
task_tab3->addWidget(linear_histogramm_adaption); task_tab3_scrolllayout->addWidget(linear_histogramm_adaption);
task_tab3->addWidget(partial_adaption_pieces_slider); task_tab3_scrolllayout->addWidget(partial_adaption_pieces_slider);
task_tab3->addWidget(partial_linear_histogramm_adaption); task_tab3_scrolllayout->addWidget(partial_linear_histogramm_adaption);
task_tab3->addWidget(succeeding_histogramm_adaption); task_tab3_scrolllayout->addWidget(succeeding_histogramm_adaption);
tabWidget->addTab(task_tab_widget3, "Task #3"); tabWidget->addTab(task_tab3_widget, "Task #3");
//Show it //Show it
tabWidget->show(); tabWidget->show();

View File

@ -72,8 +72,11 @@ class ImageViewer : public QMainWindow {
private: private:
// First task tab // First task tab
QWidget* task_tab_widget1; QWidget* task_tab1_widget;
QVBoxLayout* task_tab1; QVBoxLayout* task_tab1_vboxlayout;
QWidget* task_tab1_scrollwidget;
QScrollArea* task_tab1_scrollarea;
QVBoxLayout* task_tab1_scrolllayout;
QPushButton* draw_black_line; QPushButton* draw_black_line;
QPushButton* draw_rainbow_cross; QPushButton* draw_rainbow_cross;
@ -85,9 +88,12 @@ class ImageViewer : public QMainWindow {
QSlider* line_slider; QSlider* line_slider;
// Second task tab // Second task tab
QWidget* task_tab_widget2; QWidget* task_tab2_widget;
QVBoxLayout* task_tab2; QVBoxLayout* task_tab2_vboxlayout;
QWidget* task_tab2_scrollwidget;
QScrollArea* task_tab2_scrollarea;
QVBoxLayout* task_tab2_scrolllayout;
QLabel* reference_stats; QLabel* reference_stats;
QLabel* original_stats; QLabel* original_stats;
QLabel* stats; QLabel* stats;
@ -102,9 +108,12 @@ class ImageViewer : public QMainWindow {
QSlider* contrast_percentile_slider; QSlider* contrast_percentile_slider;
// Third task tab // Third task tab
QWidget* task_tab_widget3; QWidget* task_tab3_widget;
QVBoxLayout* task_tab3; QVBoxLayout* task_tab3_vboxlayout;
QWidget* task_tab3_scrollwidget;
QScrollArea* task_tab3_scrollarea;
QVBoxLayout* task_tab3_scrolllayout;
QLabel* reference_histogramm_cumulative_label; QLabel* reference_histogramm_cumulative_label;
QLabel* original_histogramm_cumulative_label; QLabel* original_histogramm_cumulative_label;
QLabel* histogramm_cumulative_label; QLabel* histogramm_cumulative_label;