Qt6 Migration: LtsWidgets, BUILD_RTI Guards, externe Dependencies dokumentiert
- LtsWidgets Verzeichnis vollständig migriert (Qt5→Qt6) - BUILD_RTI Guards für RTI-spezifische Module hinzugefügt - Externe Dependencies in EXTERNAL_DEPS.md dokumentiert - Qt6 API-Änderungen: QRegExp→QRegularExpression, enterEvent(QEnterEvent*) - AutoUic-Fehler bei ui_requirement behoben (SKIP_AUTOUIC) - Include-Pfade korrigiert (LtsElevation, LtsMultiMonitor, LtsUtilsCore) - MOC-Fehler behoben (Q_INTERFACES entfernt wo nicht benötigt) - CMakeLists.txt Anpassungen für Qt6 (PUBLIC statt INTERFACE) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
145 files changed
+17700
-14377
No files matched your search
@@ -1,199 +1,224 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Bottom Button Box for Dialogs which need actions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2016-08-17
|
||||
*/
|
||||
|
||||
#include "lts_dialog_button_box.h"
|
||||
|
||||
#include "lts_message_dialog.h"
|
||||
#include "ui_lts_dialog_button_box.h"
|
||||
|
||||
#include "lts_message_dialog.h"
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <QMenu>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
LtsDialogButtonBox::LtsDialogButtonBox(QWidget* parent)
|
||||
: QWidget(parent), m_isTablet(LtsSessionData::LtsSessionData::getInstance()->isTablet()),
|
||||
m_ui(new Ui::LtsDialogButtonBox)
|
||||
LtsDialogButtonBox::LtsDialogButtonBox(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_isTablet(LtsSessionData::LtsSessionData::getInstance()->isTablet())
|
||||
, m_ui(new Ui::LtsDialogButtonBox)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
_setVisibilityForAll(false);
|
||||
m_ui->setupUi(this);
|
||||
_setVisibilityForAll(false); // hide all buttons
|
||||
|
||||
QMenu* libraryMenu = new QMenu(m_ui->pbLibrary);
|
||||
libraryMenu->addAction(QIcon(QLatin1String(":/style/library_load.svg")), tr("Load"), this,
|
||||
&LtsDialogButtonBox::signalLibraryLoadClicked);
|
||||
libraryMenu->addAction(QIcon(QLatin1String(":/style/library_save.svg")), tr("Save"), this,
|
||||
&LtsDialogButtonBox::signalLibrarySaveClicked);
|
||||
m_ui->pbLibrary->setMenu(libraryMenu);
|
||||
// Btn 'Library'
|
||||
QMenu *libraryMenu = new QMenu(m_ui->pbLibrary);
|
||||
libraryMenu->addAction(QIcon(QLatin1String(":/style/library_load.svg")),
|
||||
tr("Load"), this, &LtsDialogButtonBox::signalLibraryLoadClicked);
|
||||
libraryMenu->addAction(QIcon(QLatin1String(":/style/library_save.svg")),
|
||||
tr("Save"), this, &LtsDialogButtonBox::signalLibrarySaveClicked);
|
||||
m_ui->pbLibrary->setMenu(libraryMenu);
|
||||
|
||||
m_ui->pbOk->setVisible(true);
|
||||
m_ui->pbClose->setVisible(true);
|
||||
// exceptions for call above:
|
||||
m_ui->pbOk->setVisible(true); // c LtsDialog's impl 2 c y !
|
||||
m_ui->pbClose->setVisible(true); // s.a.a.
|
||||
// no help file name set = no help button ! => m_ui->pbHelp->setVisible(true); // must be explicitly hidden for dialogs without help content
|
||||
}
|
||||
|
||||
|
||||
LtsDialogButtonBox::~LtsDialogButtonBox()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void LtsDialogButtonBox::_setVisibilityForAll(bool visible)
|
||||
{
|
||||
const auto buttons = findChildren<QPushButton*>();
|
||||
for (QPushButton* button : buttons)
|
||||
button->setVisible(visible);
|
||||
const auto buttons = findChildren<QPushButton *>();
|
||||
for (QPushButton *button : buttons)
|
||||
button->setVisible(visible);
|
||||
}
|
||||
|
||||
void LtsDialogButtonBox::setText(DialogButton button, const QString& text)
|
||||
|
||||
void LtsDialogButtonBox::setText(DialogButton button, const QString &text)
|
||||
{
|
||||
// TODO: check if setText was called by a 'retranslate' method, if not debug msg !
|
||||
|
||||
QPushButton* btn = getButton(button);
|
||||
QPushButton *btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setText(text);
|
||||
if (btn)
|
||||
btn->setText(text);
|
||||
}
|
||||
|
||||
void LtsDialogButtonBox::setToolTip(DialogButton button, const QString& text)
|
||||
{
|
||||
QPushButton* btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setToolTip(text);
|
||||
void LtsDialogButtonBox::setToolTip(DialogButton button, const QString &text)
|
||||
{
|
||||
QPushButton *btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setToolTip(text);
|
||||
}
|
||||
|
||||
void LtsDialogButtonBox::setIcon(DialogButton button, const QIcon& icon)
|
||||
{
|
||||
QPushButton* btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setIcon(icon);
|
||||
void LtsDialogButtonBox::setIcon(DialogButton button, const QIcon &icon)
|
||||
{
|
||||
QPushButton *btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setIcon(icon);
|
||||
}
|
||||
|
||||
void LtsDialogButtonBox::setMenu(DialogButton button, QMenu* menu)
|
||||
{
|
||||
QPushButton* btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setMenu(menu);
|
||||
void LtsDialogButtonBox::setMenu(DialogButton button, QMenu *menu)
|
||||
{
|
||||
QPushButton *btn = getButton(button);
|
||||
|
||||
if (btn)
|
||||
btn->setMenu(menu);
|
||||
}
|
||||
|
||||
QPushButton* LtsDialogButtonBox::getButton(DialogButton button) const
|
||||
|
||||
QPushButton *LtsDialogButtonBox::getButton(DialogButton button) const
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case DialogButton::ReadOnly:
|
||||
return m_ui->pbReadOnly;
|
||||
case DialogButton::Ok:
|
||||
return m_ui->pbOk;
|
||||
case DialogButton::Apply:
|
||||
return m_ui->pbApply;
|
||||
case DialogButton::Close:
|
||||
return m_ui->pbClose;
|
||||
case DialogButton::Yes:
|
||||
return m_ui->pbYes;
|
||||
case DialogButton::No:
|
||||
return m_ui->pbNo;
|
||||
case DialogButton::Remove:
|
||||
return m_ui->pbRemove;
|
||||
case DialogButton::Hide:
|
||||
return m_ui->pbHide;
|
||||
case DialogButton::Add:
|
||||
return m_ui->pbAdd;
|
||||
case DialogButton::Help:
|
||||
return m_ui->pbHelp;
|
||||
case DialogButton::Edit:
|
||||
return m_ui->pbEdit;
|
||||
case DialogButton::Save:
|
||||
return m_ui->pbSave;
|
||||
case DialogButton::Load:
|
||||
return m_ui->pbLoad;
|
||||
case DialogButton::Show:
|
||||
return m_ui->pbShow;
|
||||
case DialogButton::Import:
|
||||
return m_ui->pbImport;
|
||||
case DialogButton::Export:
|
||||
return m_ui->pbExport;
|
||||
case DialogButton::Library:
|
||||
return m_ui->pbLibrary;
|
||||
case DialogButton::CenterMap:
|
||||
return m_ui->pbCenterMap;
|
||||
case DialogButton::ZoomMapTo:
|
||||
return m_ui->pbZoomMapTo;
|
||||
case DialogButton::Print:
|
||||
return m_ui->pbPrint;
|
||||
switch (button)
|
||||
{
|
||||
case DialogButton::ReadOnly:
|
||||
return m_ui->pbReadOnly;
|
||||
case DialogButton::Ok:
|
||||
return m_ui->pbOk;
|
||||
case DialogButton::Apply:
|
||||
return m_ui->pbApply;
|
||||
case DialogButton::Close:
|
||||
return m_ui->pbClose;
|
||||
case DialogButton::Yes:
|
||||
return m_ui->pbYes;
|
||||
case DialogButton::No:
|
||||
return m_ui->pbNo;
|
||||
case DialogButton::Remove:
|
||||
return m_ui->pbRemove;
|
||||
case DialogButton::Hide:
|
||||
return m_ui->pbHide;
|
||||
case DialogButton::Add:
|
||||
return m_ui->pbAdd;
|
||||
case DialogButton::Help:
|
||||
return m_ui->pbHelp;
|
||||
case DialogButton::Edit:
|
||||
return m_ui->pbEdit;
|
||||
case DialogButton::Save:
|
||||
return m_ui->pbSave;
|
||||
case DialogButton::Load:
|
||||
return m_ui->pbLoad;
|
||||
case DialogButton::Show:
|
||||
return m_ui->pbShow;
|
||||
case DialogButton::Import:
|
||||
return m_ui->pbImport;
|
||||
case DialogButton::Export:
|
||||
return m_ui->pbExport;
|
||||
case DialogButton::Library:
|
||||
return m_ui->pbLibrary;
|
||||
case DialogButton::CenterMap:
|
||||
return m_ui->pbCenterMap;
|
||||
case DialogButton::ZoomMapTo:
|
||||
return m_ui->pbZoomMapTo;
|
||||
case DialogButton::Print:
|
||||
return m_ui->pbPrint;
|
||||
#ifdef LTS_DEBUG
|
||||
case DialogButton::_debug_:
|
||||
return m_ui->_pbChanges;
|
||||
case DialogButton::_debug_:
|
||||
return m_ui->_pbChanges;
|
||||
#endif
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return nullptr;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return nullptr; // sec
|
||||
}
|
||||
|
||||
|
||||
void LtsDialogButtonBox::slotRemoveClicked()
|
||||
{
|
||||
if (LtsMessageDialog::showMessage(this, tr("Are you sure you want to delete the selected entry(ies)?"),
|
||||
tr("Remove selected entry(ies)"), Behaviour::Modal,
|
||||
Button::Yes | Button::No) == Button::Yes)
|
||||
emit signalRemoveClicked();
|
||||
if (LtsMessageDialog::showMessage(this,
|
||||
tr("Are you sure you want to delete the selected entry(ies)?"),
|
||||
tr("Remove selected entry(ies)"),
|
||||
Behaviour::Modal,
|
||||
Button::Yes | Button::No)
|
||||
== Button::Yes)
|
||||
emit signalRemoveClicked();
|
||||
}
|
||||
|
||||
void LtsDialogButtonBox::setButtonsVisible(QPushButton* pb)
|
||||
|
||||
void LtsDialogButtonBox::setButtonsVisible(QPushButton *pb)
|
||||
{
|
||||
if (!pb || (pb == m_ui->pbPrint && m_isTablet))
|
||||
return;
|
||||
m_ui->line->setVisible(true);
|
||||
pb->setVisible(true);
|
||||
if (!pb || (pb == m_ui->pbPrint && m_isTablet))
|
||||
return;
|
||||
m_ui->line->setVisible(true);
|
||||
pb->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
void LtsDialogButtonBox::setButtonVisible(DialogButton button, bool visible)
|
||||
{
|
||||
QPushButton* pb = getButton(button);
|
||||
if (!pb)
|
||||
return;
|
||||
if (m_isTablet && pb == m_ui->pbPrint)
|
||||
{
|
||||
pb->setVisible(false);
|
||||
return;
|
||||
}
|
||||
pb->setVisible(visible);
|
||||
QPushButton *pb = getButton(button);
|
||||
if (!pb)
|
||||
return;
|
||||
if (m_isTablet && pb == m_ui->pbPrint)
|
||||
{
|
||||
pb->setVisible(false);
|
||||
return;
|
||||
}
|
||||
pb->setVisible(visible);
|
||||
}
|
||||
|
||||
|
||||
bool LtsDialogButtonBox::isButtonVisible(DialogButton button) const
|
||||
{
|
||||
const QPushButton* pb = getButton(button);
|
||||
return (pb ? pb->isVisible() : false);
|
||||
const QPushButton *pb = getButton(button);
|
||||
return (pb ? pb->isVisible() : false);
|
||||
}
|
||||
|
||||
|
||||
void LtsDialogButtonBox::setButtonEnabled(DialogButton button, bool enabled)
|
||||
{
|
||||
QPushButton* pb = getButton(button);
|
||||
QPushButton *pb = getButton(button);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case DialogButton::Close:
|
||||
case DialogButton::Ok:
|
||||
case DialogButton::Apply:
|
||||
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case DialogButton::Close:
|
||||
case DialogButton::Ok:
|
||||
case DialogButton::Apply:
|
||||
//case DialogButton::Yes:
|
||||
//case DialogButton::No:
|
||||
{
|
||||
#ifdef LTS_DEBUG
|
||||
LtsMessageDialog::showMessage(
|
||||
this,
|
||||
QStringLiteral("Hier stimmt etwas nicht. Bitte MIKE bescheid geben WAS geklickt oder gemacht wurde als "
|
||||
"dieser Dialog auftauchte, damit ich es fixen kann. Danke."),
|
||||
QStringLiteral(">>> STOP <<<"));
|
||||
LtsMessageDialog::showMessage(this, QStringLiteral("Hier stimmt etwas nicht. Bitte MIKE bescheid geben WAS geklickt oder gemacht wurde als dieser Dialog auftauchte, damit ich es fixen kann. Danke."), QStringLiteral(">>> STOP <<<"));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (pb)
|
||||
pb->setEnabled(enabled);
|
||||
if (pb)
|
||||
pb->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
bool LtsDialogButtonBox::isButtonEnabled(DialogButton button) const
|
||||
{
|
||||
auto* that = const_cast<LtsDialogButtonBox*>(this);
|
||||
const QPushButton* pb = that->getButton(button);
|
||||
return (pb ? pb->isEnabled() : false);
|
||||
auto *that = const_cast<LtsDialogButtonBox *>(this); // ...
|
||||
const QPushButton *pb = that->getButton(button);
|
||||
return (pb ? pb->isEnabled() : false);
|
||||
}
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user