mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
Revamp terminalStrip feature code
Move RealTerminal class in a new file Move PhysicalTerminal class in a new file. Remove the use of QWeakPointer and use instead QSharedPointer in a big part of the revamp.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include "sortterminalstripcommand.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../physicalterminal.h"
|
||||
#include "../realterminal.h"
|
||||
#include "../../utils/qetutils.h"
|
||||
|
||||
SortTerminalStripCommand::SortTerminalStripCommand(TerminalStrip *strip, QUndoCommand *parent) :
|
||||
@@ -24,22 +26,22 @@ SortTerminalStripCommand::SortTerminalStripCommand(TerminalStrip *strip, QUndoCo
|
||||
m_strip(strip)
|
||||
{
|
||||
setText(QObject::tr("Trier le bornier %1").arg(m_strip->name()));
|
||||
m_old_order = QETUtils::weakVectorToShared(m_strip->physicalTerminal());
|
||||
m_new_order = QETUtils::weakVectorToShared(m_strip->physicalTerminal());
|
||||
m_old_order = m_strip->physicalTerminal();
|
||||
m_new_order = m_strip->physicalTerminal();
|
||||
sort();
|
||||
}
|
||||
|
||||
void SortTerminalStripCommand::undo()
|
||||
{
|
||||
if (m_strip) {
|
||||
m_strip->setOrderTo(QETUtils::sharedVectorToWeak(m_old_order));
|
||||
m_strip->setOrderTo(m_old_order);
|
||||
}
|
||||
}
|
||||
|
||||
void SortTerminalStripCommand::redo()
|
||||
{
|
||||
if (m_strip) {
|
||||
m_strip->setOrderTo(QETUtils::sharedVectorToWeak(m_new_order));
|
||||
m_strip->setOrderTo(m_new_order);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +58,7 @@ void SortTerminalStripCommand::sort()
|
||||
|
||||
if (arg1->realTerminalCount())
|
||||
{
|
||||
str1 = arg1->realTerminals().constLast().toStrongRef()->label();
|
||||
str1 = arg1->realTerminals().constLast()->label();
|
||||
|
||||
auto match = rx.match(str1);
|
||||
if (match.hasMatch()) {
|
||||
@@ -66,7 +68,7 @@ void SortTerminalStripCommand::sort()
|
||||
|
||||
if (arg2->realTerminalCount())
|
||||
{
|
||||
str2 = arg2->realTerminals().constLast().toStrongRef()->label();
|
||||
str2 = arg2->realTerminals().constLast()->label();
|
||||
|
||||
auto match = rx.match(str2);
|
||||
if (match.hasMatch()) {
|
||||
|
||||
Reference in New Issue
Block a user