mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Animate show and replace widget.
this feature is totally useless and by consequent indispensable.
This commit is contained in:
parent
f4cbf21075
commit
9525278be7
@ -71,6 +71,8 @@ include(sources/PropertiesEditor/PropertiesEditor.pri)
|
||||
include(sources/QetGraphicsItemModeler/QetGraphicsItemModeler.pri)
|
||||
include(sources/QPropertyUndoCommand/QPropertyUndoCommand.pri)
|
||||
include(SingleApplication/singleapplication.pri)
|
||||
include(sources/QWidgetAnimation/QWidgetAnimation.pri)
|
||||
|
||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
||||
|
||||
TEMPLATE = app
|
||||
@ -280,3 +282,6 @@ macx {
|
||||
unix {
|
||||
QMAKE_COPY_DIR = 'cp -f -r --preserve=timestamps'
|
||||
}
|
||||
|
||||
SUBDIRS += \
|
||||
sources/QwidgetAnimation/QWidgetAnimation.pro
|
||||
|
5
sources/QWidgetAnimation/QWidgetAnimation.pri
Normal file
5
sources/QWidgetAnimation/QWidgetAnimation.pri
Normal file
@ -0,0 +1,5 @@
|
||||
HEADERS += \
|
||||
$$PWD/qwidgetanimation.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qwidgetanimation.cpp
|
162
sources/QWidgetAnimation/qwidgetanimation.cpp
Normal file
162
sources/QWidgetAnimation/qwidgetanimation.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
Copyright 2006-2020 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 "qwidgetanimation.h"
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::QWidgetAnimation
|
||||
* @param widget : widget to animate
|
||||
* @param orientation : animate widget horizontally or vertically
|
||||
* @param duration : the duration of animation @see void QVariantAnimation::setDuration(int msecs)
|
||||
*/
|
||||
QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior, int duration) :
|
||||
QPropertyAnimation(widget),
|
||||
m_orientation(orientation),
|
||||
m_widget(widget),
|
||||
m_maximum(widget->maximumSize()),
|
||||
m_last_rect(widget->geometry()),
|
||||
m_behavior(behavior)
|
||||
{
|
||||
setTargetObject(widget);
|
||||
setPropertyName( m_orientation == Qt::Vertical ? "maximumHeight" : "maximumWidth");
|
||||
setDuration(duration);
|
||||
setEasingCurve(QEasingCurve::OutCubic);
|
||||
|
||||
connect(this, &QPropertyAnimation::finished, [this]()
|
||||
{
|
||||
m_state = QWidgetAnimation::Finish;
|
||||
|
||||
if ( (this->m_orientation == Qt::Vertical && m_widget->geometry().height() == 0) ||
|
||||
(this->m_orientation == Qt::Horizontal && m_widget->geometry().width() == 0) ) {
|
||||
m_widget->hide();
|
||||
} else {
|
||||
m_widget->setMaximumSize(m_maximum);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::widgetToSubtract
|
||||
* Widget to subtract the size when the behavior is availableSpace
|
||||
* @param widgets
|
||||
*/
|
||||
void QWidgetAnimation::widgetToSubtract(QVector<QWidget *> widgets)
|
||||
{
|
||||
m_widget_to_substract.clear();
|
||||
m_widget_to_substract = widgets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::show
|
||||
* show the widget
|
||||
*/
|
||||
void QWidgetAnimation::show()
|
||||
{
|
||||
if (m_state == QWidgetAnimation::Showing)
|
||||
return;
|
||||
|
||||
stop();
|
||||
|
||||
m_widget->show();
|
||||
|
||||
int end_value = 10000;
|
||||
if (m_behavior == QWidgetAnimation::minimumSizeHint)
|
||||
{
|
||||
end_value = m_orientation == Qt::Horizontal ? m_widget->minimumSizeHint().width() :
|
||||
m_widget->minimumSizeHint().height();
|
||||
}
|
||||
else if (m_behavior == QWidgetAnimation::availableSpace && m_widget->parentWidget())
|
||||
{
|
||||
m_widget->parentWidget()->layout();
|
||||
int available_ = m_orientation == Qt::Horizontal ? m_widget->parentWidget()->width() :
|
||||
m_widget->parentWidget()->height();
|
||||
for (auto w : m_widget_to_substract) {
|
||||
available_ -= m_orientation == Qt::Horizontal ? w->minimumSizeHint().width() :
|
||||
w->minimumSizeHint().height();
|
||||
}
|
||||
|
||||
int mini_ = m_orientation == Qt::Horizontal ? m_widget->minimumSizeHint().width() :
|
||||
m_widget->minimumSizeHint().height();
|
||||
|
||||
end_value = available_ > mini_ ? available_ : mini_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_last_rect.isValid()) {
|
||||
end_value = m_orientation == Qt::Horizontal ? m_last_rect.width() :
|
||||
m_last_rect.height();
|
||||
} else {
|
||||
end_value = m_orientation == Qt::Horizontal ? m_maximum.width() :
|
||||
m_maximum.height();
|
||||
}
|
||||
}
|
||||
|
||||
setStartValue(0);
|
||||
setEndValue(end_value);
|
||||
m_state = QWidgetAnimation::Showing;
|
||||
start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::hide
|
||||
* Hide the widget
|
||||
*/
|
||||
void QWidgetAnimation::hide()
|
||||
{
|
||||
if (m_state == QWidgetAnimation::Hidding)
|
||||
return;
|
||||
|
||||
if (m_state == Finish && m_widget->isVisible()) {
|
||||
m_last_rect = m_widget->geometry();
|
||||
}
|
||||
|
||||
stop();
|
||||
int start_value = m_orientation == Qt::Horizontal ? m_widget->width() :
|
||||
m_widget->height();
|
||||
setStartValue(start_value);
|
||||
setEndValue(0);
|
||||
m_state = QWidgetAnimation::Hidding;
|
||||
start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::setHidden
|
||||
* true hide, false show
|
||||
* @param hidden
|
||||
*/
|
||||
void QWidgetAnimation::setHidden(bool hidden)
|
||||
{
|
||||
if (hidden)
|
||||
hide();
|
||||
else
|
||||
show();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QWidgetAnimation::setLastShowSize
|
||||
* Force the last show size value to @size
|
||||
* @param size
|
||||
*/
|
||||
void QWidgetAnimation::setLastShowSize(int size)
|
||||
{
|
||||
if (m_orientation == Qt::Vertical) {
|
||||
m_last_rect.setHeight(size);
|
||||
} else {
|
||||
m_last_rect.setWidth(size);
|
||||
}
|
||||
}
|
73
sources/QWidgetAnimation/qwidgetanimation.h
Normal file
73
sources/QWidgetAnimation/qwidgetanimation.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright 2006-2020 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 QWIDGETANIMATION_H
|
||||
#define QWIDGETANIMATION_H
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
#include <QSize>
|
||||
#include <QRect>
|
||||
|
||||
/**
|
||||
* @brief The QWidgetAnimation class
|
||||
* This class animate the show and hide function of a QWidget.
|
||||
*
|
||||
* The role of @behavior is to calcul as best the animation process when widget is show.
|
||||
* Because this class don't change the current and final size of the widget but her maximum size during the animation process,
|
||||
* we must to know in advance the final size of the widget.
|
||||
* Behavior minimumSizeHint : the final size of the widget will be his minimum size hint.
|
||||
* Behavior availableSpace : the final size of widget will be the available size of her parent.
|
||||
* Since parent can have other widgets you can add a QVector of widget to subtract of the final size.
|
||||
* Because we suppose the animated widget will take the maximum available space, we subtract the minimum size hint of widgets in QVector.
|
||||
* Behavior lastSize : The widget will have the same size as the last time he was showed.
|
||||
*/
|
||||
class QWidgetAnimation : public QPropertyAnimation
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Behavior {
|
||||
minimumSizeHint,
|
||||
availableSpace,
|
||||
lastSize,
|
||||
};
|
||||
|
||||
QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior = QWidgetAnimation::minimumSizeHint, int duration = 250);
|
||||
void widgetToSubtract (QVector<QWidget *> widgets);
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
void setHidden(bool hidden);
|
||||
void setLastShowSize(int size);
|
||||
|
||||
private:
|
||||
enum currentState {
|
||||
Showing,
|
||||
Hidding,
|
||||
Finish
|
||||
};
|
||||
|
||||
Qt::Orientation m_orientation = Qt::Horizontal;
|
||||
QVector <QWidget *> m_widget_to_substract;
|
||||
QWidget *m_widget;
|
||||
QSize m_maximum;
|
||||
QRect m_last_rect;
|
||||
QWidgetAnimation::Behavior m_behavior = Behavior::minimumSizeHint;
|
||||
QWidgetAnimation::currentState m_state = QWidgetAnimation::Finish;
|
||||
};
|
||||
|
||||
#endif // QWIDGETANIMATION_H
|
@ -44,6 +44,13 @@ SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
|
||||
ui(new Ui::SearchAndReplaceWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_horizontal_animation = new QWidgetAnimation(ui->m_advanced_button_widget, Qt::Horizontal, QWidgetAnimation::minimumSizeHint, 250);
|
||||
m_vertical_animation = new QWidgetAnimation(ui->m_advanced_widget, Qt::Vertical, QWidgetAnimation::availableSpace, 250);
|
||||
QVector<QWidget *> v;
|
||||
v << ui->m_header_widget;
|
||||
m_vertical_animation->widgetToSubtract(v);
|
||||
|
||||
setHideAdvanced(true);
|
||||
setUpTreeItems();
|
||||
|
||||
@ -70,7 +77,6 @@ bool SearchAndReplaceWidget::event(QEvent *event)
|
||||
if (event->type() == QEvent::Hide)
|
||||
{
|
||||
clear();
|
||||
setHideAdvanced(true);
|
||||
if (m_highlighted_element)
|
||||
{
|
||||
m_highlighted_element.data()->setHighlighted(false);
|
||||
@ -204,20 +210,10 @@ void SearchAndReplaceWidget::setUpTreeItems()
|
||||
* Hide advanced widgets
|
||||
* @param hide
|
||||
*/
|
||||
void SearchAndReplaceWidget::setHideAdvanced(bool hide) const
|
||||
void SearchAndReplaceWidget::setHideAdvanced(bool hide)
|
||||
{
|
||||
ui->m_advanced_pb ->setChecked(!hide);
|
||||
ui->m_replace ->setHidden(hide);
|
||||
ui->m_replace_le ->setHidden(hide);
|
||||
ui->m_folio_pb ->setHidden(hide);
|
||||
ui->m_element_pb ->setHidden(hide);
|
||||
ui->m_conductor_pb ->setHidden(hide);
|
||||
ui->m_tree_widget ->setHidden(hide);
|
||||
ui->m_replace_pb ->setHidden(hide);
|
||||
ui->m_replace_all_pb ->setHidden(hide);
|
||||
ui->m_mode_cb ->setHidden(hide);
|
||||
ui->m_case_sensitive_cb->setHidden(hide);
|
||||
ui->m_advanced_replace_pb->setHidden(hide);
|
||||
m_vertical_animation->setHidden(hide);
|
||||
m_horizontal_animation->setHidden(hide);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "element.h"
|
||||
#include "independenttextitem.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
#include "QWidgetAnimation/qwidgetanimation.h"
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
@ -39,7 +40,7 @@ class SearchAndReplaceWidget : public QWidget
|
||||
|
||||
public:
|
||||
explicit SearchAndReplaceWidget(QWidget *parent = nullptr);
|
||||
~SearchAndReplaceWidget();
|
||||
~SearchAndReplaceWidget() override;
|
||||
|
||||
bool event(QEvent *event) override;
|
||||
void clear();
|
||||
@ -47,7 +48,7 @@ class SearchAndReplaceWidget : public QWidget
|
||||
|
||||
private:
|
||||
void setUpTreeItems();
|
||||
void setHideAdvanced(bool hide) const;
|
||||
void setHideAdvanced(bool hide);
|
||||
void fillItemsList();
|
||||
void addElement(Element *element);
|
||||
void search();
|
||||
@ -109,6 +110,8 @@ class SearchAndReplaceWidget : public QWidget
|
||||
QPointer<QGraphicsObject> m_last_selected;
|
||||
QHash<QTreeWidgetItem *, QPointer <Diagram>> m_diagram_hash;
|
||||
SearchAndReplaceWorker m_worker;
|
||||
QWidgetAnimation *m_vertical_animation;
|
||||
QWidgetAnimation *m_horizontal_animation;
|
||||
};
|
||||
|
||||
#endif // SEARCHANDREPLACEWIDGET_H
|
||||
|
@ -6,22 +6,331 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>970</width>
|
||||
<height>436</height>
|
||||
<width>989</width>
|
||||
<height>661</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,1" columnstretch="0,0,1,0,0,0,0,0,0,0,0,0,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="m_search">
|
||||
<property name="text">
|
||||
<string>Chercher :</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0" columnstretch="0,0">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="m_header_widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_search">
|
||||
<property name="text">
|
||||
<string>Chercher :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_search_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_advanced_button_widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_mode_cb">
|
||||
<property name="toolTip">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Texte brut</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mots entiers</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_case_sensitive_cb">
|
||||
<property name="text">
|
||||
<string>Sensible à la casse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_next_pb">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance suivante</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-bottom.png</normaloff>:/ico/16x16/go-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_previous_pb">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance précédente</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-top.png</normaloff>:/ico/16x16/go-top.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_reload_pb">
|
||||
<property name="toolTip">
|
||||
<string>Actualiser</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_advanced_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Afficher les options avancées</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/configure-toolbars.png</normaloff>:/ico/16x16/configure-toolbars.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="m_advanced_widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="m_element_pb">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les éléments</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Élément</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="m_conductor_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les conducteurs</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QPushButton" name="m_replace_all_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remplacer les correspondances cochées</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tout remplacer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="m_advanced_replace_pb">
|
||||
<property name="text">
|
||||
<string>avancé</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_replace">
|
||||
<property name="text">
|
||||
<string>Remplacer :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_folio_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les folios</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Folio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_replace_le">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Champ texte de folio</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QPushButton" name="m_replace_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remplacer la correspondance sélectionnée</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remplacer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="9">
|
||||
<widget class="QTreeWidget" name="m_tree_widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="m_quit_button">
|
||||
<property name="toolTip">
|
||||
<string>Quitter</string>
|
||||
@ -38,217 +347,18 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QComboBox" name="m_mode_cb">
|
||||
<property name="toolTip">
|
||||
<string>Mode</string>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Texte brut</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mots entiers</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QCheckBox" name="m_case_sensitive_cb">
|
||||
<property name="text">
|
||||
<string>Sensible à la casse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="m_replace">
|
||||
<property name="text">
|
||||
<string>Remplacer :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QPushButton" name="m_next_pb">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance suivante</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-bottom.png</normaloff>:/ico/16x16/go-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QPushButton" name="m_previous_pb">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance précédente</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-top.png</normaloff>:/ico/16x16/go-top.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<widget class="QPushButton" name="m_advanced_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Afficher les options avancées</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/configure-toolbars.png</normaloff>:/ico/16x16/configure-toolbars.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="QPushButton" name="m_reload_pb">
|
||||
<property name="toolTip">
|
||||
<string>Actualiser</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="m_replace_le">
|
||||
<property name="placeholderText">
|
||||
<string>Champ texte de folio</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="m_folio_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les folios</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Folio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="m_element_pb">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les éléments</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Élément</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="m_conductor_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Définir les propriétés à remplacer dans les conducteurs</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9" colspan="2">
|
||||
<widget class="QPushButton" name="m_replace_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remplacer la correspondance sélectionnée</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remplacer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="11" colspan="2">
|
||||
<widget class="QPushButton" name="m_replace_all_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remplacer les correspondances cochées</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tout remplacer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="13">
|
||||
<widget class="QTreeWidget" name="m_tree_widget">
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="m_advanced_replace_pb">
|
||||
<property name="text">
|
||||
<string>avancé</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="5">
|
||||
<widget class="QLineEdit" name="m_search_le">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "qetgraphicstableitem.h"
|
||||
#include "bomexportdialog.h"
|
||||
#include "nomenclaturemodel.h"
|
||||
#include "QWidgetAnimation/qwidgetanimation.h"
|
||||
|
||||
#include <KAutoSaveFile>
|
||||
|
||||
@ -66,9 +67,17 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
splitter_->setOrientation(Qt::Vertical);
|
||||
splitter_->addWidget(&m_workspace);
|
||||
splitter_->addWidget(&m_search_and_replace_widget);
|
||||
m_search_and_replace_widget.setHidden(true);
|
||||
m_search_and_replace_widget.setEditor(this);
|
||||
setCentralWidget(splitter_);
|
||||
m_search_and_replace_widget.setEditor(this);
|
||||
|
||||
QList<int> s;
|
||||
s << m_workspace.maximumHeight() << m_search_and_replace_widget.minimumSizeHint().height();
|
||||
splitter_->setSizes(s); //Force the size of the search and replace widget, force have a good animation the first time he is showed
|
||||
|
||||
auto anim = new QWidgetAnimation(&m_search_and_replace_widget, Qt::Vertical, QWidgetAnimation::lastSize, 250);
|
||||
anim->setObjectName("search and replace animator");
|
||||
m_search_and_replace_widget.setHidden(true);
|
||||
anim->setLastShowSize(m_search_and_replace_widget.minimumSizeHint().height());
|
||||
|
||||
//Set object name to be retrieved by the stylesheets
|
||||
m_workspace.setBackground(QBrush(Qt::NoBrush));
|
||||
@ -654,8 +663,13 @@ void QETDiagramEditor::setUpActions()
|
||||
|
||||
m_find = new QAction(tr("Chercher/remplacer"), this);
|
||||
m_find->setShortcut(QKeySequence::Find);
|
||||
connect(m_find, &QAction::triggered, [this]() {
|
||||
this->m_search_and_replace_widget.setHidden(!m_search_and_replace_widget.isHidden());
|
||||
connect(m_find, &QAction::triggered, [this]()
|
||||
{
|
||||
if (auto animator = m_search_and_replace_widget.findChild<QWidgetAnimation *>("search and replace animator")) {
|
||||
animator->setHidden(!m_search_and_replace_widget.isHidden());
|
||||
} else {
|
||||
this->m_search_and_replace_widget.setHidden(!m_search_and_replace_widget.isHidden());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user