Qt6 port:
* QApplication::setFallbackSessionManagementEnabled has been removed * QString::medRef() has been removed. Use QString::mid() again. * QTextStream::setCodec has been removed * Use operator QVariant of the QFont class to make code Qt5 and Qt6 compatible * Signature of QTreeWidget::mimeData() has changed in Qt6. Remove TreeWidget::mimeData() because it doesn't change the implementation * QLayout::setMargin() is deprecated in Qt5 and has been removed in Qt6. Use QLayout::setContentsMargins() * QDateTime::toTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::toSecsSinceEpoch() * QDesktopWidget is deprecated in Qt5 and has been removed in Qt6. Use QScreen
This commit is contained in:
@@ -145,7 +145,9 @@ void AutoSaver::saveDocument(const std::string& name, AutoSaveProperty& saver)
|
||||
.arg(QString::fromUtf8(doc->TransientDir.getValue())));
|
||||
if (file.open(QFile::WriteOnly)) {
|
||||
QTextStream str(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
str.setCodec("UTF-8");
|
||||
#endif
|
||||
str << "<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
<< "<AutoRecovery SchemaVersion=\"1\">\n";
|
||||
str << " <Status>Created</Status>\n";
|
||||
|
||||
@@ -50,7 +50,7 @@ ComboView::ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent)
|
||||
|
||||
auto pLayout = new QGridLayout(this);
|
||||
pLayout->setSpacing( 0 );
|
||||
pLayout->setMargin ( 0 );
|
||||
pLayout->setContentsMargins ( 0, 0, 0, 0 );
|
||||
|
||||
// tabs to switch between Tree/Properties and TaskPanel
|
||||
tabs = new QTabWidget ();
|
||||
|
||||
@@ -59,11 +59,11 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
|
||||
customLayout = new QGridLayout( this );
|
||||
customLayout->setSpacing( 6 );
|
||||
customLayout->setMargin( 11 );
|
||||
customLayout->setContentsMargins( 11, 11, 11, 11 );
|
||||
|
||||
layout = new QHBoxLayout;
|
||||
layout->setSpacing( 6 );
|
||||
layout->setMargin( 0 );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
buttonHelp = new QPushButton( this );
|
||||
buttonHelp->setText(tr("&Help"));
|
||||
|
||||
@@ -268,9 +268,7 @@ namespace Gui {
|
||||
Document* doc = Application::Instance->activeDocument();
|
||||
QFont font;
|
||||
font.setBold(doc==&d);
|
||||
QVariant variant;
|
||||
variant.setValue<QFont>(font);
|
||||
return variant;
|
||||
return static_cast<QVariant>(font);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@@ -325,9 +323,7 @@ namespace Gui {
|
||||
App::DocumentObject* act = obj->getDocument()->getActiveObject();
|
||||
QFont font;
|
||||
font.setBold(obj==act);
|
||||
QVariant variant;
|
||||
variant.setValue<QFont>(font);
|
||||
return variant;
|
||||
return static_cast<QVariant>(font);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
||||
@@ -355,7 +355,9 @@ void DocumentRecoveryPrivate::writeRecoveryInfo(const DocumentRecoveryPrivate::I
|
||||
QFile file(info.xmlFile);
|
||||
if (file.open(QFile::WriteOnly)) {
|
||||
QTextStream str(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
str.setCodec("UTF-8");
|
||||
#endif
|
||||
str << "<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
<< "<AutoRecovery SchemaVersion=\"1\">\n";
|
||||
switch (info.status) {
|
||||
|
||||
@@ -113,7 +113,7 @@ EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent)
|
||||
hbox->setFrameShape(QFrame::StyledPanel);
|
||||
hbox->setFrameShadow(QFrame::Sunken);
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setMargin(1);
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
layout->addWidget(d->textEdit);
|
||||
layout->addWidget(d->searchBar);
|
||||
d->textEdit->setParent(hbox);
|
||||
|
||||
@@ -662,7 +662,7 @@ FileChooser::FileChooser ( QWidget * parent )
|
||||
, _filter( QString() )
|
||||
{
|
||||
auto layout = new QHBoxLayout( this );
|
||||
layout->setMargin( 0 );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
layout->setSpacing( 2 );
|
||||
|
||||
lineEdit = new QLineEdit ( this );
|
||||
@@ -856,11 +856,11 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types
|
||||
group = new QButtonGroup(this);
|
||||
gridLayout = new QGridLayout(this);
|
||||
gridLayout->setSpacing(6);
|
||||
gridLayout->setMargin(9);
|
||||
gridLayout->setContentsMargins(9, 9, 9, 9);
|
||||
|
||||
gridLayout1 = new QGridLayout(groupBox);
|
||||
gridLayout1->setSpacing(6);
|
||||
gridLayout1->setMargin(9);
|
||||
gridLayout1->setContentsMargins(9, 9, 9, 9);
|
||||
|
||||
int index = 0;
|
||||
for (SelectModule::Dict::const_iterator it = types.begin(); it != types.end(); ++it) {
|
||||
@@ -897,7 +897,7 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types
|
||||
|
||||
hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->setSpacing(6);
|
||||
hboxLayout->setMargin(0);
|
||||
hboxLayout->setContentsMargins(0, 0, 0, 0);
|
||||
spacerItem1 = new QSpacerItem(131, 31, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hboxLayout->addItem(spacerItem1);
|
||||
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ QSize Flag::sizeHint() const
|
||||
FlagLayout::FlagLayout(QWidget *parent, int margin, int spacing)
|
||||
: QLayout(parent)
|
||||
{
|
||||
setMargin(margin);
|
||||
setContentsMargins(margin, margin, margin, margin);
|
||||
setSpacing(spacing);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,9 @@ GUIApplication::GUIApplication(int & argc, char ** argv)
|
||||
{
|
||||
connect(this, SIGNAL(commitDataRequest(QSessionManager &)),
|
||||
SLOT(commitData(QSessionManager &)), Qt::DirectConnection);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
setFallbackSessionManagementEnabled(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
GUIApplication::~GUIApplication()
|
||||
|
||||
@@ -394,7 +394,7 @@ public:
|
||||
|
||||
auto vbox = new QFrame(this);
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
vbox->setLayout(layout);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ PropertyView::PropertyView(QWidget *parent)
|
||||
{
|
||||
auto pLayout = new QGridLayout( this );
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin (0);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
timer = new QTimer(this);
|
||||
timer->setSingleShot(true);
|
||||
@@ -560,7 +560,7 @@ PropertyDockView::PropertyDockView(Gui::Document* pcDocument, QWidget *parent)
|
||||
auto view = new PropertyView(this);
|
||||
auto pLayout = new QGridLayout(this);
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin (0);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(view, 0, 0);
|
||||
|
||||
resize( 200, 400 );
|
||||
|
||||
@@ -45,7 +45,7 @@ void ActionGroup::init(bool header)
|
||||
myScheme = ActionPanelScheme::defaultScheme();
|
||||
|
||||
QVBoxLayout *vbl = new QVBoxLayout();
|
||||
vbl->setMargin(0);
|
||||
vbl->setContentsMargins(0, 0, 0, 0);
|
||||
vbl->setSpacing(0);
|
||||
setLayout(vbl);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ ActionPanel::ActionPanel(QWidget *parent) :
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||
|
||||
QVBoxLayout *vbl = new QVBoxLayout();
|
||||
vbl->setMargin(8);
|
||||
vbl->setContentsMargins(8, 8, 8, 8);
|
||||
vbl->setSpacing(8);
|
||||
setLayout(vbl);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ TaskGroup::TaskGroup(QWidget *parent, bool hasHeader)
|
||||
setScheme(ActionPanelScheme::defaultScheme());
|
||||
|
||||
QVBoxLayout *vbl = new QVBoxLayout();
|
||||
vbl->setMargin(4);
|
||||
vbl->setContentsMargins(4, 4, 4, 4);
|
||||
vbl->setSpacing(0);
|
||||
setLayout(vbl);
|
||||
|
||||
@@ -63,7 +63,7 @@ bool TaskGroup::addWidget(QWidget *widget, bool addToLayout, bool addStretch)
|
||||
|
||||
if (addStretch) {
|
||||
QHBoxLayout *hbl = new QHBoxLayout();
|
||||
hbl->setMargin(0);
|
||||
hbl->setContentsMargins(0, 0, 0, 0);
|
||||
hbl->setSpacing(0);
|
||||
hbl->addWidget(widget);
|
||||
hbl->addStretch();
|
||||
|
||||
@@ -40,7 +40,7 @@ TaskHeader::TaskHeader(const QIcon &icon, const QString &title, bool expandable,
|
||||
connect(myTitle, SIGNAL(clicked()), this, SLOT(fold()));
|
||||
|
||||
QHBoxLayout *hbl = new QHBoxLayout();
|
||||
hbl->setMargin(2);
|
||||
hbl->setContentsMargins(2, 2, 2, 2);
|
||||
setLayout(hbl);
|
||||
|
||||
hbl->addWidget(myTitle);
|
||||
|
||||
@@ -60,7 +60,7 @@ ReportView::ReportView( QWidget* parent )
|
||||
resize( 529, 162 );
|
||||
auto tabLayout = new QGridLayout( this );
|
||||
tabLayout->setSpacing( 0 );
|
||||
tabLayout->setMargin( 0 );
|
||||
tabLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
tabWidget = new QTabWidget( this );
|
||||
tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
|
||||
|
||||
@@ -62,7 +62,7 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent)
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout(this);
|
||||
vLayout->setSpacing(0);
|
||||
vLayout->setMargin (0);
|
||||
vLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLineEdit* searchBox = new QLineEdit(this);
|
||||
searchBox->setPlaceholderText(tr("Search"));
|
||||
|
||||
@@ -412,7 +412,9 @@ void AboutDialog::showCredits()
|
||||
creditsHTML += QString::fromLatin1("</h2><ul>");
|
||||
|
||||
QTextStream stream(&creditsFile);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
QString line;
|
||||
while (stream.readLineInto(&line)) {
|
||||
if (!line.isEmpty()) {
|
||||
|
||||
@@ -116,7 +116,7 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
|
||||
|
||||
if (!px.isNull()) {
|
||||
// according to specification add some meta-information to the image
|
||||
uint mt = QDateTime::currentDateTimeUtc().toTime_t();
|
||||
qint64 mt = QDateTime::currentDateTimeUtc().toSecsSinceEpoch();
|
||||
QString mtime = QString::fromLatin1("%1").arg(mt);
|
||||
img.setText(QLatin1String("Software"), qApp->applicationName());
|
||||
img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd"));
|
||||
|
||||
+2
-7
@@ -1489,11 +1489,6 @@ void TreeWidget::startDrag(Qt::DropActions supportedActions)
|
||||
}
|
||||
}
|
||||
|
||||
QMimeData* TreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
|
||||
{
|
||||
return QTreeWidget::mimeData(items);
|
||||
}
|
||||
|
||||
bool TreeWidget::dropMimeData(QTreeWidgetItem* parent, int index,
|
||||
const QMimeData* data, Qt::DropAction action)
|
||||
{
|
||||
@@ -3028,7 +3023,7 @@ TreePanel::TreePanel(const char* name, QWidget* parent)
|
||||
|
||||
auto pLayout = new QVBoxLayout(this);
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin(0);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(this->treeWidget);
|
||||
connect(this->treeWidget, SIGNAL(emitSearchObjects()),
|
||||
this, SLOT(showEditor()));
|
||||
@@ -3116,7 +3111,7 @@ TreeDockWidget::TreeDockWidget(Gui::Document* pcDocument, QWidget* parent)
|
||||
auto panel = new TreePanel("TreeView", this);
|
||||
auto pLayout = new QGridLayout(this);
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin(0);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(panel, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ protected:
|
||||
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data,
|
||||
Qt::DropAction action) override;
|
||||
Qt::DropActions supportedDropActions () const override;
|
||||
QMimeData * mimeData (const QList<QTreeWidgetItem *> items) const override;
|
||||
void dragEnterEvent(QDragEnterEvent * event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent * event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
|
||||
+3
-3
@@ -1046,7 +1046,7 @@ LabelButton::LabelButton (QWidget * parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(1);
|
||||
|
||||
label = new QLabel(this);
|
||||
@@ -1202,7 +1202,7 @@ StatusWidget::StatusWidget(QWidget* parent)
|
||||
|
||||
auto gridLayout = new QGridLayout(this);
|
||||
gridLayout->setSpacing(6);
|
||||
gridLayout->setMargin(9);
|
||||
gridLayout->setContentsMargins(9, 9, 9, 9);
|
||||
gridLayout->addWidget(label, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
@@ -1411,7 +1411,7 @@ LabelEditor::LabelEditor (QWidget * parent)
|
||||
{
|
||||
type = String;
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(2);
|
||||
|
||||
lineEdit = new QLineEdit(this);
|
||||
|
||||
@@ -1506,7 +1506,7 @@ PropertyEditorWidget::PropertyEditorWidget (QWidget * parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(2);
|
||||
|
||||
lineEdit = new QLineEdit(this);
|
||||
@@ -3065,7 +3065,9 @@ void PropertyStringListItem::setValue(const QVariant& value)
|
||||
QStringList values = value.toStringList();
|
||||
QString data;
|
||||
QTextStream str(&data);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
str.setCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
str << "[";
|
||||
for (QStringList::Iterator it = values.begin(); it != values.end(); ++it) {
|
||||
@@ -4284,7 +4286,7 @@ LinkLabel::LinkLabel (QWidget * parent, const App::Property *prop)
|
||||
: QWidget(parent), objProp(prop), dlg(nullptr)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(1);
|
||||
|
||||
label = new QLabel(this);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <algorithm>
|
||||
# include <Bnd_Box.hxx>
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <BRep_Tool.hxx>
|
||||
|
||||
@@ -429,7 +429,7 @@ void DlgFilletEdges::onSelectEdge(const QString& subelement, int type)
|
||||
void DlgFilletEdges::onSelectEdgesOfFace(const QString& subelement, int type)
|
||||
{
|
||||
bool ok;
|
||||
int index = subelement.midRef(4).toInt(&ok);
|
||||
int index = subelement.mid(4).toInt(&ok);
|
||||
if (ok) {
|
||||
try {
|
||||
const TopoDS_Shape& face = d->all_faces.FindKey(index);
|
||||
|
||||
@@ -735,9 +735,7 @@ void TaskExtrudeParameters::translateFaceName()
|
||||
|
||||
if (ok) {
|
||||
ui->lineFaceName->setText(QString::fromLatin1("%1:%2%3")
|
||||
.arg(parts[0],
|
||||
tr("Face"),
|
||||
QString(faceId)));
|
||||
.arg(parts[0], tr("Face")).arg(faceId));
|
||||
}
|
||||
else {
|
||||
ui->lineFaceName->setText(parts[0]);
|
||||
|
||||
@@ -51,7 +51,7 @@ SketcherSettings::SketcherSettings(QWidget* parent)
|
||||
ui->setupUi(this);
|
||||
QGridLayout* gridLayout = new QGridLayout(ui->placeholder);
|
||||
gridLayout->setSpacing(0);
|
||||
gridLayout->setMargin(0);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
form = new SketcherGeneralWidget(ui->placeholder);
|
||||
gridLayout->addWidget(form, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
# include <cfloat>
|
||||
# include <algorithm>
|
||||
# include <QFontMetrics>
|
||||
# include <QGLWidget>
|
||||
# include <QPainter>
|
||||
# include <QPen>
|
||||
# include <Inventor/SoPrimitiveVertex.h>
|
||||
@@ -113,7 +112,7 @@ void SoDatumLabel::drawImage()
|
||||
return;
|
||||
}
|
||||
|
||||
QFont font(QString::fromLatin1(name.getValue()), size.getValue());
|
||||
QFont font(QString::fromLatin1(name.getValue(), -1), size.getValue());
|
||||
QFontMetrics fm(font);
|
||||
QString str = QString::fromUtf8(s[0].getString());
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
# include <QAction>
|
||||
# include <QApplication>
|
||||
# include <QColor>
|
||||
# include <QDesktopWidget>
|
||||
# include <QDialog>
|
||||
# include <QFont>
|
||||
# include <QKeyEvent>
|
||||
# include <QMenu>
|
||||
# include <QMessageBox>
|
||||
# include <QPainter>
|
||||
# include <QScreen>
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
@@ -3629,7 +3629,7 @@ int ViewProviderSketch::defaultFontSizePixels() const
|
||||
}
|
||||
|
||||
int ViewProviderSketch::getApplicationLogicalDPIX() const {
|
||||
return QApplication::desktop()->logicalDpiX();
|
||||
return int(QApplication::primaryScreen()->logicalDotsPerInchX());
|
||||
}
|
||||
|
||||
int ViewProviderSketch::getViewOrientationFactor() const {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QColorDialog>
|
||||
@@ -315,7 +315,7 @@ void QtColorPicker::buttonPressed(bool toggled)
|
||||
if (!toggled)
|
||||
return;
|
||||
|
||||
const QRect desktop = QApplication::activeWindow()->geometry();
|
||||
const QRect desktop = QApplication::primaryScreen()->geometry();
|
||||
|
||||
// Make sure the popup is inside the desktop.
|
||||
QPoint pos = mapToGlobal(rect().bottomLeft());
|
||||
@@ -872,7 +872,7 @@ void ColorPickerPopup::regenerateGrid()
|
||||
// one.
|
||||
if (grid) delete grid;
|
||||
grid = new QGridLayout(this);
|
||||
grid->setMargin(1);
|
||||
grid->setContentsMargins(1, 1, 1, 1);
|
||||
grid->setSpacing(0);
|
||||
|
||||
int ccol = 0, crow = 0;
|
||||
|
||||
@@ -143,7 +143,7 @@ FileChooser::FileChooser( QWidget *parent )
|
||||
: QWidget( parent ), md( File ), _filter( QString() )
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout( this );
|
||||
layout->setMargin( 0 );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
layout->setSpacing( 6 );
|
||||
|
||||
lineEdit = new QLineEdit( this );
|
||||
|
||||
Reference in New Issue
Block a user