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:
1 parent
17f1c61c9e
commit
f744a8c37a
328 files changed
+53567
-112
No files matched your search
@@ -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)
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
Reference in new issue
Block a user