Skip to content

Commit

Permalink
Setting up a good-work interface and added a scaled pixmap
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkonrom committed Oct 2, 2017
1 parent 8716faf commit ce22e1d
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 96 deletions.
25 changes: 21 additions & 4 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
this->setWindowTitle("Imager");
connect(ui->keepAspectRatioCheckBox, &QCheckBox::stateChanged, [&](int state)
{
ui->inputLabel->setKeepAspectRatioEnabled(state == Qt::Checked);
ui->outputLabel->setKeepAspectRatioEnabled(state == Qt::Checked);
});

connect(ui->overscaleCheckBox, &QCheckBox::stateChanged, [&](int state)
{
ui->inputLabel->setOverscaleEnabled(state == Qt::Checked);
ui->outputLabel->setOverscaleEnabled(state == Qt::Checked);
});

connect(ui->loadButton, &QPushButton::clicked, [&]()
{
ui->inputLabel->loadPixmapData(QFileDialog::getOpenFileName(this));
});

createActions();
}

Expand Down Expand Up @@ -84,7 +101,7 @@ static void initializeImageFileDialog(QFileDialog &dialog, QFileDialog::AcceptMo
if (acceptMode == QFileDialog::AcceptSave)
dialog.setDefaultSuffix("jpg");
}

/*
void MainWindow::on_actionOpen_triggered()
{
QFileDialog dialog(this, tr("Open File"));
Expand All @@ -97,13 +114,13 @@ void MainWindow::on_loadButton_clicked()
{
MainWindow::on_actionOpen_triggered();
}

*/

void MainWindow::on_boudaries_button_clicked()
{

Boundaries boundaries_operation;
boundaries_operation.setImage(inputImage);
boundaries_operation.setImage(ui->inputLabel->pixmap().toImage());
outputImage = boundaries_operation.execute(ui->horizontalSlider->value());
ui->outputLabel->setPixmap(QPixmap::fromImage(outputImage));
ui->outputLabel->loadPixmapData(QPixmap::fromImage(outputImage));
}
4 changes: 2 additions & 2 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class MainWindow : public QMainWindow
~MainWindow();

private slots:
void on_actionOpen_triggered();
/* void on_actionOpen_triggered();
void on_loadButton_clicked();
void on_loadButton_clicked();*/

void on_boudaries_button_clicked();

Expand Down
210 changes: 120 additions & 90 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="inputLabel">
<widget class="ScaledPixmap" name="inputLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -46,9 +46,9 @@
</widget>
</item>
<item>
<widget class="QLabel" name="outputLabel">
<widget class="ScaledPixmap" name="outputLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -68,67 +68,60 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="controlls_layout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="buttons_layout">
<item>
<widget class="QPushButton" name="boudaries_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Boundaries</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="segmentation_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Semantic Segmentation</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>PushButton</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
<widget class="QPushButton" name="boudaries_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Boundaries</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="segmentation_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Semantic Segmentation</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>PushButton</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
Expand All @@ -146,6 +139,46 @@
</property>
</spacer>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="page_9">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Boundaries options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Intensity of distinction:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
Expand All @@ -160,38 +193,22 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="overscaleCheckBox">
<property name="text">
<string>Ignore orgignal scales</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="keepAspectRatioCheckBox">
<property name="text">
<string>Maintain proportions</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
Expand All @@ -211,6 +228,12 @@
</layout>
</item>
</layout>
<zorder>stackedWidget</zorder>
<zorder>keepAspectRatioCheckBox</zorder>
<zorder></zorder>
<zorder>inputLabel</zorder>
<zorder>outputLabel</zorder>
<zorder></zorder>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
Expand Down Expand Up @@ -245,10 +268,17 @@
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>ScaledPixmap</class>
<extends>QLabel</extends>
<header>scaledpixmap.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>loadButton</tabstop>
<tabstop>checkBox</tabstop>
<tabstop>checkBox_2</tabstop>
<tabstop>overscaleCheckBox</tabstop>
<tabstop>keepAspectRatioCheckBox</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down
Loading

0 comments on commit ce22e1d

Please sign in to comment.