Qt5: fix deprecation warnings for Qt 5.15
+ replace QDirModel with QFileSystemModel + QProcess::start(QString, OpenMode) is deprecated + QByteArray::append is deprecated + QPixmap* QLabel::pixmap() is deprecated
This commit is contained in:
@@ -374,7 +374,8 @@ void NetworkRetriever::wgetFinished(int exitCode, QProcess::ExitStatus status)
|
||||
bool NetworkRetriever::testWget()
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(QString::fromLatin1("wget"));
|
||||
proc.setProgram(QString::fromLatin1("wget"));
|
||||
proc.start();
|
||||
bool ok = proc.state() == QProcess::Running;
|
||||
proc.kill();
|
||||
proc.waitForFinished();
|
||||
|
||||
@@ -255,8 +255,7 @@ QByteArray PythonOnlineHelp::fileNotFound() const
|
||||
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
|
||||
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);
|
||||
|
||||
QByteArray res;
|
||||
res.append(httpResponseHeader);
|
||||
QByteArray res = httpResponseHeader.toLatin1();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -285,8 +284,7 @@ QByteArray PythonOnlineHelp::loadFailed(const QString& error) const
|
||||
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
|
||||
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);
|
||||
|
||||
QByteArray res;
|
||||
res.append(httpResponseHeader);
|
||||
QByteArray res = httpResponseHeader.toLatin1();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
# include <QTimer>
|
||||
#endif
|
||||
|
||||
#include <QDirModel>
|
||||
#include <QFileSystemModel>
|
||||
#include <Base/Console.h>
|
||||
#include <App/Document.h>
|
||||
|
||||
@@ -56,8 +56,7 @@ using namespace Gui;
|
||||
ProjectWidget::ProjectWidget(QWidget* parent)
|
||||
: QTreeView(parent)
|
||||
{
|
||||
fileModel = new QDirModel(this);
|
||||
fileModel->setSorting(QDir::DirsFirst | QDir::Type);
|
||||
fileModel = new QFileSystemModel(this);
|
||||
setModel(fileModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
|
||||
#include <Gui/DockWindow.h>
|
||||
#include <Gui/Selection.h>
|
||||
class QDirModel;
|
||||
|
||||
class QFileSystemModel;
|
||||
|
||||
namespace Gui {
|
||||
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
~ProjectWidget();
|
||||
|
||||
private:
|
||||
QDirModel *fileModel;
|
||||
QFileSystemModel *fileModel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -116,6 +116,19 @@ void ActionBox::setIcon(const QPixmap & icon)
|
||||
iconLabel->setFixedSize(icon.size());
|
||||
}
|
||||
|
||||
QPixmap ActionBox::icon() const
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
return iconLabel->pixmap(Qt::ReturnByValue);
|
||||
#else
|
||||
QPixmap p;
|
||||
const QPixmap* ptr = iconLabel->pixmap();
|
||||
if (ptr)
|
||||
p = *ptr;
|
||||
return p;
|
||||
#endif
|
||||
}
|
||||
|
||||
ActionLabel* ActionBox::createItem(QAction * action, QLayout * l)
|
||||
{
|
||||
if (!action)
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
void setIcon(const QPixmap & icon);
|
||||
/** Returns icon of the ActionBox.
|
||||
*/
|
||||
inline const QPixmap* icon() const { return iconLabel->pixmap(); }
|
||||
QPixmap icon() const;// { return iconLabel->pixmap(); }
|
||||
|
||||
/** Returns header item of the ActionBox.
|
||||
*/
|
||||
|
||||
@@ -106,7 +106,7 @@ void TaskGroup::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
case Qt::Key_Down:
|
||||
{
|
||||
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, 0);
|
||||
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
|
||||
QApplication::sendEvent(this, &ke);
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ void TaskGroup::keyReleaseEvent ( QKeyEvent * event )
|
||||
{
|
||||
case Qt::Key_Down:
|
||||
{
|
||||
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
|
||||
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
|
||||
QApplication::sendEvent(this, &ke);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ void TaskHeader::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
case Qt::Key_Down:
|
||||
{
|
||||
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab,0 );
|
||||
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
|
||||
QApplication::sendEvent(this, &ke);
|
||||
return;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ void TaskHeader::keyReleaseEvent ( QKeyEvent * event )
|
||||
{
|
||||
case Qt::Key_Down:
|
||||
{
|
||||
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
|
||||
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
|
||||
QApplication::sendEvent(this, &ke);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
boost::starts_with(msg.pSubName,editSub))
|
||||
{
|
||||
for(auto item : ui->elementList->findItems(
|
||||
QString::fromLatin1(msg.pSubName-editSub.size()),0))
|
||||
QString::fromLatin1(msg.pSubName-editSub.size()), Qt::MatchExactly))
|
||||
item->setSelected(msg.Type==SelectionChanges::AddSelection);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user