[GUI] Remove code for Qt < 5.9

This commit is contained in:
Chris Hennes
2021-03-30 15:38:26 -05:00
committed by wmayer
parent 67bbb61103
commit 098d7b9aee
57 changed files with 19 additions and 686 deletions

View File

@@ -47,15 +47,11 @@
# include <QStatusBar>
# include <QTimer>
# include <QToolBar>
#if QT_VERSION >= 0x050000
# include <QUrlQuery>
#endif
# include <QWhatsThis>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QScreen>
#endif
#include <QScreen>
// FreeCAD Base header
#include <Base/Parameter.h>
@@ -196,11 +192,8 @@ public:
MDITabbar( QWidget * parent = 0 ) : QTabBar(parent)
{
menu = new QMenu(this);
// For Qt 4.2.x the tabs might be very wide
#if QT_VERSION >= 0x040200
setDrawBase(false);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
#endif
}
~MDITabbar()
@@ -293,31 +286,20 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
// support for grouped dragging of dockwidgets
// https://woboq.com/blog/qdockwidget-changes-in-56.html
#if QT_VERSION >= 0x050600
setDockOptions(dockOptions() | QMainWindow::GroupedDragging);
#endif
// Create the layout containing the workspace and a tab bar
d->mdiArea = new QMdiArea();
// Movable tabs
#if QT_VERSION >= 0x040800
d->mdiArea->setTabsMovable(true);
#endif
#if QT_VERSION >= 0x040500
d->mdiArea->setTabPosition(QTabWidget::South);
d->mdiArea->setViewMode(QMdiArea::TabbedView);
QTabBar* tab = d->mdiArea->findChild<QTabBar*>();
if (tab) {
// 0000636: Two documents close
#if QT_VERSION < 0x040800
connect(tab, SIGNAL(tabCloseRequested(int)),
this, SLOT(tabCloseRequested(int)));
#endif
tab->setTabsClosable(true);
// The tabs might be very wide
tab->setExpanding(false);
}
#endif
d->mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation, false);
@@ -460,15 +442,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
pDockMgr->registerDockWindow("Std_ComboView", pcComboView);
}
#if QT_VERSION < 0x040500
// Report view
if (hiddenDockWindows.find("Std_ReportView") == std::string::npos) {
Gui::DockWnd::ReportView* pcReport = new Gui::DockWnd::ReportView(this);
pcReport->setObjectName
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Report view")));
pDockMgr->registerDockWindow("Std_ReportView", pcReport);
}
#else
// Report view (must be created before PythonConsole!)
if (hiddenDockWindows.find("Std_ReportView") == std::string::npos) {
ReportOutput* pcReport = new ReportOutput(this);
@@ -541,7 +514,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
connect(result, SIGNAL(currentChanged(int)), l, SLOT(tabChanged()));
l->unusedTabBars << result;
}
#endif
#endif
// accept drops on the window, get handled in dropEvent, dragEnterEvent
@@ -1234,16 +1206,6 @@ void MainWindow::hideEvent(QHideEvent * /*e*/)
void MainWindow::showMainWindow()
{
// Under certain circumstances it can happen that at startup the main window
// appears for a short moment and disappears immediately. The workaround
// starts a timer to check for the visibility of the main window and call
// ShowWindow() if needed.
// So far, this phenomena only appeared with Qt4.1.4
#if defined(Q_OS_WIN) && (QT_VERSION == 0x040104)
WId id = this->winId();
ShowWindow(id, SW_SHOW);
std::cout << "Force to show main window" << std::endl;
#endif
}
void MainWindow::processMessages(const QList<QByteArray> & msg)
@@ -1426,11 +1388,7 @@ void MainWindow::loadWindowSettings()
QString qtver = QString::fromLatin1("Qt%1.%2").arg(major).arg(minor);
QSettings config(vendor, application);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QRect rect = QApplication::primaryScreen()->availableGeometry();
#else
QRect rect = QApplication::desktop()->availableGeometry();
#endif
int maxHeight = rect.height();
int maxWidth = rect.width();
@@ -1853,15 +1811,10 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& urls)
//#ifndef QT_NO_OPENSSL
else if (it->scheme().toLower() == QLatin1String("https")) {
QUrl url = *it;
#if QT_VERSION >= 0x050000
QUrlQuery urlq(url);
if (urlq.hasQueryItem(QLatin1String("sid"))) {
urlq.removeAllQueryItems(QLatin1String("sid"));
url.setQuery(urlq);
#else
if (it->hasEncodedQueryItem(QByteArray("sid"))) {
url.removeEncodedQueryItem(QByteArray("sid"));
#endif
url.setScheme(QLatin1String("http"));
}
Gui::Dialog::DownloadManager* dm = Gui::Dialog::DownloadManager::getInstance();