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
+146
-134
@@ -1,215 +1,227 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Crop pictures
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Raphael Becker
|
||||
*/
|
||||
|
||||
#include "lts_picture_editing.h"
|
||||
|
||||
#include "lts_picture_view.h"
|
||||
#include "ui_lts_picture_editing.h"
|
||||
#include "lts_picture_view.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QImage>
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QImage>
|
||||
#include <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QTimer>
|
||||
|
||||
LtsPictureEditing::LtsPictureEditing(QWidget* parent)
|
||||
: QMainWindow(parent), m_gvPicture(nullptr), m_ui(new Ui::PictureEditing)
|
||||
LtsPictureEditing::LtsPictureEditing(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, m_gvPicture(nullptr)
|
||||
, m_ui(new Ui::PictureEditing)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
connect(m_ui->actionOpen, &QAction::triggered, this, &LtsPictureEditing::onOpenImage);
|
||||
connect(m_ui->actionSave, &QAction::triggered, this, &LtsPictureEditing::onSavePicture);
|
||||
connect(m_ui->actionQuit, &QAction::triggered, this, &LtsPictureEditing::close);
|
||||
connect(m_ui->pbSetSize, &QPushButton::clicked, this, &LtsPictureEditing::onSetSize);
|
||||
m_ui->setupUi(this);
|
||||
connect(m_ui->actionOpen, &QAction::triggered, this, &LtsPictureEditing::onOpenImage);
|
||||
connect(m_ui->actionSave, &QAction::triggered, this, &LtsPictureEditing::onSavePicture);
|
||||
connect(m_ui->actionQuit, &QAction::triggered, this, &LtsPictureEditing::close);
|
||||
connect(m_ui->pbSetSize, &QPushButton::clicked, this, &LtsPictureEditing::onSetSize);
|
||||
|
||||
connect(m_ui->sbHeight, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRatioChanged);
|
||||
connect(m_ui->sbWidth, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRatioChanged);
|
||||
connect(m_ui->chbRatio, &QPushButton::clicked, this, &LtsPictureEditing::onRatioClicked);
|
||||
connect(m_ui->sbHeight, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRatioChanged);
|
||||
connect(m_ui->sbWidth, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRatioChanged);
|
||||
connect(m_ui->chbRatio, &QPushButton::clicked, this, &LtsPictureEditing::onRatioClicked);
|
||||
|
||||
connect(m_ui->sbXMin, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onLeftChanged);
|
||||
connect(m_ui->sbXMax, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRightChanged);
|
||||
connect(m_ui->sbYMin, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onTopChanged);
|
||||
connect(m_ui->sbYMax, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onBottomChanged);
|
||||
connect(m_ui->sbXMin, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onLeftChanged);
|
||||
connect(m_ui->sbXMax, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onRightChanged);
|
||||
connect(m_ui->sbYMin, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onTopChanged);
|
||||
connect(m_ui->sbYMax, QOverload<int>::of(&QSpinBox::valueChanged), this, &LtsPictureEditing::onBottomChanged);
|
||||
|
||||
addViewToFrame();
|
||||
addViewToFrame();
|
||||
|
||||
connect(this, &LtsPictureEditing::leftChanged, m_gvPicture, &LtsWidgets::LtsPictureView::leftChanged);
|
||||
connect(this, &LtsPictureEditing::rightChanged, m_gvPicture, &LtsWidgets::LtsPictureView::rightChanged);
|
||||
connect(this, &LtsPictureEditing::topChanged, m_gvPicture, &LtsWidgets::LtsPictureView::topChanged);
|
||||
connect(this, &LtsPictureEditing::bottomChanged, m_gvPicture, &LtsWidgets::LtsPictureView::bottomChanged);
|
||||
connect(this, &LtsPictureEditing::leftChanged, m_gvPicture, &LtsWidgets::LtsPictureView::leftChanged);
|
||||
connect(this, &LtsPictureEditing::rightChanged, m_gvPicture, &LtsWidgets::LtsPictureView::rightChanged);
|
||||
connect(this, &LtsPictureEditing::topChanged, m_gvPicture, &LtsWidgets::LtsPictureView::topChanged);
|
||||
connect(this, &LtsPictureEditing::bottomChanged, m_gvPicture, &LtsWidgets::LtsPictureView::bottomChanged);
|
||||
|
||||
connect(this, &LtsPictureEditing::setAspectRatio, m_gvPicture, &LtsWidgets::LtsPictureView::setAspectRatio);
|
||||
connect(this, &LtsPictureEditing::ratioClicked, m_gvPicture, &LtsWidgets::LtsPictureView::ratioClicked);
|
||||
connect(this, &LtsPictureEditing::setAspectRatio, m_gvPicture, &LtsWidgets::LtsPictureView::setAspectRatio);
|
||||
connect(this, &LtsPictureEditing::ratioClicked, m_gvPicture, &LtsWidgets::LtsPictureView::ratioClicked);
|
||||
|
||||
connect(m_gvPicture, &LtsWidgets::LtsPictureView::mouseMoved, this, &LtsPictureEditing::setSpinboxValues);
|
||||
connect(m_gvPicture, &LtsWidgets::LtsPictureView::setLimits, this, &LtsPictureEditing::setSpinboxLimits);
|
||||
connect(this, &LtsPictureEditing::setPicture, m_gvPicture, &LtsWidgets::LtsPictureView::setPicture);
|
||||
connect(m_gvPicture, &LtsWidgets::LtsPictureView::mouseMoved, this, &LtsPictureEditing::setSpinboxValues);
|
||||
connect(m_gvPicture, &LtsWidgets::LtsPictureView::setLimits, this, &LtsPictureEditing::setSpinboxLimits);
|
||||
connect(this, &LtsPictureEditing::setPicture, m_gvPicture, &LtsWidgets::LtsPictureView::setPicture);
|
||||
|
||||
onRatioChanged();
|
||||
onRatioChanged();
|
||||
}
|
||||
|
||||
LtsPictureEditing::~LtsPictureEditing()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void LtsPictureEditing::addViewToFrame()
|
||||
{
|
||||
QHBoxLayout* layout(new QHBoxLayout(m_ui->frPicFrame));
|
||||
m_gvPicture = new LtsWidgets::LtsPictureView(m_ui->frPicFrame);
|
||||
layout->addWidget(m_gvPicture);
|
||||
m_gvPicture->setEnabled(false);
|
||||
QHBoxLayout *layout(new QHBoxLayout(m_ui->frPicFrame));
|
||||
m_gvPicture = new LtsWidgets::LtsPictureView(m_ui->frPicFrame);
|
||||
layout->addWidget(m_gvPicture);
|
||||
m_gvPicture->setEnabled(false);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onOpenImage()
|
||||
{
|
||||
const QStringList filter({tr("Images (*.jpg *.jpeg *.png)")});
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), QStringLiteral("../picture_editing"),
|
||||
filter.join(QStringLiteral(";;")));
|
||||
const QStringList filter ({
|
||||
tr("Images (*.jpg *.jpeg *.png)")
|
||||
});
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Image"),
|
||||
QStringLiteral("../picture_editing"),
|
||||
filter.join(QStringLiteral(";;")));
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
if (!fi.isReadable())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"),
|
||||
tr("An error occurred while loading the file.\n"
|
||||
"The loaded file is not readable."));
|
||||
return;
|
||||
}
|
||||
QFileInfo fi(fileName);
|
||||
if (!fi.isReadable())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"), tr("An error occurred while loading the file.\n"
|
||||
"The loaded file is not readable."));
|
||||
return;
|
||||
}
|
||||
|
||||
QImage pic;
|
||||
pic.load(fileName);
|
||||
if (pic.isNull())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"),
|
||||
tr("An error occurred while loading the file.\n"
|
||||
"The loaded file is no picture file.\n"
|
||||
"Please load *.jpg, *.jpeg, *.png files only."));
|
||||
return;
|
||||
}
|
||||
m_image = pic;
|
||||
emit setPicture(pic, QPoint(0, 0), true);
|
||||
m_gvPicture->setEnabled(true);
|
||||
m_gvPicture->newRubberBand();
|
||||
QImage pic;
|
||||
pic.load(fileName);
|
||||
if (pic.isNull())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"), tr("An error occurred while loading the file.\n"
|
||||
"The loaded file is no picture file.\n"
|
||||
"Please load *.jpg, *.jpeg, *.png files only."));
|
||||
return;
|
||||
}
|
||||
m_image = pic;
|
||||
emit setPicture(pic, QPoint(0, 0), true);
|
||||
m_gvPicture->setEnabled(true);
|
||||
m_gvPicture->newRubberBand();
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onSetSize()
|
||||
{
|
||||
if (m_image.isNull())
|
||||
return;
|
||||
if (m_image.isNull())
|
||||
return;
|
||||
|
||||
m_gvPicture->hideRubberband();
|
||||
m_gvPicture->hideRubberband();
|
||||
|
||||
int xMin = m_ui->sbXMin->value() - 1;
|
||||
int yMin = m_ui->sbYMin->value() - 1;
|
||||
int xMax = m_ui->sbXMax->value() - 1;
|
||||
int yMax = m_ui->sbYMax->value() - 1;
|
||||
int xMin = m_ui->sbXMin->value() - 1;
|
||||
int yMin = m_ui->sbYMin->value() - 1;
|
||||
int xMax = m_ui->sbXMax->value() - 1;
|
||||
int yMax = m_ui->sbYMax->value() - 1;
|
||||
|
||||
if (xMax < xMin || yMax < yMin || xMax == xMin || yMax == yMin)
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
if (xMax < xMin || yMax < yMin || xMax == xMin || yMax == yMin)
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QRect picRect(xMin, yMin, xMax - xMin, yMax - yMin);
|
||||
QImage newPic = m_image.copy(picRect);
|
||||
emit setPicture(newPic, QPoint(xMin, yMin), false);
|
||||
QRect picRect(xMin,
|
||||
yMin,
|
||||
xMax - xMin,
|
||||
yMax - yMin);
|
||||
QImage newPic = m_image.copy(picRect);
|
||||
emit setPicture(newPic, QPoint(xMin, yMin), false);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onSavePicture()
|
||||
{
|
||||
if (m_gvPicture->getImage()->pixmap().isNull())
|
||||
if (m_gvPicture->getImage()->pixmap().isNull())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"), tr("An error occurred while saving the picture\n"
|
||||
"Please load a picture before saving it."));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Open Image"), QLatin1String("../picture_editing"),
|
||||
tr("Images (*.jpg *.jpeg *.png)"));
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"),
|
||||
tr("An error occurred while saving the picture\n"
|
||||
"Please load a picture before saving it."));
|
||||
return;
|
||||
QMessageBox::warning(this, tr("Error!"), tr("An error occurred while saving the picture.\n"
|
||||
"Please choose a valid path to save the picture."));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Open Image"), QLatin1String("../picture_editing"),
|
||||
tr("Images (*.jpg *.jpeg *.png)"));
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error!"),
|
||||
tr("An error occurred while saving the picture.\n"
|
||||
"Please choose a valid path to save the picture."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_gvPicture->getImage()->pixmap().save(filename, "PNG");
|
||||
}
|
||||
m_gvPicture->getImage()->pixmap().save(filename, "PNG");
|
||||
}
|
||||
}
|
||||
|
||||
void LtsPictureEditing::setSpinboxLimits(const QSize& picSize, bool setValues)
|
||||
void LtsPictureEditing::setSpinboxLimits(const QSize &picSize, bool setValues)
|
||||
{
|
||||
m_ui->sbXMin->setMaximum(picSize.width());
|
||||
m_ui->sbXMax->setMaximum(picSize.width());
|
||||
m_ui->sbYMin->setMaximum(picSize.height());
|
||||
m_ui->sbYMax->setMaximum(picSize.height());
|
||||
m_ui->sbXMin->setMaximum(picSize.width());
|
||||
m_ui->sbXMax->setMaximum(picSize.width());
|
||||
m_ui->sbYMin->setMaximum(picSize.height());
|
||||
m_ui->sbYMax->setMaximum(picSize.height());
|
||||
|
||||
if (setValues)
|
||||
{
|
||||
m_ui->sbXMin->setValue(0);
|
||||
m_ui->sbYMin->setValue(0);
|
||||
m_ui->sbXMax->setValue(picSize.width() - 1);
|
||||
m_ui->sbYMax->setValue(picSize.height() - 1);
|
||||
}
|
||||
if (setValues)
|
||||
{
|
||||
m_ui->sbXMin->setValue(0);
|
||||
m_ui->sbYMin->setValue(0);
|
||||
m_ui->sbXMax->setValue(picSize.width() - 1);
|
||||
m_ui->sbYMax->setValue(picSize.height() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsPictureEditing::setSpinboxValues(const QRect& picRect)
|
||||
void LtsPictureEditing::setSpinboxValues(const QRect &picRect)
|
||||
{
|
||||
m_ui->sbXMin->setValue(picRect.left());
|
||||
m_ui->sbYMin->setValue(picRect.top());
|
||||
m_ui->sbXMax->setValue(picRect.right());
|
||||
m_ui->sbYMax->setValue(picRect.bottom());
|
||||
m_ui->sbXMin->setValue(picRect.left());
|
||||
m_ui->sbYMin->setValue(picRect.top());
|
||||
m_ui->sbXMax->setValue(picRect.right());
|
||||
m_ui->sbYMax->setValue(picRect.bottom());
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onRatioChanged()
|
||||
{
|
||||
double ratio = double(m_ui->sbWidth->value()) / double(m_ui->sbHeight->value());
|
||||
emit setAspectRatio(ratio);
|
||||
double ratio = double(m_ui->sbWidth->value()) / double(m_ui->sbHeight->value());
|
||||
emit setAspectRatio(ratio);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onRatioClicked()
|
||||
{
|
||||
if (m_ui->chbRatio->isChecked())
|
||||
{
|
||||
m_ui->sbHeight->setEnabled(true);
|
||||
m_ui->sbWidth->setEnabled(true);
|
||||
emit ratioClicked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->sbHeight->setEnabled(false);
|
||||
m_ui->sbWidth->setEnabled(false);
|
||||
emit ratioClicked(false);
|
||||
}
|
||||
if (m_ui->chbRatio->isChecked())
|
||||
{
|
||||
m_ui->sbHeight->setEnabled(true);
|
||||
m_ui->sbWidth->setEnabled(true);
|
||||
emit ratioClicked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->sbHeight->setEnabled(false);
|
||||
m_ui->sbWidth->setEnabled(false);
|
||||
emit ratioClicked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onLeftChanged(int left)
|
||||
{
|
||||
emit leftChanged(left);
|
||||
emit leftChanged(left);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onRightChanged(int right)
|
||||
{
|
||||
emit rightChanged(right);
|
||||
emit rightChanged(right);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onTopChanged(int top)
|
||||
{
|
||||
emit topChanged(top);
|
||||
emit topChanged(top);
|
||||
}
|
||||
|
||||
void LtsPictureEditing::onBottomChanged(int bottom)
|
||||
{
|
||||
emit bottomChanged(bottom);
|
||||
emit bottomChanged(bottom);
|
||||
}
|
||||
|
||||
|
||||
void LtsPictureEditing::clear()
|
||||
{
|
||||
emit setPicture(QImage(), QPoint(), false);
|
||||
emit setPicture(QImage(), QPoint(), false);
|
||||
}
|
||||
@@ -1,59 +1,66 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Crop pictures
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Raphael Becker
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QObject>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PictureEditing;
|
||||
}
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class LtsPictureView;
|
||||
namespace LtsWidgets{
|
||||
class LtsPictureView;
|
||||
}
|
||||
|
||||
|
||||
class LtsPictureEditing : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LtsPictureEditing(QWidget* parent = nullptr);
|
||||
~LtsPictureEditing();
|
||||
public:
|
||||
explicit LtsPictureEditing(QWidget *parent = nullptr);
|
||||
~LtsPictureEditing();
|
||||
|
||||
private:
|
||||
QImage m_grayImage;
|
||||
QImage m_image;
|
||||
private:
|
||||
QImage m_grayImage;
|
||||
QImage m_image;
|
||||
|
||||
LtsWidgets::LtsPictureView* m_gvPicture;
|
||||
LtsWidgets::LtsPictureView *m_gvPicture;
|
||||
|
||||
Ui::PictureEditing* m_ui;
|
||||
Ui::PictureEditing *m_ui;
|
||||
|
||||
private:
|
||||
void setSpinboxLimits(const QSize& picSize, bool setValues = true);
|
||||
void clear();
|
||||
void addViewToFrame();
|
||||
void initRatio();
|
||||
private:
|
||||
void setSpinboxLimits(const QSize &picSize, bool setValues = true);
|
||||
void clear();
|
||||
void addViewToFrame();
|
||||
void initRatio();
|
||||
|
||||
private slots:
|
||||
void onOpenImage();
|
||||
void onSetSize();
|
||||
void setSpinboxValues(const QRect& picRect);
|
||||
void onRatioChanged();
|
||||
void onRatioClicked();
|
||||
void onSavePicture();
|
||||
void onLeftChanged(int left);
|
||||
void onRightChanged(int right);
|
||||
void onTopChanged(int top);
|
||||
void onBottomChanged(int bottom);
|
||||
private slots:
|
||||
void onOpenImage();
|
||||
void onSetSize();
|
||||
void setSpinboxValues(const QRect &picRect);
|
||||
void onRatioChanged();
|
||||
void onRatioClicked();
|
||||
void onSavePicture();
|
||||
void onLeftChanged(int left);
|
||||
void onRightChanged(int right);
|
||||
void onTopChanged(int top);
|
||||
void onBottomChanged(int bottom);
|
||||
|
||||
signals:
|
||||
void setPicture(const QImage&, const QPoint&, const bool flag);
|
||||
void setAspectRatio(double ratio);
|
||||
void ratioClicked(bool enabled);
|
||||
int leftChanged(int left);
|
||||
int rightChanged(int right);
|
||||
int topChanged(int top);
|
||||
int bottomChanged(int bottom);
|
||||
signals:
|
||||
void setPicture(const QImage &, const QPoint &, const bool flag);
|
||||
void setAspectRatio(double ratio);
|
||||
void ratioClicked(bool enabled);
|
||||
int leftChanged(int left);
|
||||
int rightChanged(int right);
|
||||
int topChanged(int top);
|
||||
int bottomChanged(int bottom);
|
||||
};
|
||||
+35
-28
@@ -1,38 +1,45 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Crop pictures
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Raphael Becker
|
||||
*/
|
||||
|
||||
#include "lts_picture_editing.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <iostream>
|
||||
|
||||
static void qtMsgHandler(QtMsgType type, const QMessageLogContext&, const QString& msg)
|
||||
static void qtMsgHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
std::cout << "DEBUG: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
std::cout << "INFO: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
std::cout << "WARN: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
std::cerr << "ERROR: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
std::cerr << "FATAL: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
std::cout << "DEBUG: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
std::cout << "INFO: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
std::cout << "WARN: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
std::cerr << "ERROR: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
std::cerr << "FATAL: " << qPrintable(msg) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
qInstallMessageHandler(&qtMsgHandler);
|
||||
LtsPictureEditing w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
qInstallMessageHandler(&qtMsgHandler);
|
||||
LtsPictureEditing w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
@@ -1,15 +1,31 @@
|
||||
#include "window.h"
|
||||
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
#include "window.h"
|
||||
#include <LtsWidgets/lts_date_time_edit.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
LtsWidgets::LtsDateTimeEdit dte;
|
||||
dte.activateWindow();
|
||||
dte.show();
|
||||
|
||||
return app.exec();
|
||||
// LtsWidgets::Window w;
|
||||
// w.show();
|
||||
// w.activateWindow();
|
||||
// w.show();
|
||||
|
||||
|
||||
LtsWidgets::LtsDateTimeEdit dte;
|
||||
dte.activateWindow();
|
||||
dte.show();
|
||||
|
||||
|
||||
// LtsWidgets::LtsDateTimeEditMod dtemod;
|
||||
// dtemod.activateWindow();
|
||||
// dtemod.show();
|
||||
|
||||
//dtemod.setMsecsSinceEpoch(979216496789); // 11 12345678(9) Z jan 01
|
||||
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -1,48 +1,59 @@
|
||||
#include "window.h"
|
||||
|
||||
#include <LtsWidgets/lts_notification_box.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
Window::Window(QWidget* parent) : QWidget(parent)
|
||||
Window::Window(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
//Q_INIT_RESOURCE(lts_resources);
|
||||
|
||||
setGeometry(x(), y(), 300, 300);
|
||||
setGeometry(x(), y(), 300, 300);
|
||||
|
||||
QHBoxLayout* lay = new QHBoxLayout;
|
||||
QHBoxLayout *lay = new QHBoxLayout;
|
||||
|
||||
lay->setMargin(0);
|
||||
lay->setMargin(0);
|
||||
//lay->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
auto x1 = new LtsWidgets::LtsNotificationBox;
|
||||
lay->addWidget(x1);
|
||||
|
||||
if (qApp->arguments().count() < 2)
|
||||
abort();
|
||||
auto x1 = new LtsWidgets::LtsNotificationBox;
|
||||
lay->addWidget(x1);
|
||||
|
||||
LtsNotificationBox::MessageType type;
|
||||
|
||||
if (qApp->arguments().at(1) == QStringLiteral("e"))
|
||||
type = LtsNotificationBox::MessageType::Error;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("w"))
|
||||
type = LtsNotificationBox::MessageType::Warning;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("i"))
|
||||
type = LtsNotificationBox::MessageType::Info;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("s"))
|
||||
type = LtsNotificationBox::MessageType::Success;
|
||||
else
|
||||
abort();
|
||||
if (qApp->arguments().count() < 2)
|
||||
abort();
|
||||
|
||||
x1->message(QStringLiteral("Title Message"),
|
||||
QStringLiteral("A text that consists of a lot of characters and also even has<br />two lines."), type);
|
||||
connect(x1, &LtsNotificationBox::signalClose, this, &QWidget::close);
|
||||
|
||||
setLayout(lay);
|
||||
LtsNotificationBox::MessageType type;
|
||||
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
if (qApp->arguments().at(1) == QStringLiteral("e"))
|
||||
type = LtsNotificationBox::MessageType::Error;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("w"))
|
||||
type = LtsNotificationBox::MessageType::Warning;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("i"))
|
||||
type = LtsNotificationBox::MessageType::Info;
|
||||
else if (qApp->arguments().at(1) == QStringLiteral("s"))
|
||||
type = LtsNotificationBox::MessageType::Success;
|
||||
else
|
||||
abort();
|
||||
|
||||
x1->message(QStringLiteral("Title Message"), QStringLiteral("A text that consists of a lot of characters and also even has<br />two lines."), type);
|
||||
connect(x1, &LtsNotificationBox::signalClose, this, &QWidget::close);
|
||||
|
||||
setLayout(lay);
|
||||
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
}
|
||||
|
||||
Window::~Window() {}
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
//Q_CLEANUP_RESOURCE(lts_resources);
|
||||
}
|
||||
|
||||
} // namespace LtsWidgets
|
||||
@@ -1,14 +1,16 @@
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class Window : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Window(QWidget* parent = nullptr);
|
||||
~Window();
|
||||
Q_OBJECT
|
||||
public:
|
||||
Window(QWidget *parent = nullptr);
|
||||
~Window();
|
||||
|
||||
};
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user