1 (edited by De-Backer 2020-06-01 10:32:36)

Topic: deprecated fix patch files

*fix deprecated warning qVariantFromValue

-14 Issues


*fix deprecated warning QTime::start()

This function was introduced in Qt 5.4.

-2 Issues


*fix deprecated warning QFontMetrics::width(QChar ch)

This function was introduced in Qt 5.11.
! "#if QT_VERSION < QT_VERSION_CHECK" used

-16 Issues


*fix deprecated warning QLineF::intersect

This function was introduced in Qt 5.14.
! "#if QT_VERSION < QT_VERSION_CHECK" used

-1 Issue

please check before you merge (! "#if QT_VERSION < QT_VERSION_CHECK" used !)

Post's attachments

Attachment icon fix-deprecated.zip 4.27 kb, 235 downloads since 2020-05-28 

Re: deprecated fix patch files

*fix Wmisleading-indentation warning
   
there were spaces used to indent the conditional line
     
-3 Issue

Post's attachments

Attachment icon 0001-fix-Wmisleading-indentation-warning.patch 1.58 kb, 221 downloads since 2020-05-28 

Re: deprecated fix patch files

*fix deprecated warning QWidget::getContentsMargins

This function is obsolete.

Use contentsMargins().
instead.

This function was introduced in Qt 4.6.

-1 Issue

please check before you merge see:

void IntegrationMoveTitleBlockTemplatesHandler::radioButtonleftMargin(QRadioButton *button) {
-    int a, b, c, d;
-    button -> getContentsMargins(&a, &b, &c, &d);
-    button -> setContentsMargins(a + 15, b, c, d);
+    button->contentsMargins().setLeft(button->contentsMargins().left()+15);
 }

Post's attachments

Attachment icon 0001-fix-deprecated-warning-QWidget-getContentsMargins.patch 1.12 kb, 208 downloads since 2020-05-28 

Re: deprecated fix patch files

Merged (all), thanks Simon.

I tried quickly on old projects and did not notice any major problems.
Of course, this is a devel version, it's time to clean up the old code a bit.

I finally managed to build the cross-compilation MXE environment with KDE Framework (KF5_VERSION 5.70) for Qt 5.15.0 (only x86_64-w64-mingw32 now for checking).

Well, is time for me to try Qt 5.15.0 under MS Windows and saw if I can provide packages with this Qt version..
https://qelectrotech.org/forum/viewtopi … 561#p10561

Edit: same font issue only for MS Windows again ... .element text "Sans Serif" fonts are blurred..

https://download.qelectrotech.org/qet/forum_img_2/Qt5.15_win_font%20_issue.png


A workaround to fix this issue on MS Windows with >=Qt 5.12.0 is to replace all Sans Serif default font by MS Shell Dlg 2 in all elements and all collections XML.. Btw users need hack our XML project also and replace Sans Serif police.

https://docs.microsoft.com/en-us/window … hell-dlg-2


It's really a shame to be stuck on Qt 5.12.0 for Windows packages, and not to take advantage of the advances in the framework ..

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

I try to fix the compile warnings first, afterwards i try to understand the code. (french is difficult for me)
My goal is to understand why the content of the .qet file always changes when saving, because this makes it difficult for git.
(everything is always different)
(i am using git to track the changes in my project 'cv.qet')

For MS Windows I will need more time.
I always want to help but my knowledge is still too limited.

Re: deprecated fix patch files

My goal is to understand why the content of the .qet file always changes when saving, because this makes it difficult for git.
(everything is always different)

Qt save XML attributes in a random order each time, this is one of the reasons why we added UUID to control the versions of the elements.

https://qelectrotech.org/forum/viewtopi … 4283#p4283

Attributes

For some time and over the succeeding versions of Qt, it became obvious that the attributes in the XML definition of the elements were not always be read and saved in the same order on each QET startup.
A Qt class compares attributes to know if a newly dragged/dropped element on the diagram already exists in the project. In this case, the class compares all the attributes.
For some speed reasons, this method compares the whole attributes string: if the position of an attribute is changed, the element is considered as different (new).

Among all possible solutions, the one which seems to us to be the easiest one is the generation of an universal unique identifier (UUID) for each element of the collection. In this way, only the UUID attributes of the files must be compared and not the whole XML attributes strings.
The elements editor generates automaticaly an UUID during the saving of the element file.

The database speeds up the loading of numberous elements by managing changes of element thumbnails in tables. To update the thumbnails cache, the database does no longer compare the modification date of these files, only the UUID attributes.

The official collection was patched to add the new UUID attribute.

Script bash unpretentious, for those on GNU/Linux who want to patch their own collection.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

For the warnings: Qt prepares the future and Qt 6, that is understandable and therefore marks a lot of obsolete method, if you compile it in an old version of Qt, you do not see any warning.

Thanks a lot for your work.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

Qt save XML

then I will use an external program for the dif's of my project.

I am currently working on fix preprocessor Issue error: 'foo.h' file not found
this provides the in QT editor linking.

Post's attachments

Screenshot_20200529_211552.jpg, 24.87 kb, 592 x 123
Screenshot_20200529_211552.jpg 24.87 kb, 217 downloads since 2020-05-29 

9 (edited by De-Backer 2020-05-30 00:59:36)

Re: deprecated fix patch files

*fix deprecated warning QList::swap(int i, int j)

*fix deprecated warning QDir& QDir::operator=(const QString&)

*fix -Wswitch warning   Qt::MarkdownText: //This enum value was added in Qt 5.14.

Post's attachments

Attachment icon 3 more fix.zip 2.38 kb, 227 downloads since 2020-05-30 

Re: deprecated fix patch files

I had to revert it
https://git.tuxfamily.org/qet/qet.git/c … e91882a445

