mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-29 23:40:51 +01:00
BorderPropertiesWridget: replace widget made with C++ by widget build by ui file.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3203 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
93
sources/ui/borderpropertieswidget.cpp
Normal file
93
sources/ui/borderpropertieswidget.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "borderpropertieswidget.h"
|
||||
#include "ui_borderpropertieswidget.h"
|
||||
#include "diagram.h"
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::BorderPropertiesWidget
|
||||
* default constructor
|
||||
* @param bp properties
|
||||
* @param parent paretn widget
|
||||
*/
|
||||
BorderPropertiesWidget::BorderPropertiesWidget(const BorderProperties &bp, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BorderPropertiesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setProperties(bp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::~BorderPropertiesWidget
|
||||
* default destructor
|
||||
*/
|
||||
BorderPropertiesWidget::~BorderPropertiesWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::setProperties
|
||||
* Set the current properties to edit
|
||||
* @param bp properties to edit
|
||||
*/
|
||||
void BorderPropertiesWidget::setProperties(const BorderProperties &bp) {
|
||||
m_properties = bp;
|
||||
ui -> m_colums_count_sp ->setValue (m_properties.columns_count);
|
||||
ui -> m_columns_width_sp ->setValue (m_properties.columns_width);
|
||||
ui -> m_display_columns_cb ->setChecked (m_properties.display_columns);
|
||||
ui -> m_rows_count_sp ->setValue (m_properties.rows_count);
|
||||
ui -> m_rows_height_sp ->setValue (m_properties.rows_height);
|
||||
ui -> m_display_rows_cb ->setChecked (m_properties.display_rows);
|
||||
ui -> m_grey_bg_cb ->setChecked (Diagram::background_color != Qt::white);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::properties
|
||||
* @return the edited border properties
|
||||
*/
|
||||
const BorderProperties &BorderPropertiesWidget::properties () {
|
||||
m_properties.columns_count = ui -> m_colums_count_sp -> value();
|
||||
m_properties.columns_width = ui -> m_columns_width_sp -> value();
|
||||
m_properties.display_columns = ui -> m_display_columns_cb -> isChecked();
|
||||
m_properties.rows_count = ui -> m_rows_count_sp -> value();
|
||||
m_properties.rows_height = ui -> m_rows_height_sp -> value();
|
||||
m_properties.display_rows = ui -> m_display_rows_cb -> isChecked();
|
||||
return m_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::setReadOnly
|
||||
* Enable or disable this widget
|
||||
* @param ro true-disable / false-enable
|
||||
*/
|
||||
void BorderPropertiesWidget::setReadOnly(const bool &ro) {
|
||||
ui->border_gb->setDisabled(ro);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::on_m_grey_bg_cb_clicked
|
||||
* @param checked
|
||||
*/
|
||||
void BorderPropertiesWidget::on_m_grey_bg_cb_clicked(bool checked) {
|
||||
if (checked)
|
||||
Diagram::background_color = Qt::gray;
|
||||
else
|
||||
Diagram::background_color = Qt::white;
|
||||
}
|
||||
52
sources/ui/borderpropertieswidget.h
Normal file
52
sources/ui/borderpropertieswidget.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef BORDERPROPERTIESWIDGET_H
|
||||
#define BORDERPROPERTIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "borderproperties.h"
|
||||
|
||||
namespace Ui {
|
||||
class BorderPropertiesWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The BorderPropertiesWidget class
|
||||
* this widget edit the properties of a border
|
||||
*/
|
||||
class BorderPropertiesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BorderPropertiesWidget(const BorderProperties &bp, QWidget *parent = 0);
|
||||
~BorderPropertiesWidget();
|
||||
|
||||
void setProperties(const BorderProperties &bp);
|
||||
const BorderProperties &properties();
|
||||
void setReadOnly (const bool &ro);
|
||||
|
||||
private slots:
|
||||
void on_m_grey_bg_cb_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::BorderPropertiesWidget *ui;
|
||||
BorderProperties m_properties;
|
||||
};
|
||||
|
||||
#endif // BORDERPROPERTIESWIDGET_H
|
||||
104
sources/ui/borderpropertieswidget.ui
Normal file
104
sources/ui/borderpropertieswidget.ui
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BorderPropertiesWidget</class>
|
||||
<widget class="QWidget" name="BorderPropertiesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="border_gb">
|
||||
<property name="title">
|
||||
<string>Dimensions du schéma</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="m_rows_height_sp">
|
||||
<property name="suffix">
|
||||
<string comment="pixel" extracomment="pixel">px</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>x</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Lignes :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QCheckBox" name="m_grey_bg_cb">
|
||||
<property name="text">
|
||||
<string>Gris</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Colonnes :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Couleur de fond :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCheckBox" name="m_display_rows_cb">
|
||||
<property name="text">
|
||||
<string>Afficher les en-têtes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="m_columns_width_sp">
|
||||
<property name="suffix">
|
||||
<string comment="pixel" extracomment="pixel">px</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>x</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_rows_count_sp"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="m_display_columns_cb">
|
||||
<property name="text">
|
||||
<string>Afficher les en-têtes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_colums_count_sp"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user