qt6: nglcompression, widgets, dialog fixes: remove QTextCodec, QStringRef/splitRef, QDesktopWidget, use QMultiMap and Qt6 APIs; adjust QtConcurrent::run wrappers; replace endl with newline

This commit is contained in:
torsten committed 2026-07-14 20:38:30 +02:00
1 parent 17f1c61c9e
commit f744a8c37a
328 files changed
+53567 -112

No files matched your search

+8
View File
@@ -50,3 +50,11 @@ NGL_TARGET_LINK_LIBRARIES(nglwidgets
)
NGL_INSTALL_TARGET(nglwidgets)
# Unit test for PDFWidget
IF(BUILD_TESTING)
FIND_PACKAGE(Qt6 REQUIRED COMPONENTS Test Widgets)
ADD_EXECUTABLE(test_nglpdfwidget test_nglpdfwidget.cpp)
TARGET_LINK_LIBRARIES(test_nglpdfwidget PRIVATE nglwidgets Qt6::Test Qt6::Widgets)
ADD_TEST(NAME test_nglpdfwidget COMMAND $<TARGET_FILE:test_nglpdfwidget>)
ENDIF(BUILD_TESTING)
+1 -1
View File
@@ -82,7 +82,7 @@ void NGLDialog::centerWidget()
void NGLDialog::printWidget(QWidget *widgetToPrint)
{
QRect r = widgetToPrint->frameGeometry();
QPixmap pm = QApplication::desktop()->grab(r);
QPixmap pm = QGuiApplication::primaryScreen()->grabWindow(0, r.x(), r.y(), r.width(), r.height());
QString path = QString::fromLocal8Bit(qgetenv("GFS_PATH"));
if (path.isEmpty())
path = QCoreApplication::applicationDirPath() + QLatin1String("/../images");
+6 -6
View File
@@ -93,7 +93,7 @@ void NGLDialogButtonBox::addButtonInternal(NGLStandardButton *button)
button->setDefault(false);
button->setAutoDefault(false);
m_standardButtons.insertMulti(button->layoutPriority(), button);
m_standardButtons.insert(button->layoutPriority(), button);
}
void NGLDialogButtonBox::addButton(NGLStandardButton *button)
@@ -168,14 +168,14 @@ bool NGLDialogButtonBox::setVisible(NGLStandardButton::StandardButton button, bo
void NGLDialogButtonBox::layoutPriorityChanged()
{
QMap<qint32, NGLStandardButton *> standardButtons = m_standardButtons;
QMultiMap<qint32, NGLStandardButton *> standardButtons = m_standardButtons;
m_standardButtons.clear();
QMap<int, NGLStandardButton *>::const_iterator it = standardButtons.constBegin();
QMap<int, NGLStandardButton *>::const_iterator end = standardButtons.constEnd();
QMultiMap<int, NGLStandardButton *>::const_iterator it = standardButtons.constBegin();
QMultiMap<int, NGLStandardButton *>::const_iterator end = standardButtons.constEnd();
for (; it != end; ++it)
{
NGLStandardButton *button = it.value();
m_standardButtons.insertMulti(button->layoutPriority(), button);
m_standardButtons.insert(button->layoutPriority(), button);
}
init();
@@ -212,7 +212,7 @@ void NGLDialogButtonBox::init()
lMain = new QHBoxLayout;
l = new QVBoxLayout;
}
lMain->setMargin(0);
lMain->setContentsMargins(0,0,0,0);
if (m_bLineVisible)
{
m_line = new QFrame(this);
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#include <QtCore/QMap>
#include <QtCore/QMultiMap>
#include <QWidget>
#include "nglwidgets_export.h"
@@ -177,7 +177,7 @@ protected Q_SLOTS:
void buttonClicked();
protected:
QMap<qint32, NGLStandardButton *> m_standardButtons;
QMultiMap<qint32, NGLStandardButton *> m_standardButtons;
Qt::Orientation m_orientation;
NGLStandardButton::StandardButtons m_buttons;
NGLStandardButton::StandardButtons m_disabledActions;
+2 -1
View File
@@ -79,7 +79,8 @@ void NGLMainWindow::onInvokeHelp(const QString &helpContext)
}
QTextStream str(m_helpProcess);
str << QLatin1String("activateIdentifier ") + helpContext << QLatin1Char('\0') << endl;
str << QLatin1String("activateIdentifier ") + helpContext << QLatin1Char('\0') << QLatin1Char('\n');
str.flush();
}
void NGLMainWindow::onHelpFinished(int exitCode, QProcess::ExitStatus exitStatus)
+2 -2
View File
@@ -11,7 +11,7 @@ namespace NGL
PDFWidget::PDFWidget(QWidget *parent)
: QWidget(parent)
, m_zoomFactor(1.0)
, ui(new Ui::pdfWidget)
, ui(std::make_unique<Ui::pdfWidget>())
{
ui->setupUi(this);
ui->zoomFull->setVisible(false);
@@ -34,7 +34,7 @@ PDFWidget::PDFWidget(QWidget *parent)
PDFWidget::~PDFWidget()
{
delete ui;
// unique_ptr<Ui::pdfWidget> destructor runs here where Ui::pdfWidget is a complete type
}
bool PDFWidget::showPDF(const QUrl &pdf)
+6 -5
View File
@@ -2,7 +2,8 @@
#pragma once
#include <QWidget>
#include <poppler/qt5/poppler-qt5.h>
#include <memory>
#include <poppler/qt6/poppler-qt6.h>
#include "nglwidgets_export.h"
@@ -32,7 +33,7 @@ public:
int curPage() const;
Q_SIGNALS:
void currentPageChanged(int cur, int max);
void currentPageChanged(int cur, int max);
void rotationChanged(Poppler::Page::Rotation newRotation);
protected Q_SLOTS:
void pageChanged(int cur, int max);
@@ -42,7 +43,7 @@ protected Q_SLOTS:
void onZoomMinus();
void onZoomPlus();
protected:
double m_zoomFactor;
Ui::pdfWidget *ui;
double m_zoomFactor{1.0};
std::unique_ptr<Ui::pdfWidget> ui;
};
}
}
+20
View File
@@ -0,0 +1,20 @@
#include <QTest>
#include "nglpdfwidget.h"
class TestPDFWidget : public QObject
{
Q_OBJECT
private slots:
void initTestCase() {}
void cleanupTestCase() {}
void testConstruct()
{
NGL::PDFWidget w;
QVERIFY(w.numPages() >= 0);
}
};
QTEST_MAIN(TestPDFWidget)
#include "test_nglpdfwidget.moc"