Edit : ok I understood, I use Qt version 5.12.5 and this function was introduced in Qt 5.13.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

I will have to do more checks before releasing the patch files

Re: deprecated fix patch files

this is an example of a wrong patch:

fix deprecated -Wdeprecated-copy (C++11)

warning: implicitly-declared ‘NamesList& NamesList::operator=(const NamesList&)’ is deprecated [-Wdeprecated-copy]

Use copy and swap idiom to implement assignment.

Post's attachments

Attachment icon 0001-fix-deprecated-Wdeprecated-copy.patch 2.93 kb, 227 downloads since 2020-05-30 

Re: deprecated fix patch files

I tried "0001-fix-deprecated-Wdeprecated-copy.patch" is reduce warnings 50 to 6, but I don't know if I can push it?
First patch in attached patch reduce warnings 50 -> ~20.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

14 (edited by De-Backer 2020-05-30 11:36:11)

Re: deprecated fix patch files

No it is not according to the + c11 rules.
https://en.cppreference.com/w/cpp/langu … e_of_three

Re: deprecated fix patch files

I see, thanks.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

fix deprecated warning QDrag::start
   
Use
QDrag::exec
instead.

This function was introduced in Qt 4.3.

and for "fix deprecated -Wdeprecated-copy (C++11)"
I can't get my head around it, I will probably need some help.

Post's attachments

Attachment icon 0001-fix-deprecated-warning-QDrag-start.patch 800 b, 217 downloads since 2020-05-31 

Re: deprecated fix patch files

Merged, thanks.

for "fix deprecated -Wdeprecated-copy (C++11)"
I prefer saw some deprecated function warnings marked during compilation and still don't have much time to see them (Linux time make -j49 ~ 16 seconds, Catalina VM ~ 20 seconds..cross-compile for Windows ~20 seconds,  rather than silently adding new bugs which will be hard to find. nomicons/wink

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

16  + 20 + 20 = 56s
Wooo less than 1 min to build for three OS.

Développeur QElectroTech

Re: deprecated fix patch files

linksingleelementwidget.cpp:482:28: warning: 'setBackgroundColor' is deprecated: Use QTreeWidgetItem::setBackground() instead
qtreewidget.h:141:5: note: 'setBackgroundColor' has been explicitly marked deprecated here
qglobal.h:294:33: note: expanded from macro 'QT_DEPRECATED_X'
qcompilerdetection.h:675:55: note: expanded from macro 'Q_DECL_DEPRECATED_X'

"linksingleelementwidget.cpp"
@@ -478,11 +478,11 @@ void LinkSingleElementWidget::linkTriggered()

-            m_qtwi_at_context_menu->setBackgroundColor(i, Qt::green);
+            m_qtwi_at_context_menu->setBackground(i, QBrush(Qt::green,Qt::SolidPattern));

void QTreeWidgetItem::setBackgroundColor(int column, const QColor &color)
This function is deprecated. Use setBackground() instead.
See also backgroundColor().

void QTreeWidgetItem::setBackground(int column, const QBrush &brush)
Sets the background brush of the label in the given column to the specified brush. Setting a default-constructed brush will let the view use the default color from the style.
Note: If Qt Style Sheets are used on the same widget as setBackground(), style sheets will take precedence if the settings conflict.
This function was introduced in Qt 4.2.

Post's attachments

Attachment icon setBackground.zip 84.57 kb, 229 downloads since 2020-06-01 

Re: deprecated fix patch files

Merged, thanks.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

FYI, AppImage use now Qt 5.15.0.
https://invent.kde.org/sdk/kdesrc-build/-/issues/45

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

fix_deprecated_drawRoundRect
warning: ‘void QPainter::drawRoundRect(const QRectF&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]

void QPainter::drawRoundRect(const QRectF &r, int xRnd = 25, int yRnd = 25)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize)
Draws the given rectangle rect with rounded corners.
The xRadius and yRadius arguments specify the radii of the ellipses defining the corners of the rounded rectangle. When mode is Qt::RelativeSize, xRadius and yRadius are specified in percentage of half the rectangle's width and height respectively, and should be in the range 0.0 to 100.0.
A filled rectangle has a size of rect.size(). A stroked rectangle has a size of rect.size() plus the pen width. 

QRectF rectangle(10.0, 20.0, 80.0, 60.0);

QPainter painter(this);
painter.drawRoundedRect(rectangle, 20.0, 15.0);

This function was introduced in Qt 4.4.

Post's attachments

Attachment icon 0001-fix-deprecated-warning-QPainter-drawRoundRect.patch 2.64 kb, 223 downloads since 2020-06-01 

Re: deprecated fix patch files

Merged, thanks.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: deprecated fix patch files

warning: base class ‘class QAbstractTableModel’ should be explicitly initialized in the copy constructor [-Wextra]

sources/qetgraphicsitem/ViewItem/nomenclaturemodel.cpp:46:1:

-NomenclatureModel::NomenclatureModel(const NomenclatureModel &other_model)
+NomenclatureModel::NomenclatureModel(const NomenclatureModel &other_model) :
+    QAbstractTableModel(this),
+    m_project(project())

is ok?
info of https://stackoverflow.com/questions/211 … onstructor

Post's attachments

Attachment icon 0001-fix-warning-QAbstractTableModel-initialized-in-the-c.patch 1.29 kb, 224 downloads since 2020-06-04 

Re: deprecated fix patch files

warning: ‘QSet<T> QList<T>::toSet() const [with T = IndependentTextItem*]’ is deprecated:
Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]

-5 issues  for QT 5.14

Post's attachments

Attachment icon 0001-fix-deprecated-warning-QSet-T-QList-T-toSet.patch 2.15 kb, 234 downloads since 2020-06-07