Qt6 port:
* Explicitly include some missing headers * Use 'static const char*' for XPM icon * Skip template parameters for qMakePair * Constructor of QFileInfo is marked as 'explicit' now * QString::fromLatin1() also accepts a QByteArray * QDateTime::fromTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::fromSecsSinceEpoch() * QDateTime::toTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::toSecsSinceEpoch() * QApplication::globalStrut() is deprecated. Don't use it any more. * QWidget::isTopLevel() is deprecated, use QWidget::isWindow()
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QActionEvent>
|
||||
# include <QActionGroup>
|
||||
# include <QApplication>
|
||||
# include <QEvent>
|
||||
# include <QMenu>
|
||||
|
||||
@@ -2852,7 +2852,7 @@ void StdBoxSelection::activated(int iMsg)
|
||||
// Std_BoxElementSelection
|
||||
//===========================================================================
|
||||
/* XPM */
|
||||
static char * cursor_box_element_select[] = {
|
||||
static const char * cursor_box_element_select[] = {
|
||||
"32 32 6 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
|
||||
@@ -541,7 +541,7 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
|
||||
removeButton->hide();
|
||||
}
|
||||
|
||||
buttonMap.append(qMakePair<QLineEdit*, QPushButton*>(edit, removeButton));
|
||||
buttonMap.append(qMakePair(edit, removeButton));
|
||||
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeFolder()));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ DlgEditFileIncludePropertyExternal::~DlgEditFileIncludePropertyExternal()
|
||||
|
||||
int DlgEditFileIncludePropertyExternal::processFile()
|
||||
{
|
||||
QFileInfo file = QString::fromUtf8(Prop.getValue());
|
||||
QFileInfo file(QString::fromUtf8(Prop.getValue()));
|
||||
assert(file.exists());
|
||||
|
||||
QDir tmp = QString::fromUtf8(App::Application::getUserCachePath().c_str());
|
||||
|
||||
@@ -79,7 +79,7 @@ void DlgRevertToBackupConfigImp::showEvent(QShowEvent* event)
|
||||
const auto& backups = Application::Instance->prefPackManager()->configBackups();
|
||||
for (const auto& backup : backups) {
|
||||
auto filename = backup.filename().string();
|
||||
auto modification_date = QDateTime::fromTime_t(fs::last_write_time(backup));
|
||||
auto modification_date = QDateTime::fromSecsSinceEpoch(fs::last_write_time(backup));
|
||||
auto item = new QListWidgetItem(QLocale().toString(modification_date));
|
||||
item->setData(Qt::UserRole, QString::fromStdString(backup.string()));
|
||||
ui->listWidget->addItem(item);
|
||||
|
||||
@@ -331,7 +331,7 @@ void DocumentRecovery::accept()
|
||||
<< docs[i]->Label.getValue() << "'");
|
||||
}
|
||||
else {
|
||||
DocumentRecoveryCleaner().clearDirectory(xfi.absolutePath());
|
||||
DocumentRecoveryCleaner().clearDirectory(QFileInfo(xfi.absolutePath()));
|
||||
QDir().rmdir(xfi.absolutePath());
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ void DownloadManager::updateRow()
|
||||
return;
|
||||
if (!m_iconProvider)
|
||||
m_iconProvider = new QFileIconProvider();
|
||||
QIcon icon = m_iconProvider->icon(item->m_output.fileName());
|
||||
QIcon icon = m_iconProvider->icon(QFileInfo(item->m_output.fileName()));
|
||||
if (icon.isNull())
|
||||
icon = style()->standardIcon(QStyle::SP_FileIcon);
|
||||
item->fileIcon->setPixmap(icon.pixmap(48, 48));
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
QString fileName;
|
||||
EditorView::DisplayName displayName;
|
||||
QTimer* activityTimer;
|
||||
uint timeStamp;
|
||||
qint64 timeStamp;
|
||||
bool lock;
|
||||
bool aboutToClose;
|
||||
QStringList undos;
|
||||
@@ -191,7 +191,7 @@ void EditorView::OnChange(Base::Subject<const char*> &rCaller,const char* rcReas
|
||||
void EditorView::checkTimestamp()
|
||||
{
|
||||
QFileInfo fi(d->fileName);
|
||||
uint timeStamp = fi.lastModified().toTime_t();
|
||||
qint64 timeStamp = fi.lastModified().toSecsSinceEpoch();
|
||||
if (timeStamp != d->timeStamp) {
|
||||
switch( QMessageBox::question( this, tr("Modified file"),
|
||||
tr("%1.\n\nThis has been modified outside of the source editor. Do you want to reload it?").arg(d->fileName),
|
||||
@@ -369,7 +369,7 @@ bool EditorView::open(const QString& fileName)
|
||||
file.close();
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
d->timeStamp = fi.lastModified().toTime_t();
|
||||
d->timeStamp = fi.lastModified().toSecsSinceEpoch();
|
||||
d->activityTimer->setSingleShot(true);
|
||||
d->activityTimer->start(3000);
|
||||
|
||||
@@ -530,7 +530,7 @@ bool EditorView::saveFile()
|
||||
d->textEdit->document()->setModified(false);
|
||||
|
||||
QFileInfo fi(d->fileName);
|
||||
d->timeStamp = fi.lastModified().toTime_t();
|
||||
d->timeStamp = fi.lastModified().toSecsSinceEpoch();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ using namespace Gui;
|
||||
GUIApplication::GUIApplication(int & argc, char ** argv)
|
||||
: GUIApplicationNativeEventAware(argc, argv)
|
||||
{
|
||||
connect(this, SIGNAL(commitDataRequest(QSessionManager &)),
|
||||
SLOT(commitData(QSessionManager &)), Qt::DirectConnection);
|
||||
connect(this, SIGNAL(commitDataRequest(QSessionManager&)),
|
||||
SLOT(commitData(QSessionManager&)), Qt::DirectConnection);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
setFallbackSessionManagementEnabled(false);
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
SbRotation rotateView(SbRotation, int axis, float rotAngle, SbVec3f customAxis = SbVec3f(0, 0, 0)) const;
|
||||
void rotateView(const SbRotation&);
|
||||
|
||||
QString str(char* str);
|
||||
QString str(const char* str);
|
||||
char* enum2str(int);
|
||||
QMenu* createNaviCubeMenu();
|
||||
public:
|
||||
@@ -1674,7 +1674,7 @@ bool NaviCubeImplementation::processSoEvent(const SoEvent* ev) {
|
||||
}
|
||||
|
||||
|
||||
QString NaviCubeImplementation::str(char* str) {
|
||||
QString NaviCubeImplementation::str(const char* str) {
|
||||
return QString::fromLatin1(str);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,8 +105,7 @@ QSize ActionLabel::sizeHint() const
|
||||
h += 4;
|
||||
w += 8;
|
||||
|
||||
QSize sizeHint = (style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this).
|
||||
expandedTo(QApplication::globalStrut()));
|
||||
QSize sizeHint = style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this);
|
||||
|
||||
return sizeHint;
|
||||
}
|
||||
|
||||
@@ -720,8 +720,7 @@ QSize QuantitySpinBox::sizeForText(const QString& txt) const
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -750,8 +749,7 @@ QSize QuantitySpinBox::sizeHint() const
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -781,8 +779,7 @@ QSize QuantitySpinBox::minimumSizeHint() const
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
\**************************************************************************/
|
||||
|
||||
#include <QActionGroup>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ContextMenu.h"
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "QuarterWidget.h"
|
||||
#include "eventhandlers/EventFilter.h"
|
||||
|
||||
#include <QActionGroup>
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
#include <QMenu>
|
||||
|
||||
@@ -91,7 +91,7 @@ void SceneModel::setNode(SoNode* node)
|
||||
|
||||
void SceneModel::setNode(QModelIndex index, SoNode* node)
|
||||
{
|
||||
this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
|
||||
this->setData(index, QVariant(QString::fromLatin1(QByteArray(node->getTypeId().getName()))));
|
||||
if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
|
||||
auto group = static_cast<SoGroup*>(node);
|
||||
// insert SoGroup icon
|
||||
|
||||
@@ -407,7 +407,7 @@ void SoFrameLabel::drawImage()
|
||||
return;
|
||||
}
|
||||
|
||||
QFont font(QString::fromLatin1(name.getValue()), size.getValue());
|
||||
QFont font(QString::fromLatin1(QByteArray(name.getValue())), size.getValue());
|
||||
QFontMetrics fm(font);
|
||||
int w = 0;
|
||||
int h = fm.height() * num;
|
||||
|
||||
@@ -872,7 +872,7 @@ void View3DInventor::windowStateChanged(MDIView* view)
|
||||
// must be hidden, hence we can start the timer.
|
||||
// Note: If view is top-level or fullscreen it doesn't necessarily hide the other view
|
||||
// e.g. if it is on a second monitor.
|
||||
canStartTimer = (!this->isTopLevel() && !view->isTopLevel() && view->isMaximized());
|
||||
canStartTimer = (!this->isWindow() && !view->isWindow() && view->isMaximized());
|
||||
} else if (isMinimized()) {
|
||||
// I am the active view but minimized
|
||||
canStartTimer = true;
|
||||
|
||||
@@ -1167,8 +1167,7 @@ QSize QuantitySpinBox::sizeHint() const
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -1198,8 +1197,7 @@ QSize QuantitySpinBox::minimumSizeHint() const
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user