Qt: remove some more leftovers of Qt4

This commit is contained in:
wmayer
2022-03-19 23:27:28 +01:00
parent 13e09b36f8
commit a999a249e3
13 changed files with 6 additions and 103 deletions

View File

@@ -26,11 +26,9 @@
#include "GuiAbstractNativeEvent.h"
#include <vector>
#if QT_VERSION >= 0x050000
#include <QAbstractNativeEventFilter>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#endif
#include <QAbstractNativeEventFilter>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
class QMainWindow;
class GUIApplicationNativeEventAware;
@@ -51,11 +49,7 @@ namespace Gui
GuiNativeEvent(const GuiNativeEvent&);
GuiNativeEvent& operator=(const GuiNativeEvent&);
public:
#if QT_VERSION >= 0x050000
static bool xcbEventFilter(void *message, long* result);
#else
bool x11EventFilter(XEvent *event);
#endif // if/else QT_VERSION >= 0x050000
};
}

View File

@@ -31,9 +31,7 @@
//#define _WIN32_WINNT 0x0501 //target at least windows XP
#include <Windows.h>
#if QT_VERSION >= 0x050000
#include "GuiRawInputEventFilter.h"
#endif
class QMainWindow;
class GUIApplicationNativeEventAware;

View File

@@ -67,13 +67,6 @@ void Assistant::showDocumentation(const QString &page)
bool Assistant::startAssistant()
{
#if QT_VERSION < 0x040400
QMessageBox::critical(0, QObject::tr("Help"),
QObject::tr("Unable to load documentation.\n"
"In order to load it Qt 4.4 or higher is required."));
return false;
#endif
if (!proc) {
proc = new QProcess();
connect(proc, SIGNAL(readyReadStandardOutput()),

View File

@@ -293,11 +293,7 @@ void DlgPropertyLink::init(const App::DocumentObjectT &prop, bool tryFilter) {
ui->treeWidget->setColumnCount(2);
// make sure to show a horizontal scrollbar if needed
#if QT_VERSION >= 0x050000
ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
#else
ui->treeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
#endif
}
std::set<App::Document*> expandDocs;

View File

@@ -413,7 +413,6 @@ void SoQtOffscreenRenderer::init(const SbViewportRegion & vpr,
//this->texFormat = GL_RGBA32F_ARB;
this->texFormat = GL_RGB32F_ARB;
this->cache_context = 0;
this->pbuffer = false;
}
/*!
@@ -537,18 +536,6 @@ SoQtOffscreenRenderer::internalTextureFormat() const
return PRIVATE(this)->texFormat;
}
void
SoQtOffscreenRenderer::setPbufferEnable(SbBool enable)
{
PRIVATE(this)->pbuffer = enable;
}
SbBool
SoQtOffscreenRenderer::getPbufferEnable(void) const
{
return PRIVATE(this)->pbuffer;
}
// *************************************************************************
void

View File

@@ -121,9 +121,6 @@ public:
void setInternalTextureFormat(GLenum internalTextureFormat);
GLenum internalTextureFormat() const;
void setPbufferEnable(SbBool enable);
SbBool getPbufferEnable(void) const;
SbBool render(SoNode * scene);
SbBool render(SoPath * scene);
@@ -144,7 +141,6 @@ private:
SbColor4f backgroundopaque;
SoGLRenderAction * renderaction;
SbBool didallocation;
SbBool pbuffer;
int numSamples;
GLenum texFormat;
QImage glImage;

View File

@@ -1501,14 +1501,12 @@ void View3DInventorViewer::savePicture(int w, int h, int s, const QColor& bg, QI
// Save picture methods:
// FramebufferObject -- viewer renders into FBO (no offscreen)
// CoinOffscreenRenderer -- Coin's offscreen rendering method
// PixelBuffer -- Qt's pixel buffer used for offscreen rendering (only Qt4)
// Otherwise (Default) -- Qt's FBO used for offscreen rendering
std::string saveMethod = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View")->GetASCII("SavePicture");
bool useFramebufferObject = false;
bool useGrabFramebuffer = false;
bool usePixelBuffer = false;
bool useCoinOffscreenRenderer = false;
if (saveMethod == "FramebufferObject") {
useFramebufferObject = true;
@@ -1516,9 +1514,6 @@ void View3DInventorViewer::savePicture(int w, int h, int s, const QColor& bg, QI
else if (saveMethod == "GrabFramebuffer") {
useGrabFramebuffer = true;
}
else if (saveMethod == "PixelBuffer") {
usePixelBuffer = true;
}
else if (saveMethod == "CoinOffscreenRenderer") {
useCoinOffscreenRenderer = true;
}
@@ -1607,7 +1602,6 @@ void View3DInventorViewer::savePicture(int w, int h, int s, const QColor& bg, QI
SoQtOffscreenRenderer renderer(vp);
renderer.setNumPasses(s);
renderer.setInternalTextureFormat(getInternalTextureFormat());
renderer.setPbufferEnable(usePixelBuffer);
if (bgColor.isValid())
renderer.setBackgroundColor(SbColor4f(bgColor.redF(), bgColor.greenF(), bgColor.blueF(), bgColor.alphaF()));
if (!renderer.render(root))

View File

@@ -522,7 +522,6 @@ void ModifierLineEdit::keyPressEvent (QKeyEvent * e)
// ------------------------------------------------------------------------------
#if QT_VERSION >= 0x050200
ClearLineEdit::ClearLineEdit (QWidget * parent)
: QLineEdit(parent)
{
@@ -542,41 +541,6 @@ void ClearLineEdit::updateClearButton(const QString& text)
{
clearAction->setVisible(!text.isEmpty());
}
#else
ClearLineEdit::ClearLineEdit (QWidget * parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
QPixmap pixmap(BitmapFactory().pixmapFromSvg(":/icons/edit-cleartext.svg", QSize(18, 18)));
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet(QString::fromLatin1("QToolButton { border: none; padding: 0px; }"));
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)),
this, SLOT(updateClearButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px; } ")
.arg(clearButton->sizeHint().width() + frameWidth + 1));
QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
msz.height());
}
void ClearLineEdit::resizeEvent(QResizeEvent *)
{
QSize sz = clearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - sz.height())/2);
}
void ClearLineEdit::updateClearButton(const QString& text)
{
clearButton->setVisible(!text.isEmpty());
}
#endif
// ------------------------------------------------------------------------------

View File

@@ -109,9 +109,8 @@ def translate(context, text, utf8_decode=False):
# Python 3 and Qt5
# The text is a utf8 string, and since it is Qt5
# the translate function doesn't use the 4th parameter
if six.PY3:
return Qtranslate(context, text, None)
return Qtranslate(context, text, None)
# Original code no longer used. It is listed here for reference
# to show how the different pairings Py2/Qt4, Py3/Qt5, Py2/Qt5, Py3/Qt4

View File

@@ -107,11 +107,7 @@ protected:
void contextMenuEvent(QContextMenuEvent *event);
void closeEvent(QCloseEvent*);
void findPrinterSettings(const QString&);
#if QT_VERSION >= 0x050300
QPageSize::PageSizeId getPageSize(int w, int h) const;
#else
QPrinter::PageSize getPageSize(int w, int h) const;
#endif
private:
QAction *m_nativeAction;
@@ -125,13 +121,8 @@ private:
std::string m_objectName;
QString m_currentPath;
#if QT_VERSION >= 0x050300
QPageLayout::Orientation m_orientation;
QPageSize::PageSizeId m_pageSize;
#else
QPrinter::Orientation m_orientation;
QPrinter::PageSize m_pageSize;
#endif
};
} // namespace DrawingViewGui

View File

@@ -482,11 +482,7 @@ void ImageView::wheelEvent(QWheelEvent * cEvent)
#endif
// Zoom around centrally displayed image point
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
int numTicks = cEvent->angleDelta().y() / 120;
#else
int numTicks = cEvent->delta() / 120;
#endif
if (_invertZoom)
numTicks = -numTicks;

View File

@@ -220,9 +220,8 @@ void MeshSelection::prepareFreehandSelection(bool add,SoEventCallbackCB *cb)
QCursor custom(cursor, mask, CROSS_HOT_X, CROSS_HOT_Y);
viewer->setComponentCursor(custom);
};
#if (QT_VERSION >= 0x050000)
QObject::connect(viewer, &Gui::View3DInventorViewer::devicePixelRatioChanged, setComponentCursor);
#endif
setComponentCursor();
this->addToSelection = add;
}

View File

@@ -129,11 +129,7 @@ bool TaskDlgFeatureParameters::accept() {
Gui::Command::commitCommand();
} catch (const Base::Exception& e) {
// Generally the only thing that should fail is feature->isValid() others should be fine
#if (QT_VERSION >= 0x050000)
QString errorText = QApplication::translate(feature->getTypeId().getName(), e.what());
#else
QString errorText = QApplication::translate(feature->getTypeId().getName(), e.what(), 0, QApplication::UnicodeUTF8);
#endif
QMessageBox::warning(Gui::getMainWindow(), tr("Input error"), errorText);
return false;
}