From af0a014cf25cb0963aeddb2a1be2c7e3e8b5c7ee Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 1 Nov 2022 16:55:40 +0100 Subject: [PATCH] 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 --- src/Gui/AutoSaver.cpp | 2 ++ src/Gui/ComboView.cpp | 2 +- src/Gui/DlgCustomizeImp.cpp | 4 ++-- src/Gui/DocumentModel.cpp | 8 ++------ src/Gui/DocumentRecovery.cpp | 2 ++ src/Gui/EditorView.cpp | 2 +- src/Gui/FileDialog.cpp | 8 ++++---- src/Gui/Flag.cpp | 2 +- src/Gui/GuiApplication.cpp | 2 ++ src/Gui/ManualAlignment.cpp | 2 +- src/Gui/PropertyView.cpp | 4 ++-- src/Gui/QSint/actionpanel/actiongroup.cpp | 2 +- src/Gui/QSint/actionpanel/actionpanel.cpp | 2 +- src/Gui/QSint/actionpanel/taskgroup_p.cpp | 4 ++-- src/Gui/QSint/actionpanel/taskheader_p.cpp | 2 +- src/Gui/ReportView.cpp | 2 +- src/Gui/SelectionView.cpp | 2 +- src/Gui/Splashscreen.cpp | 2 ++ src/Gui/Thumbnail.cpp | 2 +- src/Gui/Tree.cpp | 9 ++------- src/Gui/Tree.h | 1 - src/Gui/Widgets.cpp | 6 +++--- src/Gui/propertyeditor/PropertyItem.cpp | 6 ++++-- src/Mod/Part/App/FaceMakerCheese.cpp | 1 + src/Mod/Part/Gui/DlgFilletEdges.cpp | 2 +- src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp | 4 +--- src/Mod/Sketcher/Gui/SketcherSettings.cpp | 2 +- src/Mod/Sketcher/Gui/SoDatumLabel.cpp | 3 +-- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 4 ++-- src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp | 6 +++--- src/Tools/plugins/widget/customwidgets.cpp | 2 +- 31 files changed, 50 insertions(+), 52 deletions(-) diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index 38e49ae04b71..a4e9125c16eb 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -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 << "\n" << "\n"; str << " Created\n"; diff --git a/src/Gui/ComboView.cpp b/src/Gui/ComboView.cpp index 41cc522afef9..51887e93d2e3 100644 --- a/src/Gui/ComboView.cpp +++ b/src/Gui/ComboView.cpp @@ -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 (); diff --git a/src/Gui/DlgCustomizeImp.cpp b/src/Gui/DlgCustomizeImp.cpp index cbe2c6f6869f..2189ff3f0555 100644 --- a/src/Gui/DlgCustomizeImp.cpp +++ b/src/Gui/DlgCustomizeImp.cpp @@ -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")); diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index 52d0f1de6749..2f0eb72eb574 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -268,9 +268,7 @@ namespace Gui { Document* doc = Application::Instance->activeDocument(); QFont font; font.setBold(doc==&d); - QVariant variant; - variant.setValue(font); - return variant; + return static_cast(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(font); - return variant; + return static_cast(font); } return QVariant(); diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index c080a727acd8..cf14da33b796 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -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 << "\n" << "\n"; switch (info.status) { diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 819d3447b865..5ed2f396e8d3 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -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); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index be7023e222e3..dbd7a787caae 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -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); diff --git a/src/Gui/Flag.cpp b/src/Gui/Flag.cpp index 109c2d431d35..1c9703f035f2 100644 --- a/src/Gui/Flag.cpp +++ b/src/Gui/Flag.cpp @@ -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); } diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index 8f1fb2076b91..418a35aab2bb 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -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() diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 4d90868ea491..3481667fcef3 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -394,7 +394,7 @@ class AlignmentView : public Gui::AbstractSplitView auto vbox = new QFrame(this); auto layout = new QVBoxLayout(); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); vbox->setLayout(layout); diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 90324984674f..4930344205d4 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -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 ); diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index 596fb8ea3123..cabf9b0ae822 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -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); diff --git a/src/Gui/QSint/actionpanel/actionpanel.cpp b/src/Gui/QSint/actionpanel/actionpanel.cpp index cfbad04d94d2..c37692627158 100644 --- a/src/Gui/QSint/actionpanel/actionpanel.cpp +++ b/src/Gui/QSint/actionpanel/actionpanel.cpp @@ -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); } diff --git a/src/Gui/QSint/actionpanel/taskgroup_p.cpp b/src/Gui/QSint/actionpanel/taskgroup_p.cpp index c87873c8aefb..9aa3a357f212 100644 --- a/src/Gui/QSint/actionpanel/taskgroup_p.cpp +++ b/src/Gui/QSint/actionpanel/taskgroup_p.cpp @@ -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(); diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp index 627d5c3f3441..ca6288d253d6 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.cpp +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -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); diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index 9b0760005488..1a469143f78d 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -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")); diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index b190fb7d871b..9597824d891b 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -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")); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 6f14084f3e76..1b8981c4f2f1 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -412,7 +412,9 @@ void AboutDialog::showCredits() creditsHTML += QString::fromLatin1("
    "); 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()) { diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index f5b607d5e215..4bc2d3a9adbc 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -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")); diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 98ab70a754bc..eb55747ca552 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1489,11 +1489,6 @@ void TreeWidget::startDrag(Qt::DropActions supportedActions) } } -QMimeData* TreeWidget::mimeData(const QList 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); } diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index bcb8d1a1f9d5..e4a39697d4d6 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -124,7 +124,6 @@ class TreeWidget : public QTreeWidget, public SelectionObserver bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) override; Qt::DropActions supportedDropActions () const override; - QMimeData * mimeData (const QList items) const override; void dragEnterEvent(QDragEnterEvent * event) override; void dragLeaveEvent(QDragLeaveEvent * event) override; void dragMoveEvent(QDragMoveEvent *event) override; diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 4385385085c4..69545ee49935 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -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); diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 1e9424085727..ea4c74f608c5 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -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); diff --git a/src/Mod/Part/App/FaceMakerCheese.cpp b/src/Mod/Part/App/FaceMakerCheese.cpp index 1d6789181e21..33c5077678d8 100644 --- a/src/Mod/Part/App/FaceMakerCheese.cpp +++ b/src/Mod/Part/App/FaceMakerCheese.cpp @@ -22,6 +22,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include # include # include # include diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index ed49d331c949..f1693a7b9651 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -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); diff --git a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp index 7880c0466822..f71d86a690c4 100644 --- a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp @@ -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]); diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 42194d195d06..5df8205258e1 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -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); } diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp index 69b25dd7d856..7099e313cf4a 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp @@ -36,7 +36,6 @@ # include # include # include -# include # include # include # include @@ -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()); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index afdd898b3289..d8446f397712 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -39,13 +39,13 @@ # include # include # include -# include # include # include # include # include # include # include +# include # include #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 { diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp index 969025af6102..d44c800ac2ee 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp @@ -46,7 +46,7 @@ ****************************************************************************/ #include -#include +#include #include #include #include @@ -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; diff --git a/src/Tools/plugins/widget/customwidgets.cpp b/src/Tools/plugins/widget/customwidgets.cpp index da992cde7d47..5c918d01e79b 100644 --- a/src/Tools/plugins/widget/customwidgets.cpp +++ b/src/Tools/plugins/widget/customwidgets.cpp @@ -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 );