From filippocucchetto at gmail.com Fri Jul 1 09:38:11 2016 From: filippocucchetto at gmail.com (Filippo Cucchetto) Date: Fri, 1 Jul 2016 09:38:11 +0200 Subject: [Development] Input events handling ideas and feedback In-Reply-To: <22773438-3EA5-4FD4-A8D6-8E788F5FF9E6@qt.io> References: <073A4C5F-6278-4354-8F01-3F5E8C68230E@qt.io> <22773438-3EA5-4FD4-A8D6-8E788F5FF9E6@qt.io> Message-ID: > if we had time to filter out all the good ideas from all the frameworks, we’d have a better chance of making ours the best. ;-) Agreed :) > Well we advertise that it’s a declarative language. We could make it even more that way, even if it’s not strictly necessary. Would it be more elegant? Yes absolutely > Well in my experience, handling clicks inside delegates works fine Yes it works fine in the sense that you receive the event in the delegate MouseArea. But if you received the click event that means that you accepted the press event (given that the click is a composed event) and this in turn imply that a view child MouseArea doesn't receive the press event. This breaks selection in TreeViews or TableViews (probably because the do not monitor childMouseEvents) and in the delegate MouseArea there's no way to receive a click event without "stealing" the press event. > I think we could say that QQuickWindowPrivate::deliverInitialMousePressEvent() does tunnelling: it starts with the root and goes recursively _down_ through the children until the event is accepted (Handled in WPF terminology). But for each child recursively, it calls QQuickWindow::sendEvent(), which in the case of mouse events calls sendFilteredMouseEvent(item->parentItem(), item, e, &hasFiltered). And that goes recursively _up_ the parent hierarchy, calling childMouseEventFilter on any ancestor Item which has the filtersChildMouseEvents flag set. So it’s kindof like bubbling, but it happens before the real event handling in the leaf Item, rather than afterwards. And it happens multiple times per “target", which would be inefficient and redundant, so QSet *hasFiltered is used to keep track of the items that have already had their chance at filtering. (Yeah, a fresh new QSet gets populated for every event. But it’s not the only case of that, either.) So that’s already rather like bubbling, but I'd worry about changing the order: WPF gives the “source” a chance to handle the event first, then the bubbling happens after; whereas QtQuick does sendFilteredMouseEvent first and then lets the Item have the event. That might be a big change to make. But then again, by the time the ListView’s drag threshold is exceeded, the MouseArea inside the delegate has already been the grabber for a while; so the grab must be canceled, and that involves sending another event to tell it that it was canceled. So if we did tunnelling followed by bubbling, we’d need to keep doing that, and maybe it would be OK. I think that the childMouseEventFilter way of being called it's weird. I would expect that if A and B are two nodes where B is higher in Z stack, A::childMouseEventFilter should be called before B. Instead from what you explain and by looking at the code it seems that the deliverInitialMousePressEvent() first goes down the hierarchy and then calls childMouseEventFilter from child to root (so B::childMouseEventFilter will be called before A). Given that i think that childMouseEventFilter it's basically tunneling in the WPF way (so an handle where you can receive an event before it gets delivered to a child). > Then under WPF Input Events there is a tree of elements. Based on the explanation, I guess it does start with the root element and does tunnelling, but is that the first step or do they already know by magic that leaf #2 “raised” the event? How did they skip the step of tunnelling to leaf #1? In pseudocode (and please skip the naive implementation) i think that they basically do let mouseEvent let a = x in allItems() where if x.enabled and x.contains(mouseEvent.pos()) let b = a.sortByGlobalZOrder() // So if x is before y in b than x is painted over y // Here we know that b[0] will raise the event for (x in b.reverse()) if (x.onPreviewMouseEvent(mouseEvent) return for (x in b) if (x.handleAlreadyAcceptedEvents or not mouseEvent.accepted) x.onMouseEvent(mouseEvent) What i see it's that have the concepted of "raise" and "handle". So in the example they first find the item that "raise" the event After that by doing tunneling and later bubbling they will find the event that accept it. Furthermore during the calls to handlers they propagate some information about the previous item who has been called by doing bubbling/tunneling and who raised the event. > Aha… so bubbling doesn’t always occur: For what i see bubbling always happen if the event has not been pre filtered by tunneling. In this case the event bubble up until it gets accepted. After being accepted the bubbling continue iff there'are items who what to handle "AlreadyAccepted" events. -- Filippo Cucchetto From kollix at aon.at Fri Jul 1 13:26:17 2016 From: kollix at aon.at (Martin Koller) Date: Fri, 01 Jul 2016 13:26:17 +0200 Subject: [Development] dev branch compile fails module-qtdatavis3d Message-ID: <5970992.y8V6gHAJt6@lapi.koller> Hi, trying to build module-qtdatavis3d on dev branch (with a namespace) fails here with: make[3]: Entering directory '/home/PACKAGES/qt/qt-repo/qt5/qtdeclarative/tools/qml' g++ -Wl,--gc-sections -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA -lQt5GuiWinCC_OA -lQt5CoreWinCC_OA -lGL -lpthread /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined reference to `qt_version_tag' collect2: error: ld returned 1 exit status Makefile:67: recipe for target '/home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml' failed any idea why this fails ? -- Best regards/Schöne Grüße Martin A: Because it breaks the logical sequence of discussion Q: Why is top posting bad? () ascii ribbon campaign - against html e-mail /\ - against proprietary attachments Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at From thiago.macieira at intel.com Fri Jul 1 17:39:07 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 08:39:07 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <5970992.y8V6gHAJt6@lapi.koller> References: <5970992.y8V6gHAJt6@lapi.koller> Message-ID: <3777990.ppmVsU8688@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 13:26:17 PDT Martin Koller wrote: > g++ -Wl,--gc-sections -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o > /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o > .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib > -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA -lQt5GuiWinCC_OA > -lQt5CoreWinCC_OA -lGL -lpthread > /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined > reference to `qt_version_tag' This error indicates your Qt headers do not match the QtCore library. Did you by any chance also build with a namespace? -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Fri Jul 1 20:36:56 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 11:36:56 -0700 Subject: [Development] Use of Standard Library containers in Qt source code Message-ID: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Premises not under discussion: Qt source code is product and meant to be read by our users Qt source code must be clean and readable The above is not up for debate. For some time now, we've had a flurry of changes to Qt source code that uses the Standard Library's containers and algorithms, in the name of performance and often code size gains. I'm not disputing that there is a gain. But I am wondering about the trade-off we're making with regards to readability. For example, I was just reviewing this code: if (d->currentReadChannel >= d->readHeaders.size() || d->readHeaders[d->currentReadChannel].empty()) { Q_ASSERT(d->buffer.isEmpty()); The use of the Standard Library member "empty" is highly confusing at first sight because it does not follow the Qt naming guidelines. It's even more confusing because the next line has "isEmpty". When I read this code, I had to wonder if that "empty" was a verb in the imperative, meaning the author was trying to remove all elements from the container. I had to look up the definition of readHeaders in the review and note that it was a std::deque, not a Qt container. What do we do? Option 1: Not use Standard Library containers, just use the Qt containers as they exist. Option 2: Create new Qt containers to have the same complexity as Standard Library containers, but following the Qt naming conventions. Possibly with implicit sharing. Option 3: Create Qt API wrappers for those containers like std::deque, adding only a few inline functions to match the Qt-style API where the Standard Library API deviates. Examples are: empty -> isEmpty push_back -> append front -> first pop_front -> takeFirst cbegin -> constBegin cfind -> constFind -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Fri Jul 1 21:34:15 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 12:34:15 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <2133524.ekmAkN6kfG@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 11:36:56 PDT Thiago Macieira wrote: > Option 1: > Not use Standard Library containers, just use the Qt containers as they > exist. > > Option 2: > Create new Qt containers to have the same complexity as Standard Library > containers, but following the Qt naming conventions. Possibly with implicit > sharing. > > Option 3: > Create Qt API wrappers for those containers like std::deque, adding only a > few inline functions to match the Qt-style API where the Standard Library > API deviates. Examples are: > empty -> isEmpty > push_back -> append > front -> first > pop_front -> takeFirst > cbegin -> constBegin > cfind -> constFind Of course, Option 4: Continue to allow Standard Library containers in internal code (no API or ABI constraining) where there's a clear gain in performance and/or size. Option 5: Allow Standard Library containers in internal code even if performance or code size gains are not appreciable or have not been measured. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From kollix at aon.at Fri Jul 1 21:36:21 2016 From: kollix at aon.at (Martin Koller) Date: Fri, 01 Jul 2016 21:36:21 +0200 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <3777990.ppmVsU8688@tjmaciei-mobl1> References: <5970992.y8V6gHAJt6@lapi.koller> <3777990.ppmVsU8688@tjmaciei-mobl1> Message-ID: <1752970.1ZvLjpp7pR@lapi.koller> On Friday 01 July 2016 08:39:07 Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 13:26:17 PDT Martin Koller wrote: > > g++ -Wl,--gc-sections -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o > > .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib > > -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA -lQt5GuiWinCC_OA > > -lQt5CoreWinCC_OA -lGL -lpthread > > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined > > reference to `qt_version_tag' > > This error indicates your Qt headers do not match the QtCore library. > > Did you by any chance also build with a namespace? yes, this is what I said in my first mail. -- Best regards/Schöne Grüße Martin A: Because it breaks the logical sequence of discussion Q: Why is top posting bad? () ascii ribbon campaign - against html e-mail /\ - against proprietary attachments Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at From thiago.macieira at intel.com Fri Jul 1 21:45:07 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 12:45:07 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <1752970.1ZvLjpp7pR@lapi.koller> References: <5970992.y8V6gHAJt6@lapi.koller> <3777990.ppmVsU8688@tjmaciei-mobl1> <1752970.1ZvLjpp7pR@lapi.koller> Message-ID: <1690774.AWVGoT3XG7@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 21:36:21 PDT Martin Koller wrote: > On Friday 01 July 2016 08:39:07 Thiago Macieira wrote: > > On sexta-feira, 1 de julho de 2016 13:26:17 PDT Martin Koller wrote: > > > g++ -Wl,--gc-sections > > > -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o > > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o > > > .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib > > > -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA > > > -lQt5GuiWinCC_OA > > > -lQt5CoreWinCC_OA -lGL -lpthread > > > > > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined > > > reference to `qt_version_tag' > > > > This error indicates your Qt headers do not match the QtCore library. > > > > Did you by any chance also build with a namespace? > > yes, this is what I said in my first mail. "qt_version_tag" is the name of the tag for unnamespaced Qt. If you do readelf -s libQt5CoreWinCC_OA.so.5 You'll probably see "qt_version_tag_X" where X is your namespace, some with extra suffixes for previous Qt versions and one with @@. Can you confirm that? Can you check if the build of this application had QT_NAMESPACE defined? Please paste the command-line that was used to compile main.cpp. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From annulen at yandex.ru Fri Jul 1 21:52:24 2016 From: annulen at yandex.ru (Konstantin Tokarev) Date: Fri, 01 Jul 2016 22:52:24 +0300 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <5159741467402744@web6j.yandex.ru> 01.07.2016, 21:37, "Thiago Macieira" : > Premises not under discussion: > >         Qt source code is product and meant to be read by our users >         Qt source code must be clean and readable > > The above is not up for debate. > > For some time now, we've had a flurry of changes to Qt source code that uses > the Standard Library's containers and algorithms, in the name of performance > and often code size gains. > > I'm not disputing that there is a gain. But I am wondering about the trade-off > we're making with regards to readability. For example, I was just reviewing > this code: > >     if (d->currentReadChannel >= d->readHeaders.size() >         || d->readHeaders[d->currentReadChannel].empty()) { >         Q_ASSERT(d->buffer.isEmpty()); > > The use of the Standard Library member "empty" is highly confusing at first > sight because it does not follow the Qt naming guidelines. It's even more > confusing because the next line has "isEmpty". When I read this code, I had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. > > I had to look up the definition of readHeaders in the review and note that it > was a std::deque, not a Qt container. STL was standardized 18 years ago, I think it should be enough to get used to empty(). > > What do we do? > > Option 1: > Not use Standard Library containers, just use the Qt containers as they exist. > > Option 2: > Create new Qt containers to have the same complexity as Standard Library > containers, but following the Qt naming conventions. Possibly with implicit > sharing. > > Option 3: > Create Qt API wrappers for those containers like std::deque, adding only a few > inline functions to match the Qt-style API where the Standard Library API > deviates. Examples are: >         empty -> isEmpty >         push_back -> append >         front -> first >         pop_front -> takeFirst >         cbegin -> constBegin >         cfind -> constFind > > -- > Thiago Macieira - thiago.macieira (AT) intel.com >   Software Architect - Intel Open Source Technology Center > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development -- Regards, Konstantin From thiago.macieira at intel.com Fri Jul 1 22:05:45 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 13:05:45 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <5159741467402744@web6j.yandex.ru> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> Message-ID: <122393150.dApz54YNzL@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 22:52:24 PDT Konstantin Tokarev wrote: > > I had to look up the definition of readHeaders in the review and note that > > it was a std::deque, not a Qt container. > > STL was standardized 18 years ago, I think it should be enough to get used > to empty(). Qt API conventions predate the Standard Library standardisation. Qt's style exists because -- quite by definition -- Qt developers think their style is better. Moreover, Qt is recognised for having a nice, easy-to-learn API, whereas the C++ Standard Library meets quite often the exact opposite reaction (yes, anecdotal evidence). More to the point, Qt developers don't have to know the Standard Library. *I* don't and I don't have time or interest in learning it. You will always see me write a for-loop to fill something rather than use std::fill. Qt users don't have to learn it either. If they read the Qt source code, they should understand it. They might do that because they were debugging their application and stepped into Qt to find out what's happening. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From giuseppe.dangelo at kdab.com Fri Jul 1 22:13:42 2016 From: giuseppe.dangelo at kdab.com (Giuseppe D'Angelo) Date: Fri, 1 Jul 2016 22:13:42 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <2133524.ekmAkN6kfG@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> Message-ID: <5776CEF6.9020603@kdab.com> Howdy, Il 01/07/2016 21:34, Thiago Macieira ha scritto: > On sexta-feira, 1 de julho de 2016 11:36:56 PDT Thiago Macieira wrote: >> Option 1: >> Not use Standard Library containers, just use the Qt containers as they >> exist. However this is an anti-goal. As you stated, STL containers usage inside Qt is increasing for very good reasons. In the case in question, there isn't even a Qt equivalent for std::deque, and I don't see one coming anytime soon. (And even so, is it really going to outperform a container which has been around, studied, profiled, optimized, instrumented, for 15+ years?) >> Option 2: >> Create new Qt containers to have the same complexity as Standard Library >> containers, but following the Qt naming conventions. Possibly with implicit >> sharing. Again, also this looks like a massive anti-goal. I don't think we should invest any resource in this massive effort that reinvents the wheel, just for the sake of renaming a few functions. (... not to mention that is extremely likely that we will always lag behind the current Standard and perform worse than any other STL implementation under any possible benchmark. Even today: where is QList::push_back(T&&)? Where are our emplacement functions and their try versions? Where are our exception guarantees?) >> >> Option 3: >> Create Qt API wrappers for those containers like std::deque, adding only a >> few inline functions to match the Qt-style API where the Standard Library >> API deviates. Examples are: >> empty -> isEmpty >> push_back -> append >> front -> first >> pop_front -> takeFirst >> cbegin -> constBegin >> cfind -> constFind > > Of course, Option 4: > Continue to allow Standard Library containers in internal code (no API or ABI > constraining) where there's a clear gain in performance and/or size. 3 and 4 actually don't conflict, do they? If we subclass STL containers (say, in a QtStl namespace) and add those inline functions we would still be using them in the end. But before going this way, is it possible to estimate the amount of work to get this in place? > > Option 5: > Allow Standard Library containers in internal code even if performance or code > size gains are not appreciable or have not been measured. Which again seems like a sensible thing to do in general, unless there are documented cases in which Qt containers significantly outperform STL ones (apart from implicit sharing). IIRC, when there was the big thread about whether allowing STL containers or not in Qt implementation, people did such benchmarks and the results were always in favour of STL. Can anyone find the relative links...? My 2 cents, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4007 bytes Desc: Firma crittografica S/MIME URL: From mwoehlke.floss at gmail.com Fri Jul 1 22:25:14 2016 From: mwoehlke.floss at gmail.com (Matthew Woehlke) Date: Fri, 01 Jul 2016 16:25:14 -0400 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <5776CEF6.9020603@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <5776CEF6.9020603@kdab.com> Message-ID: On 2016-07-01 16:13, Giuseppe D'Angelo wrote: > Even today: where is QList::push_back(T&&)? Where are our emplacement > functions and their try versions? Where are our exception guarantees?) ...what's an exception? ;-) Never heard of those in Qt... -- Matthew From rafael.roquetto at kdab.com Fri Jul 1 23:31:17 2016 From: rafael.roquetto at kdab.com (Rafael Roquetto) Date: Fri, 1 Jul 2016 18:31:17 -0300 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <122393150.dApz54YNzL@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: <20160701213115.GA5075@orion> On Fri, Jul 01, 2016 at 01:05:45PM -0700, Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 22:52:24 PDT Konstantin Tokarev wrote: > > > I had to look up the definition of readHeaders in the review and note that > > > it was a std::deque, not a Qt container. > > > > STL was standardized 18 years ago, I think it should be enough to get used > > to empty(). > > Qt API conventions predate the Standard Library standardisation. Qt's style > exists because -- quite by definition -- Qt developers think their style is > better. Moreover, Qt is recognised for having a nice, easy-to-learn API, > whereas the C++ Standard Library meets quite often the exact opposite reaction > (yes, anecdotal evidence). I second this. Qt API is highly praised, for a good reason. It is one of the big assets of Qt. IMHO the compromise of subclassing STL stuff inside the QtStl namespace seems like a good deal - it may require some effort, but we get to keep a clean API. I would even go as far as saying this is better than simply allowing unrestricted STL code into Qt source code, because unless we rename (ruin) some method signatures in the Qt API, we would end up with the sort of inconsistent source code demonstrated by Thiago's example, which I judge to be the worst-case scenario. Of course, all this assumes the introduction of a QtStl namespace to be a feasible task. Whether it really is I cannot say. -- Rafael Roquetto | rafael.roquetto at kdab.com | Software Engineer Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3599 bytes Desc: not available URL: From thiago.macieira at intel.com Fri Jul 1 23:56:36 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 14:56:36 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <5776CEF6.9020603@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <5776CEF6.9020603@kdab.com> Message-ID: <3399679.28OPHdOIhQ@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 22:13:42 PDT Giuseppe D'Angelo wrote: > Even today: where is QList::push_back(T&&)? Where are our emplacement > functions and their try versions? Where are our exception guarantees?) We don't care about exceptions, so we won't be adding those. As for the move-versions, since we can't take move-only types in our containers due to the implicit sharing, does it really make a difference if we have them or not? > >> Option 3: > >> Create Qt API wrappers for those containers like std::deque, adding only > >> a > >> few inline functions to match the Qt-style API where the Standard > >> Library > >> > >> API deviates. Examples are: > >> empty -> isEmpty > >> push_back -> append > >> front -> first > >> pop_front -> takeFirst > >> cbegin -> constBegin > >> cfind -> constFind > > > > Of course, Option 4: > > Continue to allow Standard Library containers in internal code (no API or > > ABI constraining) where there's a clear gain in performance and/or size. > 3 and 4 actually don't conflict, do they? If we subclass STL containers > (say, in a QtStl namespace) and add those inline functions we would > still be using them in the end. But before going this way, is it > possible to estimate the amount of work to get this in place? The difference is the API used elsewhere in our code. The amount of work should be minimal. There's just a handful of functions that need different names, plus two more like takeFirst and takeLast that do two things in one. > > Option 5: > > Allow Standard Library containers in internal code even if performance or > > code size gains are not appreciable or have not been measured. > > Which again seems like a sensible thing to do in general, unless there > are documented cases in which Qt containers significantly outperform STL > ones (apart from implicit sharing). I would prefer the opposite: use non-Qt only if that is better than the Qt equivalent. If you can't prove it or if it's too small, it's not worth the difference in readability that it creates. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Fri Jul 1 23:58:04 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 14:58:04 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <20160701213115.GA5075@orion> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <122393150.dApz54YNzL@tjmaciei-mobl1> <20160701213115.GA5075@orion> Message-ID: <2453627.h6joPLscdv@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 18:31:17 PDT Rafael Roquetto wrote: > Of course, all this assumes the introduction of a QtStl namespace to be a > feasible task. Whether it really is I cannot say. I'd say we start with it in a private header, add classes to it as needed. If we're happy with it, then we can consider making it public, later. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From samuel.gaist at edeltech.ch Sat Jul 2 01:11:28 2016 From: samuel.gaist at edeltech.ch (Samuel Gaist) Date: Sat, 2 Jul 2016 01:11:28 +0200 Subject: [Development] New configuration system In-Reply-To: <4D7485AB-6F17-49F7-B5A6-DAA776FE613A@qt.io> References: <4D7485AB-6F17-49F7-B5A6-DAA776FE613A@qt.io> Message-ID: <67346AF5-ACB5-465A-8DAC-354C9E51754C@edeltech.ch> On 23 juin 2016, at 09:29, Lars Knoll wrote: > Hi, > > As some of you might know, I’ve been working for some time now on developing a new configuration system for Qt. As the first large change went in yesterday evening, I guess it’s time I describe it a little, and also tell you a bit about what’s still coming. > > The goal of the new system is twofold. First of all, we are seeing a large need, especially with our embedded users, to customise how Qt is being built. Many of them have size restrictions ore rather hard testing requirements, where being able to limit the functionality available in Qt is extremely helpful. We had such a system (see src/corelib/global/qfeatures.txt) before, but it was disconnected from the configure script, wasn’t really maintained since Qt 4 times, and had quite many limitations that I hope to solve with the new system. > > Secondly, we have had to deal for a long time with two different configuration systems. We had a monster of a shell script for unix, and an Qt based executable on Windows. Changes to Qt often required changing both, and it was very easy to sneak subtle errors in. Maintainability of the old system was in general very poor. > > So with that comes the new system. As I said, the first (but largest) patch went yesterday evening (see https://codereview.qt-project.org/#/c/149202/). It basically moves most of the configuration handling from the shell script over to a declarative json file (currently configure.json) that is being processed by qmake. This currently only affects Unix, Windows platforms are still being configured through configure.exe. The change aims to be a 1 to 1 (or at least as close as possible) mapping of the old shell script to the new system. So if you find that some configuration you’re using is suddenly broken let me know. > > I’ll send out a separate email describing the new system in more detail for those who are interested. > > For everybody else, there are a couple of changes that will still come in over the next couple of weeks: > > * Give every module a qtmoduleglobal.h and qtmoduleglobal_p.h file > > We already have per module global files for many modules (they are often required for the export/import handling of classes/symbols). With the new system we will add a public and private global file per module. I’ll start requiring that all public headers of the module include the public global file first, all private headers the private global file. > > This is needed some steps below to modularise the configuration system and to allow us to track whether a certain feature we rely upon in code is actually available or not. > > See https://codereview.qt-project.org/#/c/161143 and subsequent changes (the change adding global_p.h is still missing here, but will come as well) > > * Saner handling of 3rd party libs > > Currently all our dependencies to external libs are handled in a rather ad-hoc way in the pro files. The goal is to unify this, see https://codereview.qt-project.org/#/c/161660/ > > * Modularisation of the new configuration system > > I have some patches pending to modularise the new system. We will basically have one json configuration file per module/shared library. This will also allow us to use the system fully on repositories outside of qtbase, who currently have rather limited support for being configured. > > With this change, we will start creating a qtmodule-config.h and qtmodule-config_p.h file as well as a corresponding public and private .pri files for each module. qtmodule-config.h will get included from the public global header for the module, qtmodule-config_p.h from the private one. > > The public pro file will contain definitions for the features that are being exported by the module, the private one for features that are only relevant in the context of the module itself. As an example, ‘mimetypes’ would be a public feature of QtCore (as it changes the set of available API), whereas ‘glib’ would be most likely a private one (as it only determines which event loop to use and doesn’t change API). > > See change https://codereview.qt-project.org/#/c/159604/40 and the following commit > > * Integration of the old feature system > > As said above, there is the old feature system (see qfeatures.txt in corelib/global). With the work above done, integrating it into the system will be trivial (change https://codereview.qt-project.org/#/c/159763/) > > * With this done, I will also want to introduce a new mechanism to handle features in our cpp and header files. The current double negated #ifndef QT_NO_FOO is hard to read and unsafe. By unsafe, I mean that the compiler won’t error out or warn us if the feature ‘foo’ isn’t available (because of a typo or because the feature is actually defined in widgets and you tried using it in gui). I have some pending work that would change this to use a macro function "#if QT_HAS_FEATURE(foo)” where we would actually get a compile error if the feature foo isn’t known to the system. As a nice side effect I’m planning on having the same names for features between .pro and c++ files. > > * Further reduce the shell script > > The longer term goal will be to reduce the shell script further, until it’s basically a bootstrapping step for qmake, and hand all the other configuration work over to qmake. Some more patches for this are pending, but further help here would be appreciated. > > > * Get rid of configure.exe > > Finally, I’d also like to get rid of configure.exe, and do the same thing on Windows (ie. Bootstrap qmake from a small script, like we bootstrap configure.exe today) and then let qmake deal with the rest. With that we should be able to get to one cross-platform configuration system. For this task I’d be looking for volunteers :) > > Cheers, > Lars > Hi, Pretty nice ! That will be very useful to simplify Qt customization for constrained hardware. Will there also be a GUI available to help create custom configurations ? A side question, I've got a few submissions adding handling for a bunch of missing QT_NO_DRAGANDDROP/CLIBOARD tests. Should I ping them to get them in before the QT_HAS_FEATURE migration or rather wait for it and update the patches then ? Regards Samuel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From thiago.macieira at intel.com Sat Jul 2 02:35:04 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Fri, 01 Jul 2016 17:35:04 -0700 Subject: [Development] Announcing moc_combine In-Reply-To: <2097120.WNQMIhggTj@tjmaciei-mobl1> References: <2097120.WNQMIhggTj@tjmaciei-mobl1> Message-ID: <1986017.uhvd8pa52r@tjmaciei-mobl1> On domingo, 29 de maio de 2016 13:05:07 PDT Thiago Macieira wrote: > I've just pushed a feature[1] Change is now abandoned due to lack of volunteers to modify qmake to generate a suitable Makefile. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From marc.mutz at kdab.com Sat Jul 2 07:46:28 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Sat, 2 Jul 2016 07:46:28 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <201607020746.30009.marc.mutz@kdab.com> On Friday 01 July 2016 20:36:56 Thiago Macieira wrote: > The use of the Standard Library member "empty" is highly confusing at > first sight because it does not follow the Qt naming guidelines. It's > even more confusing because the next line has "isEmpty". When I read this > code, I had to wonder if that "empty" was a verb in the imperative, > meaning the author was trying to remove all elements from the container. Don't make this about the STL. Your arguments trivally extend to any third- party code. So what you are actually proposing is to not use any third-party code in Qt unless it is wrapped in a Qtsy API first. This is a bit over the top, isn't it? We want to allow our users to stay in the cozy Qt bubble for their own projects. As implementers of that bubble, we have no right to stay in it ourselves if doing so would be to the detriment of our users. And even creating an API wrapper is to the detriment of our users, because it requires resources that are then no longer available to fix real problems. If this is straw poll, I'm voting for Option 5. C++ programmers (those that wish to implement a C++ library) should be familiar with the STL. Thanks, Marc -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From marc.mutz at kdab.com Sat Jul 2 08:42:42 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Sat, 2 Jul 2016 08:42:42 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <122393150.dApz54YNzL@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: <201607020842.44832.marc.mutz@kdab.com> On Friday 01 July 2016 22:05:45 Thiago Macieira wrote: > I > don't and I don't have time or interest in learning it. You will always see > me write a for-loop to fill something rather than use std::fill. This reminds of the party quip: "I was always bad at math in school " :) But seriously: This sort of sentiment fosters mistakes such as looping over QVector::erase(it), turning a linear operation quadratic, and people trying to reimplement binary search, leading to unstable search results that depend on the size of the container. IOW: bugs. Yes. I'm saying: Less STL use == more bugs. We should instead foster the use of STL algorithms ("No raw loops"), not use ignorance of the greatest C++ library ever written as a reason not to use what it has to offer. About APIs: The STL has a great API. push_back() / back() vs. append() / last(), e.g. It just happens to be largely consistent with itself instead of with Qt. But camelCase is not intrinsically "better" than underscored_names, and I also fail to see why first() should be intrinsically superior to front(). And as an aside: please stop claiming that "the Qt API was there before the STL one". Tell the world how the Qt containers looked when the STL was released. Go on. If you want Qtsy containers, go back _there_. The current Qt containers are more STLsy than Qtsy, and they're better for it. Thanks, Marc -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From Lars.Knoll at qt.io Sat Jul 2 09:43:04 2016 From: Lars.Knoll at qt.io (Lars Knoll) Date: Sat, 2 Jul 2016 07:43:04 +0000 Subject: [Development] New configuration system In-Reply-To: <67346AF5-ACB5-465A-8DAC-354C9E51754C@edeltech.ch> References: <4D7485AB-6F17-49F7-B5A6-DAA776FE613A@qt.io> <67346AF5-ACB5-465A-8DAC-354C9E51754C@edeltech.ch> Message-ID: Hi Samuel, On 02/07/16 01:11, "Samuel Gaist" wrote: > Pretty nice ! That will be very useful to simplify Qt customization for constrained hardware. Yes, that’s one of the goals. > Will there also be a GUI available to help create custom configurations ? We’re planning on having that as part of Qt for Device Creation. > A side question, I've got a few submissions adding handling for a bunch of missing > QT_NO_DRAGANDDROP/CLIBOARD tests. Should I ping them to get them in before the > QT_HAS_FEATURE migration or rather wait for it and update the patches then ? I’ll leave that up to you. For a while we’ll anyway need to support both in parallel. Cheers, Lars From thiago.macieira at intel.com Sat Jul 2 09:48:29 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 00:48:29 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607020746.30009.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <201607020746.30009.marc.mutz@kdab.com> Message-ID: <5187188.QzO9zDZ9Yv@tjmaciei-mobl1> On sábado, 2 de julho de 2016 07:46:28 PDT Marc Mutz wrote: > Don't make this about the STL. Your arguments trivally extend to any third- > party code. > > So what you are actually proposing is to not use any third-party code in Qt > unless it is wrapped in a Qtsy API first. Not exactly. The Standard Library API is close enough to Qt's that it could be mistaken for Qt's, but subtly different. No one will mistake the Win32 API, Objective C API or, for that matter, any C library's API for Qt's. The only thing worse than code you don't understand is code that you misunderstand. > This is a bit over the top, isn't it? We want to allow our users to stay in > the cozy Qt bubble for their own projects. As implementers of that bubble, > we have no right to stay in it ourselves if doing so would be to the > detriment of our users. And even creating an API wrapper is to the > detriment of our users, because it requires resources that are then no > longer available to fix real problems. I get your point: we'd spend resources on something other than fixing real things. My counter point is that creating these wrappers increases our productivity. At the very least, it increases mine. > If this is straw poll, I'm voting for Option 5. C++ programmers (those that > wish to implement a C++ library) should be familiar with the STL. In my opinion, Qt's existence negates your reasoning: we are creating a set of libraries that allow users not to know the Standard Library. And I am a product of that generation, as are many of our own developers. Anyway, for the record, I vote for option 3: create simple wrappers. I will volunteer to do them too, if this is the option we choose. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Sat Jul 2 09:41:04 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 00:41:04 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607020842.44832.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <122393150.dApz54YNzL@tjmaciei-mobl1> <201607020842.44832.marc.mutz@kdab.com> Message-ID: <2857546.BvG1HL49Xq@tjmaciei-mobl1> On sábado, 2 de julho de 2016 08:42:42 PDT Marc Mutz wrote: > This sort of sentiment fosters mistakes such as looping over > QVector::erase(it), turning a linear operation quadratic, and people trying > to reimplement binary search, leading to unstable search results that > depend on the size of the container. IOW: bugs. > > Yes. I'm saying: Less STL use == more bugs. Which is why I grudgingly accept std::erase + std::remove_if, despite being ugly-to-read code. > We should instead foster the use of STL algorithms ("No raw loops"), not use > ignorance of the greatest C++ library ever written as a reason not to use > what it has to offer. If there's no difference in performance, I prefer the raw loop. > About APIs: > > The STL has a great API. push_back() / back() vs. append() / last(), e.g. It > just happens to be largely consistent with itself instead of with Qt. But > camelCase is not intrinsically "better" than underscored_names, and I also > fail to see why first() should be intrinsically superior to front(). Intrinsically, neither is superior to the other. But that was not my point. My point is that inside Qt, Qt API is more readable than the Standard Library API because one is consistent with the rest of the code, the other isn't. > And as an aside: please stop claiming that "the Qt API was there before the > STL one". I claimed that Qt had its API published before the C++ standard was out. I know that SGI had published STL before the standard. > Tell the world how the Qt containers looked when the STL was released. Go > on. If you want Qtsy containers, go back _there_. The current Qt containers > are more STLsy than Qtsy, and they're better for it. The API style is pretty much the same and this is my only point here: API and consistency. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From nospam at vuorela.dk Sat Jul 2 09:53:47 2016 From: nospam at vuorela.dk (Sune Vuorela) Date: Sat, 2 Jul 2016 07:53:47 +0000 (UTC) Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: On 2016-07-01, Thiago Macieira wrote: > confusing because the next line has "isEmpty". When I read this code, I had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. Hah. I found some code in a large project the other day. The code is a monstrosity of stl, mfc and qt code. There was an empty() function. It returned void. and was not const. Yes. it was clearing its internal collections and states. /Sune From philwave at gmail.com Sat Jul 2 10:08:31 2016 From: philwave at gmail.com (Philippe) Date: Sat, 02 Jul 2016 10:08:31 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <5187188.QzO9zDZ9Yv@tjmaciei-mobl1> References: <201607020746.30009.marc.mutz@kdab.com> <5187188.QzO9zDZ9Yv@tjmaciei-mobl1> Message-ID: <20160702100830.633A.6F0322A@gmail.com> > The only thing worse than code you don't understand is code that you > misunderstand. Very wise remark ! > STL was standardized 18 years ago, I think it should be enough to get used to empty(). A bad name remains a bad name. The mind has more important energy to spend than "getting used to". Option 3 has my vote. Philippe From kollix at aon.at Sat Jul 2 10:23:57 2016 From: kollix at aon.at (Martin Koller) Date: Sat, 02 Jul 2016 10:23:57 +0200 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <1690774.AWVGoT3XG7@tjmaciei-mobl1> References: <5970992.y8V6gHAJt6@lapi.koller> <1752970.1ZvLjpp7pR@lapi.koller> <1690774.AWVGoT3XG7@tjmaciei-mobl1> Message-ID: <2053372.XPjC1Obgrh@lapi.koller> On Friday 01 July 2016 12:45:07 Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 21:36:21 PDT Martin Koller wrote: > > On Friday 01 July 2016 08:39:07 Thiago Macieira wrote: > > > On sexta-feira, 1 de julho de 2016 13:26:17 PDT Martin Koller wrote: > > > > g++ -Wl,--gc-sections > > > > -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o > > > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o > > > > .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib > > > > -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA > > > > -lQt5GuiWinCC_OA > > > > -lQt5CoreWinCC_OA -lGL -lpthread > > > > > > > > /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined > > > > reference to `qt_version_tag' > > > > > > This error indicates your Qt headers do not match the QtCore library. > > > > > > Did you by any chance also build with a namespace? > > > > yes, this is what I said in my first mail. > > "qt_version_tag" is the name of the tag for unnamespaced Qt. If you do > readelf -s libQt5CoreWinCC_OA.so.5 > > You'll probably see "qt_version_tag_X" where X is your namespace, some with > extra suffixes for previous Qt versions and one with @@. Can you confirm that? yes, I find those. e.g. qt_version_tag_WinCC_OA_5 > Can you check if the build of this application had QT_NAMESPACE defined? Please > paste the command-line that was used to compile main.cpp. It is failing when building qtdeclarative/tools/qml /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/moc -DQT_QML_DEBUG_NO_WARNING -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/mkspecs/linux-g++ -I/home/PACKAGES/qt/qt-repo/qt5/qtdeclarative/tools/qml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtQml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtNetwork -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0 -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0/QtCore -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtWidgets -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtGui -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore -I/usr/include/c++/4.8 -I/usr/include/c++/4.8/x86_64-suse-linux -I/usr/include/c++/4.8/backward -I/usr/lib64/gcc/x86_64-suse-linux/4.8/include -I/usr/local/include -I/usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed -I/usr/x86_64-suse-linux/include -I/usr/include main.cpp -o .moc/main.moc g++ -c -pipe -g -std=c++11 -fno-exceptions -Wall -W -Wvla -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -D_REENTRANT -fPIC -DQT_QML_DEBUG_NO_WARNING -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA -I. -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtQml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtNetwork -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0 -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0/QtCore -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtWidgets -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtGui -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore -I.moc -isystem /usr/include/libdrm -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/mkspecs/linux-g++ -o .obj/main.o main.cpp /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/rcc -name qml qml.qrc -o .rcc/qrc_qml.cpp g++ -c -pipe -g -std=c++11 -fno-exceptions -Wall -W -Wvla -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -D_REENTRANT -fPIC -DQT_QML_DEBUG_NO_WARNING -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA -I. -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtQml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtNetwork -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0 -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0/QtCore -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtWidgets -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtGui -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore -I.moc -isystem /usr/include/libdrm -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/mkspecs/linux-g++ -o .obj/qrc_qml.o .rcc/qrc_qml.cpp /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/moc -DQT_QML_DEBUG_NO_WARNING -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/mkspecs/linux-g++ -I/home/PACKAGES/qt/qt-repo/qt5/qtdeclarative/tools/qml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtQml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtNetwork -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0 -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0/QtCore -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtWidgets -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtGui -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore -I/usr/include/c++/4.8 -I/usr/include/c++/4.8/x86_64-suse-linux -I/usr/include/c++/4.8/backward -I/usr/lib64/gcc/x86_64-suse-linux/4.8/include -I/usr/local/include -I/usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed -I/usr/x86_64-suse-linux/include -I/usr/include conf.h -o .moc/moc_conf.cpp g++ -c -pipe -g -std=c++11 -fno-exceptions -Wall -W -Wvla -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -D_REENTRANT -fPIC -DQT_QML_DEBUG_NO_WARNING -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA -I. -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtQml -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtNetwork -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0 -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore/5.8.0/QtCore -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtWidgets -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtGui -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/include/QtCore -I.moc -isystem /usr/include/libdrm -I/home/PACKAGES/qt/qt-repo/qt5/qtbase/mkspecs/linux-g++ -o .obj/moc_conf.o .moc/moc_conf.cpp g++ -Wl,--gc-sections -Wl,-rpath,/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -o /home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml .obj/main.o .obj/qrc_qml.o .obj/moc_conf.o -L/home/PACKAGES/qt/qt-repo/qt5/qtbase/lib -lQt5QmlWinCC_OA -lQt5NetworkWinCC_OA -lQt5WidgetsWinCC_OA -lQt5GuiWinCC_OA -lQt5CoreWinCC_OA -lGL -lpthread /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined reference to `qt_version_tag' collect2: error: ld returned 1 exit status Makefile:67: recipe for target '/home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml' failed make: *** [/home/PACKAGES/qt/qt-repo/qt5/qtbase/bin/qml] Error 1 It seems QtGui is referring to the symbol: /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined reference to `qt_version_tag' so I checked in the gui Makefile and find something I do not understand: DEFINES = -DQT_NO_USING_NAMESPACE -DQT_ENABLE_HARFBUZZ_NG -DENABLE_PIXMAN_DRAWHELPERS -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_CORE_LIB -DQT_NAMESPACE=WinCC_OA Why does it use -DQT_NO_USING_NAMESPACE _and_ -DQT_NAMESPACE=WinCC_OA ? -- Best regards/Schöne Grüße Martin A: Because it breaks the logical sequence of discussion Q: Why is top posting bad? () ascii ribbon campaign - against html e-mail /\ - against proprietary attachments Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at From denis.shienkov at gmail.com Sat Jul 2 11:26:33 2016 From: denis.shienkov at gmail.com (Denis Shienkov) Date: Sat, 2 Jul 2016 12:26:33 +0300 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <59a7fab6-2248-f832-cda8-f7130f1866b0@gmail.com> Hi all. Then it is necessary to bring up a question of use of C-style of 'arrays', e.g. there has to be something like: qt:containers vs std::containers vs C-arrays Because I see in Qt sources, that often are uses C-arrays, that is "worse" than qt:containers vs std::containers. So, then we need do not use C-arrays at all too.. ))) PS: I prefer to use STL if it is justified, so, seems I vote for p.5. PS2: If you Qt's developer, you should know STL (at least, you should read about :) )! BR, Denis 01.07.2016 21:36, Thiago Macieira пишет: > Premises not under discussion: > > Qt source code is product and meant to be read by our users > Qt source code must be clean and readable > > The above is not up for debate. > > For some time now, we've had a flurry of changes to Qt source code that uses > the Standard Library's containers and algorithms, in the name of performance > and often code size gains. > > I'm not disputing that there is a gain. But I am wondering about the trade-off > we're making with regards to readability. For example, I was just reviewing > this code: > > if (d->currentReadChannel >= d->readHeaders.size() > || d->readHeaders[d->currentReadChannel].empty()) { > Q_ASSERT(d->buffer.isEmpty()); > > The use of the Standard Library member "empty" is highly confusing at first > sight because it does not follow the Qt naming guidelines. It's even more > confusing because the next line has "isEmpty". When I read this code, I had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. > > I had to look up the definition of readHeaders in the review and note that it > was a std::deque, not a Qt container. > > What do we do? > > Option 1: > Not use Standard Library containers, just use the Qt containers as they exist. > > Option 2: > Create new Qt containers to have the same complexity as Standard Library > containers, but following the Qt naming conventions. Possibly with implicit > sharing. > > Option 3: > Create Qt API wrappers for those containers like std::deque, adding only a few > inline functions to match the Qt-style API where the Standard Library API > deviates. Examples are: > empty -> isEmpty > push_back -> append > front -> first > pop_front -> takeFirst > cbegin -> constBegin > cfind -> constFind > From steveire at gmail.com Sat Jul 2 12:26:02 2016 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 02 Jul 2016 12:26:02 +0200 Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: Thiago Macieira wrote: > More to the point, Qt developers don't have to know the Standard Library. > *I* don't and I don't have time or interest in learning it. There is a big division within the C++ community. There is the Qt way and the non-Qt way, and they don't overlap. The approach of many raw loops and no algorithms is taken often in Qt implementation (and documentation). On the other side of the dividing line is people who value boost::irange, boost::indexed_range, boost::max_element and others. As someone who 'crossed over' to the range/algorithm/stl way after starting at Ableton, I can say I prefer it greatly. Here is a patch from me which fixes two bugs in one line of code (which I wrote several years previously): https://quickgit.kde.org/?p=kitemmodels.git&a=commitdiff&h=49609b8b53 Those kinds of bugs don't occur if you use algorithms instead of nested loops. Classes of bugs get eliminated: for (auto j = 0; j <= model->rowCount(); ++i) { // Double oops! } for (auto row : boost::irange(0, model->rowCount()) { } Yes, code could still mistakenly use `i` inside the loop, but that is a different class of bug which would be present in both cases (and the solution is more scoping by extracting named functions). Thanks, Steve. From steveire at gmail.com Sat Jul 2 12:40:53 2016 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 02 Jul 2016 12:40:53 +0200 Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: Stephen Kelly wrote: > Thiago Macieira wrote: > >> More to the point, Qt developers don't have to know the Standard Library. >> *I* don't and I don't have time or interest in learning it. > > There is a big division within the C++ community. There is the Qt way and > the non-Qt way, and they don't overlap. This is the real point of my email. There is division along a Qt and non-Qt boundary on things like this. It is analogous to different sides voting in a referendum: Each side is completely perplexed with the other and can't understand their thinking, thinks the other side is 'stupid' or otherwise low-quality, and doesn't want to waste time understanding it. For people who learn programming and learn C++ by learning Qt (myself included), the Qt implementation seems familiar with all the raw loops if you have never encountered the alternative. However, everyone else is excluded by it. When my colleagues find long functions, lots of nested if()s and for()s, ++foo somewhere in while loops, they find it much harder to reason about the code. Now I do too. So, by sticking to lots of raw loops, you're actually actively excluding other parts of the C++ community from participating. I don't have numbers to qualify it, but there seems to me to be a much larger community following modern C++ practices than following Qt practices on questions like this. I encourage you and everyone else to dive into it. Thanks, Steve. From iamsergio at gmail.com Sat Jul 2 14:11:32 2016 From: iamsergio at gmail.com (Sergio Martins) Date: Sat, 02 Jul 2016 13:11:32 +0100 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <5476906.2mKDsrTdxL@desktop> On Friday, 1 July 2016 11:36:56 WEST Thiago Macieira wrote: > Premises not under discussion: > > Qt source code is product and meant to be read by our users > Qt source code must be clean and readable > The above is not up for debate. > > For some time now, we've had a flurry of changes to Qt source code that uses > the Standard Library's containers and algorithms, in the name of > performance and often code size gains. and in some cases better readability too. For example, whenever you use cbegin, cfind, push_back you're writing code that's not only understandable by Qt developers but also C++ developers. Lowering the bar for C++ developers to start contributing is important. I agree that STL also has many examples of worse readability, like very verbose algorithms. We should tackle this on a case by case basis. > > I'm not disputing that there is a gain. But I am wondering about the > trade-off we're making with regards to readability. For example, I was just > reviewing this code: > > if (d->currentReadChannel >= d->readHeaders.size() > > || d->readHeaders[d->currentReadChannel].empty()) { > > Q_ASSERT(d->buffer.isEmpty()); > "empty" is evil, I've fixed many places where the developer meant "clear()": https://quickgit.kde.org/? p=kdelibs4support.git&a=commit&h=c27b851e62307dd16780bf94aff8e6c650ac8dc7 I think we should even remove QList::empty() in Qt6, we want STL compat with the good things, not the bad things. > What do we do? What do we do to fix what ? First state the problem. You made a case against "empty" and then extrapolated to STL, as if you had a 3rd premise "STL is always less readable". > empty -> isEmpty Agreed, it's error prone. > push_back -> append > front -> first > pop_front -> takeFirst > cbegin -> constBegin > cfind -> constFind Disagreed, the later form is the common denominator between C++ and Qt developers. Regards, Sérgio Martins From markg85 at gmail.com Sat Jul 2 15:44:50 2016 From: markg85 at gmail.com (Mark Gaiser) Date: Sat, 2 Jul 2016 15:44:50 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: On Fri, Jul 1, 2016 at 8:36 PM, Thiago Macieira wrote: > Premises not under discussion: > > Qt source code is product and meant to be read by our users > Qt source code must be clean and readable > > The above is not up for debate. > > For some time now, we've had a flurry of changes to Qt source code that > uses > the Standard Library's containers and algorithms, in the name of > performance > and often code size gains. > > I'm not disputing that there is a gain. But I am wondering about the > trade-off > we're making with regards to readability. For example, I was just reviewing > this code: > > if (d->currentReadChannel >= d->readHeaders.size() > || d->readHeaders[d->currentReadChannel].empty()) { > Q_ASSERT(d->buffer.isEmpty()); > > The use of the Standard Library member "empty" is highly confusing at first > sight because it does not follow the Qt naming guidelines. It's even more > confusing because the next line has "isEmpty". When I read this code, I > had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. > > I had to look up the definition of readHeaders in the review and note that > it > was a std::deque, not a Qt container. > > What do we do? > > Option 1: > Not use Standard Library containers, just use the Qt containers as they > exist. > > Option 2: > Create new Qt containers to have the same complexity as Standard Library > containers, but following the Qt naming conventions. Possibly with implicit > sharing. > > Option 3: > Create Qt API wrappers for those containers like std::deque, adding only a > few > inline functions to match the Qt-style API where the Standard Library API > deviates. Examples are: > empty -> isEmpty > push_back -> append > front -> first > pop_front -> takeFirst > cbegin -> constBegin > cfind -> constFind > > I don't get why you would be confused by - for instance - the empty method. STL has that method, but so does Qt [1] apparently in an attempt to be compatible with the STL API. Even if you don't want to learn or know how the STL API looks like, it should not matter since the very same members also apply on Qt containers with the same . This is the case for all your examples in Option 3. Imho it would be nice - when using Qt and STL containers in the same statement - to use common functions that mean the same in both API's. Thus in your example both should have been empty() calls, even on the Qt container to be consistent. But that's just my opinion :) [1] http://doc.qt.io/qt-5/qlist.html#empty -------------- next part -------------- An HTML attachment was scrubbed... URL: From b.terrier at gmail.com Sat Jul 2 15:45:58 2016 From: b.terrier at gmail.com (Benjamin TERRIER) Date: Sat, 2 Jul 2016 15:45:58 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: > However, everyone else is excluded by it. When my colleagues find long > functions, lots of nested if()s and for()s, ++foo somewhere in while loops, > they find it much harder to reason about the code. Now I do too. > > So, by sticking to lots of raw loops, you're actually actively excluding > other parts of the C++ community from participating. I don't have numbers to > qualify it, but there seems to me to be a much larger community following > modern C++ practices than following Qt practices on questions like this. You can't say that using raw loops (vs stl algorithms) is "actively excluding" any C++ developer. I would agree to say that simplifying code by using STL makes the code more readable for developers used to the STL. And that raw loops and nested controls can be less readable. But how come a raw loop can be excluding? It should be understandable by any C++ developer and, I would dare to say, by any C-style programming language developer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier at woboq.com Sat Jul 2 16:04:01 2016 From: olivier at woboq.com (Olivier Goffart) Date: Sat, 02 Jul 2016 16:04:01 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <3399679.28OPHdOIhQ@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5776CEF6.9020603@kdab.com> <3399679.28OPHdOIhQ@tjmaciei-mobl1> Message-ID: <3340000.yQtmuOTAP1@maurice> On Freitag, 1. Juli 2016 14:56:36 CEST Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 22:13:42 PDT Giuseppe D'Angelo wrote: > > Even today: where is QList::push_back(T&&)? Where are our emplacement > > functions and their try versions? Where are our exception guarantees?) > > We don't care about exceptions, so we won't be adding those. Ok. > As for the move-versions, since we can't take move-only types in our > containers due to the implicit sharing, does it really make a difference if > we have them or not? Well, you point out another weakness of our contaners (not supporting move- only types). But even then, the push_back(T&&) overload or emplace functions would still usefull to avoid an uneeded copy in some cases. (possibly saving memory alocations) [...] > > Which again seems like a sensible thing to do in general, unless there > > are documented cases in which Qt containers significantly outperform STL > > ones (apart from implicit sharing). > > I would prefer the opposite: use non-Qt only if that is better than the Qt > equivalent. If you can't prove it or if it's too small, it's not worth the > difference in readability that it creates. I think you have an unjustified bias against the STL. With the exception of "empty", you are overestimating the readability problem it pauses. You also write in another email on this thread: > You will always see me write a for-loop to fill something rather than use > std::fill. And I think you are making a mistake. Consider: a) std::fill(vec.begin(), vec.end(), computeBackgroundColor()); b) for(int i = 0; i < vec.size(); i++) vec[i] = computeBackgroundColor(); c) auto backgroundColor = computeBackgroundColor(); for (auto it = vec.begin(); it != vec.end(); ++it) *it = backgroundColor; Personally I find that a. is more readable, as it is objectively more concise and cearly express the intent. b. has some overhead. Conciseness is important as it reduce the likelyhood of mistake. Also more code means more time to read it. It is true that a lot is a matter of taste, but I totaly buy the reasoning behind the "no raw loop". -- Olivier Woboq - Qt services and support - https://woboq.com - https://code.woboq.org From steveire at gmail.com Sat Jul 2 16:30:18 2016 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 02 Jul 2016 16:30:18 +0200 Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: Benjamin TERRIER wrote: >> However, everyone else is excluded by it. When my colleagues find long >> functions, lots of nested if()s and for()s, ++foo somewhere in while > loops, >> they find it much harder to reason about the code. Now I do too. >> >> So, by sticking to lots of raw loops, you're actually actively excluding >> other parts of the C++ community from participating. I don't have numbers > to >> qualify it, but there seems to me to be a much larger community following >> modern C++ practices than following Qt practices on questions like this. > > You can't say that using raw loops (vs stl algorithms) is "actively > excluding" any C++ developer. Yes, maybe 'actively' was not correct. > But how come a raw loop can be excluding? It should be understandable by > any C++ developer and, I would dare to say, by any C-style programming > language developer. I don't think anyone can understand or reason about raw-loop-heavy code (see PS below). I use 'excluded' to refer to people who are not willing to do so. They exclude themselves from working on Qt code because they can not reason about it. In the same sense, Thiago is 'excluded' from reading and understanding code which uses 'container.empty()' or which doesn't use raw-loops, because he would choose to not work on such code. There is a divide. The 'exclusion' is self-decided. Does that make sense? If you have a better phrase than 'self-exclusion' for that then it could be useful to share it. Thanks, Steve. PS: Take QQuickListViewPrivate::applyInsertionChange as it is currently written as an example: http://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/items/qquicklistview.cpp?id=5d23470b#n3068 There's a `++index` somewhere in the middle 3 scopes deep. Further up in the function `index` is assigned, but then assigned again (conditionally) from the `count` of a container. Then `index` is used later in the function, but I can't reason about what it is when it is used. There are many other problems with that function, which are caused by many 'raw' loops nested up to four levels, affecting variables assigned outside top-level if() conditions half a page up. Extracting such code into named functions would indicate the intent of the function. Someone unwilling to attempt to reason about the code in that function is 'excluded' from fixing something in it or extending whatever features it has. From b.terrier at gmail.com Sat Jul 2 17:34:06 2016 From: b.terrier at gmail.com (Benjamin TERRIER) Date: Sat, 2 Jul 2016 17:34:06 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> Message-ID: 2016-07-02 16:30 GMT+02:00 Stephen Kelly : > Benjamin TERRIER wrote: > >> But how come a raw loop can be excluding? It should be understandable by >> any C++ developer and, I would dare to say, by any C-style programming >> language developer. > > I don't think anyone can understand or reason about raw-loop-heavy code (see > PS below). I use 'excluded' to refer to people who are not willing to do so. > They exclude themselves from working on Qt code because they can not reason > about it. > > In the same sense, Thiago is 'excluded' from reading and understanding code > which uses 'container.empty()' or which doesn't use raw-loops, because he > would choose to not work on such code. > > There is a divide. The 'exclusion' is self-decided. > > Does that make sense? If you have a better phrase than 'self-exclusion' for > that then it could be useful to share it. Ok for me if you meant it this way. > Someone unwilling to attempt to reason about the code in that function is > 'excluded' from fixing something in it or extending whatever features it > has. I'd boldly reply to that that if one is unwilling to reason about a piece of code, one should not be fixing it. But I'd also agree that the code should be as readable as possible to get a many developers to contribute. Back to Qt current situation I think that the lack of comments in some parts is a bigger throwback than the code style. And back to the actual topic of Qt/STL containers, I am for option 3 if the project can afford the extra development and maintenance otherwise I'd go with option 4. Br, Benjamin Terrier From thiago.macieira at intel.com Sat Jul 2 19:06:08 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 10:06:08 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <5476906.2mKDsrTdxL@desktop> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5476906.2mKDsrTdxL@desktop> Message-ID: <1704608.bauXxcjfj5@tjmaciei-mobl1> On sábado, 2 de julho de 2016 13:11:32 PDT Sergio Martins wrote: > On Friday, 1 July 2016 11:36:56 WEST Thiago Macieira wrote: > > Premises not under discussion: > > Qt source code is product and meant to be read by our users > > Qt source code must be clean and readable > > > > The above is not up for debate. > > > > For some time now, we've had a flurry of changes to Qt source code that > > uses the Standard Library's containers and algorithms, in the name of > > performance and often code size gains. > > and in some cases better readability too. For example, whenever you use > cbegin, cfind, push_back you're writing code that's not only understandable > by Qt developers but also C++ developers. > > Lowering the bar for C++ developers to start contributing is important. > I agree that STL also has many examples of worse readability, like very > verbose algorithms. We should tackle this on a case by case basis. See also my reply to Stephen on the same topic. I agree with the logic, but I have to question the effort vs benefit. This is the same question as with our CLA: how many developers are we turning away because of the issue? How many would make meaningful contributions if only the situation were different? You can extend this to other minor issues, like coding style (use of spaces instead of tabs) or even buildsystems ("I won't touch qmake"). I honestly do not see a horde of developers stopped at the gates of the API. I really don't think that's the case, as most of the developers willing to make contributions have usually used Qt and are somewhat familiar with our API. That is, the contributors usually are users of Qt that move upstream. There are a few exceptions of developers moving downstream. For example, Wayland developers that come take a look at our code. How do we cater for both low-level C coders and for algorithms-using C++ coders? > > I'm not disputing that there is a gain. But I am wondering about the > > trade-off we're making with regards to readability. For example, I was > > just > > > > reviewing this code: > > if (d->currentReadChannel >= d->readHeaders.size() > > > > || d->readHeaders[d->currentReadChannel].empty()) { > > > > Q_ASSERT(d->buffer.isEmpty()); > > "empty" is evil, I've fixed many places where the developer meant "clear()": Yeah, except that here it *wasn't* clear(). It was "size() == 0" (isEmpty). But I had to check. > > What do we do? > > What do we do to fix what ? First state the problem. > You made a case against "empty" and then extrapolated to STL, as if you had > a 3rd premise "STL is always less readable". The situation (not everyone will agree there is a problem) is what I said at the beginning of my email and left quoted here: there's a flurry of new code using the Standard Library containers and algorithms. Do we do something about it? Note that option 1 is status quo. > > empty -> isEmpty > > Agreed, it's error prone. > > > push_back -> append > > front -> first > > pop_front -> takeFirst > > cbegin -> constBegin > > cfind -> constFind > > Disagreed, the later form is the common denominator between C++ and Qt > developers. You mean the former, not latter. Indeed, but my whole argument is that developers writing Qt code and, more importantly, those *reading* Qt code, are more familiar with the latter cases. If the problem is only "empty", we can get around the problem by requiring "size() == 0" instead. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Sat Jul 2 18:51:50 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 09:51:50 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <4490054.sMN0YLkbx6@tjmaciei-mobl1> On sábado, 2 de julho de 2016 12:40:53 PDT Stephen Kelly wrote: > So, by sticking to lots of raw loops, you're actually actively excluding > other parts of the C++ community from participating. I don't have numbers > to qualify it, but there seems to me to be a much larger community > following modern C++ practices than following Qt practices on questions > like this. The converse is also true: by using auxiliary functions to do things where a simple loop would do, you're excluding a sizeable community that has never encountered those functions. Especially if those auxiliary types and functions have different and sometimes bewildering names, different from Qt's. Like you, I don't have numbers. But I can tell you one thing for sure: that community that follows non-Qt practices is not here. It would be nice to attract them, but not at the expense of losing the people we already have and are familiar with Qt internals. > I encourage you and everyone else to dive into it. No, thanks. You will also see me iterating over QChar and char instead of using those algorithms or even some of Qt's. See QUrlPrivate::parse, my recent changes to QTzTimeZonePrivate, for examples. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Sat Jul 2 18:43:51 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 09:43:51 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <2053372.XPjC1Obgrh@lapi.koller> References: <5970992.y8V6gHAJt6@lapi.koller> <1690774.AWVGoT3XG7@tjmaciei-mobl1> <2053372.XPjC1Obgrh@lapi.koller> Message-ID: <2156213.PCUHDssgLi@tjmaciei-mobl1> On sábado, 2 de julho de 2016 10:23:57 PDT Martin Koller wrote: > It seems QtGui is referring to the symbol: > /home/PACKAGES/qt/qt-repo/qt5/qtbase/lib/libQt5GuiWinCC_OA.so: undefined > reference to `qt_version_tag' Oh, right. So the problem is not in the tool being built but in QtGui itself. First question is: how did QtGui link in the first place? It should have the flag to fail to link with undefined symbols, so either that flag is missing or the symbol was found. > so I checked in the gui Makefile and find something I do not understand: > > DEFINES = -DQT_NO_USING_NAMESPACE -DQT_ENABLE_HARFBUZZ_NG > -DENABLE_PIXMAN_DRAWHELPERS -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT > -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT > -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS > -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS > -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_CORE_LIB > -DQT_NAMESPACE=WinCC_OA > > Why does it use -DQT_NO_USING_NAMESPACE _and_ -DQT_NAMESPACE=WinCC_OA ? They mean different things. QT_NO_USING_NAMESPACE causes qglobal.h NOT to do "using namespace QT_NAMESPACE;". Still, QT_NAMESPACE was set. Can you find which .o in QtGui made a reference to qt_version_tag? -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Sat Jul 2 19:10:11 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sat, 02 Jul 2016 10:10:11 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <1594825.rovEIMYOfq@tjmaciei-mobl1> On sábado, 2 de julho de 2016 15:44:50 PDT Mark Gaiser wrote: > I don't get why you would be confused by - for instance - the empty > method. > STL has that method, but so does Qt [1] apparently in an attempt to be > compatible with the STL API. That doesn't mean we will allow the use of those methods in our own libraries. I *will* reject any code that uses empty() to mean isEmpty() on a Qt container. The whole point of this thread is that using certain methods is misleading or, at best, confusing. > Even if you don't want to learn or know how the STL API looks like, it > should not matter since the very same members also apply on Qt containers > with the same . > This is the case for all your examples in Option 3. > > Imho it would be nice - when using Qt and STL containers in the same > statement - to use common functions that mean the same in both API's. Thus > in your example both should have been empty() calls, even on the Qt > container to be consistent. But that's just my opinion :) I agree with your premise and the benefits in your conclusion. I just don't agree with using the Standard Library names, in detriment to Qt's own API. The whole point of Option 3 is to provide the Qt-like names so that we have *only* Qt-like names in Qt's source code. We'd achieve the same as you proposed (consistency) and we'd be consistent with the rest of the existing code as well as our recommended API. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From steveire at gmail.com Sun Jul 3 11:26:42 2016 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 03 Jul 2016 11:26:42 +0200 Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: Thiago Macieira wrote: > What do we do? { int container[1]; Q_ASSERT(!qIsEmpty(container)); } { std::vector container; Q_ASSERT(qIsEmpty(container)); } { std::deque container; Q_ASSERT(qIsEmpty(container)); } { std::list container; Q_ASSERT(qIsEmpty(container)); } { std::forward_list container; Q_ASSERT(qIsEmpty(container)); } { QVector container; Q_ASSERT(qIsEmpty(container)); } { QList container; Q_ASSERT(qIsEmpty(container)); } { QLinkedList container; Q_ASSERT(qIsEmpty(container)); } { QString container; Q_ASSERT(qIsEmpty(container)); } From steveire at gmail.com Sun Jul 3 12:04:14 2016 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 03 Jul 2016 12:04:14 +0200 Subject: [Development] Use of Standard Library containers in Qt source code References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <4490054.sMN0YLkbx6@tjmaciei-mobl1> Message-ID: Thiago Macieira wrote: > On sábado, 2 de julho de 2016 12:40:53 PDT Stephen Kelly wrote: >> So, by sticking to lots of raw loops, you're actually actively excluding >> other parts of the C++ community from participating. I don't have numbers >> to qualify it, but there seems to me to be a much larger community >> following modern C++ practices than following Qt practices on questions >> like this. > > The converse is also true I agree, and I encourage you to raise std::empty as a problem http://en.cppreference.com/w/cpp/iterator/empty so that it can be renamed to is_empty. C++ developers should get 'is' in the name if that is the correct thing to do (ignore the camelCase/snake_case difference - that is orthogonal to the 'is' issue). Giving that feedback that such a method must have 'is' in the name would be a valuable contribution from Qt experiences to the C++ community and work towards bridging the divide that I claimed exists (in both directions). > : by using auxiliary functions to do things where > a simple loop would do, you're excluding a sizeable community that has > never encountered those functions. Especially if those auxiliary types and > functions have different and sometimes bewildering names, different from > Qt's. You can make Qt names for things. The important thing is that there is a name. Why don't we write std::begin(container) == std::end(container) everywhere? Because we named that concept 'emptiness'. Consider this caricature of the kind of code that exists throughout Qt: int index = someFunctionParameter; int foo = containerOfIndexes.size(); if (something) { while (anotherThing) { if (foo % 2 == 0) { ++foo; ++index; } } } else { ++foo; } while (foo) { if (bar && bang) { if (bang) { for (int i = 0, e = containerOfIndexes.size(); i != e; ++i) { if (index < containerOfIndexes[i]) { index = containerOfIndexes[i]; } } } if (index < 0) break; } } return index; It is not possible to reason about code like that. I have the feeling that faced with code like that, people just don't attempt to reason about it while at the same time trying to get on with what they are trying to do. Here's a recent example of a contributor responding exactly that way to such code: https://codereview.qt-project.org/#/c/161133 The way to deal with functions like that is to extract loops and other concepts into functions with names. Delegating things like that has the effect of making the function shorter. Adding comments instead would not have a positive effect on the size of the function and good names are less likely to bitrot than comments. In the above example you would start by extracting a qMaxValue function. You could implement that function in terms of std::max_element, or you could write a loop in the function if that's more comfortable. Even in the latter case, it is not a 'raw loop'. You have named a concept and using it will make other code more readable. > Like you, I don't have numbers. But I can tell you one thing for sure: > that community that follows non-Qt practices is not here. I don't think that's true. People who do follow modern practices or boost do sometimes appear on this mailing list (and more than that read it - hello lurkers!). They don't tend to become long-term contributors though. > It would be nice > to attract them, but not at the expense of losing the people we already > have and are familiar with Qt internals. I think starting small to introduce the concepts and with Qt names like qMaxValue would work. Yes, learning and change would need to happen, but that can happen at whatever pace you choose. I'm not going to recommend replacing all loops with some Qt version of range adaptors starting tomorrow. There are many small steps which have benefits for readability. >> I encourage you and everyone else to dive into it. > > No, thanks. I expect that, but I continue to encourage it (to everyone) anyway :). Thanks, Steve. From staniek at kde.org Sun Jul 3 12:33:50 2016 From: staniek at kde.org (Jaroslaw Staniek) Date: Sun, 3 Jul 2016 12:33:50 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: On 1 July 2016 at 20:36, Thiago Macieira wrote: > Premises not under discussion: > > Qt source code is product and meant to be read by our users > Qt source code must be clean and readable > > The above is not up for debate. > > For some time now, we've had a flurry of changes to Qt source code that > uses > the Standard Library's containers and algorithms, in the name of > performance > and often code size gains. > ​[..] Thanks for raising this topic, Thiago. The topic resonates for me in the following way (as just a reader of the code): 1. No doubt the algorithms and such improve our programming experience and the simplifies activity that costs us most: reading/understanding the code and intents. I'd applaud having the Option 3 and see Option 2 as nice to have for future Qt. Moreover I would happily consider using the wrappers (once stabilized enough, they would be inline anyway?) in my projects out of the Qt source tree. Sometimes I do consider adding that myself and like many others probably already have a tiny bit of buried in my "utility" codes. That would be no longer so much a necessity. 2. A mature C++ engineer shall not forget that the market average is way below that level. I think it's not our intent to build a barrier for contributors this way. I've seen a few projects that use no single algorithm constructs, yet these are successful and mature projects. It's unscientific but I recognize average level for a C/C++ programmer is way below of level represented on this mailing list or boost/STL lists. People have chosen Qt for simplicity _and_ consistency (no particular order). Before knowing one or more typical profile of Qt contributors (like personal in UX design?) it's too easy to assume everyone is so clever or on its way to awesomeness. 3. I think it would be a good signal to the user base if Option 3 (or/and then Option 2) would be communicated publicly that the Qt-ifed container extensions will come to the public API. Not tomorrow but one day, like it was the case with the QtJSEngine feature that started as a private component. A next small-big thing from the Qt team. 4. I perceive *consistency in naming* as a higher value for a project than potentially encouraging or winking at some "other" sub-communities to get more people on board. A building block of a project is its internal coding guideline. Qt is known from promoting consistency. I remember the guidelines were used as a template in my professional work while creating similar guidelines for others. After all it's even a bit poisonous to compare release dates of projects. E.g. Fortran or Visual Basic 1.0 predates HP's STL. Despite different markets addressed, all of them are potentially interesting to build contributor base; would it be sane to propose allowing for VB naming schemes inside Qt? Or Fortran's? Even if I am repeating someone else's observation, let's not forget: even if a fraction of Qt's source code would contain bits familiar for programmers thinking the "STL" way and having "STL" muscle memory, the rest, the majority of the code follows the Qt guidelines. It's easy to imagine single expressions or a simple code block that uses two naming guidelines, usage of verbs/nouns, camel case, underscores. Some of that is an aesthetic layer, some of that is more like provoking human errors. I bet it can be independently measured how much effort it costs to switch between naming while reading a single C++ block with mixed naming.[*] And such code could not be too easily rejected in a code review. Engineers are good at switching context once a while, but I am not sure they are good at switching it every few seconds. Pros can cope with that, 75% of their efficiency is still very good, but that's just it. I am afraid we would move to discussions about where the borders are, how to change our (currently) very good guideline document to address the change. We would enter area where this (specific, dedicated) project has not even two two approaches but a mix that's hard to clean up, and with no way to undo. [*] Extreme example of the mix is having HTML/JS/CSS/CSSS/PHP/Perl blocks in one file. ​ > > I'm not disputing that there is a gain. But I am wondering about the > trade-off > we're making with regards to readability. For example, I was just reviewing > this code: > > if (d->currentReadChannel >= d->readHeaders.size() > || d->readHeaders[d->currentReadChannel].empty()) { > Q_ASSERT(d->buffer.isEmpty()); > > The use of the Standard Library member "empty" is highly confusing at first > sight because it does not follow the Qt naming guidelines. It's even more > confusing because the next line has "isEmpty". When I read this code, I > had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. > > I had to look up the definition of readHeaders in the review and note that > it > was a std::deque, not a Qt container. > > What do we do? > > Option 1: > Not use Standard Library containers, just use the Qt containers as they > exist. > > Option 2: > Create new Qt containers to have the same complexity as Standard Library > containers, but following the Qt naming conventions. Possibly with implicit > sharing. > > Option 3: > Create Qt API wrappers for those containers like std::deque, adding only a > few > inline functions to match the Qt-style API where the Standard Library API > deviates. Examples are: > empty -> isEmpty > push_back -> append > front -> first > pop_front -> takeFirst > cbegin -> constBegin > cfind -> constFind > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development > -- regards, Jaroslaw Staniek KDE: : A world-wide network of software engineers, artists, writers, translators : and facilitators committed to Free Software development - http://kde.org Calligra Suite: : A graphic art and office suite - http://calligra.org Kexi: : A visual database apps builder - http://calligra.org/kexi Qt Certified Specialist: : http://www.linkedin.com/in/jstaniek -------------- next part -------------- An HTML attachment was scrubbed... URL: From julien.blanc at nmc-company.com Mon Jul 4 08:14:21 2016 From: julien.blanc at nmc-company.com (Julien Blanc) Date: Mon, 04 Jul 2016 08:14:21 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <1594825.rovEIMYOfq@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <1594825.rovEIMYOfq@tjmaciei-mobl1> Message-ID: <1467612861.2991.26.camel@nmc-company.com> Le samedi 02 juillet 2016 à 10:10 -0700, Thiago Macieira a écrit : > On sábado, 2 de julho de 2016 15:44:50 PDT Mark Gaiser wrote: > > I don't get why you would be confused by - for instance - the empty > > method. > > STL has that method, but so does Qt [1] apparently in an attempt to be > > compatible with the STL API. > > That doesn't mean we will allow the use of those methods in our own libraries. > I *will* reject any code that uses empty() to mean isEmpty() on a Qt > container. > > The whole point of this thread is that using certain methods is misleading or, > at best, confusing. While I agree with you that isEmpty is a far better name than empty, I don’t think renaming is the best idea. As for the argument of using size() == 0 (which I prefer over renaming), note that : - std::forward_list does not have a size() member - std::list size() may have linear complexity before C++11 About the example you gave, I see two things that could be improved, with a much broader scope than just empty -> isEmpty (which is a particular case) : - the use of side-effects functions (aka : non const) in conditionals : IMHO they’re bad for readability, especially if the condition is a bit complex. If it is banned (or, banned unless commented), then there is no ambiguity. - visual distinction between const / non-const functions / variables usages in QtCreator/whatever ide you’re using. This one would be a must : the fact that empty is const makes it really clear what it does, but you currently have to either know it or read the doc. Following Stephen Kelly’s mails, I’m convinced that instead of wrapping stl containers, implementing a free function qIsEmpty is less work and addresses all your readability concerns. Regards, Julien From thiago.macieira at intel.com Mon Jul 4 08:41:07 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Sun, 03 Jul 2016 23:41:07 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <1467612861.2991.26.camel@nmc-company.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <1594825.rovEIMYOfq@tjmaciei-mobl1> <1467612861.2991.26.camel@nmc-company.com> Message-ID: <1932645.mCeXXNuYup@tjmaciei-mobl1> On segunda-feira, 4 de julho de 2016 08:14:21 PDT Julien Blanc wrote: > Following Stephen Kelly’s mails, I’m convinced that instead of wrapping > stl containers, implementing a free function qIsEmpty is less work and > addresses all your readability concerns. But it is uglier and does not help with .append() for .push_back(). -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From andre at familiesomers.nl Mon Jul 4 09:47:12 2016 From: andre at familiesomers.nl (=?UTF-8?Q?Andr=c3=a9_Somers?=) Date: Mon, 4 Jul 2016 09:47:12 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <1932645.mCeXXNuYup@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <1594825.rovEIMYOfq@tjmaciei-mobl1> <1467612861.2991.26.camel@nmc-company.com> <1932645.mCeXXNuYup@tjmaciei-mobl1> Message-ID: <78e8bdea-8174-977e-e900-807e8d1f9a38@familiesomers.nl> Op 04/07/2016 om 08:41 schreef Thiago Macieira: > On segunda-feira, 4 de julho de 2016 08:14:21 PDT Julien Blanc wrote: >> Following Stephen Kelly’s mails, I’m convinced that instead of wrapping >> stl containers, implementing a free function qIsEmpty is less work and >> addresses all your readability concerns. > But it is uglier Actually, I disagree with that. As someone who has come to appreciate STL after growing up in the Qt world, I think that memberfunctions are over-used. Emptyness is a concept that can be applied to many objects, and it would be nice if I don't need a different function for all of them. The problem with implementing things in a member function is that the implementation will be specific for that class only, even if it did not really have to be. You end up re-creating algorithms for no good reason. And yes, that mistake has been made in the standard libraries as well. Note that there is work going on by Bjarne S. on a universal calling conventions. As in: making calling a free function on an object and calling a member function on that object to be interchangeble in syntax. > and does not help with .append() for .push_back(). > Why not? You could do the same thing there if you prefer. append(Container c, T item) can be made to work for both STL and Qt containers I think? André From christian.kandeler at qt.io Mon Jul 4 09:59:44 2016 From: christian.kandeler at qt.io (Christian Kandeler) Date: Mon, 4 Jul 2016 09:59:44 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <6461895.FPZQEgjcFK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <183a8a2c-240e-9afc-5834-f8c68f441eaa@qt.io> On 07/01/2016 08:36 PM, Thiago Macieira wrote: > For some time now, we've had a flurry of changes to Qt source code that uses > the Standard Library's containers and algorithms, in the name of performance > and often code size gains. > > I'm not disputing that there is a gain. But I am wondering about the trade-off > we're making with regards to readability. For example, I was just reviewing > this code: > > if (d->currentReadChannel >= d->readHeaders.size() > || d->readHeaders[d->currentReadChannel].empty()) { > Q_ASSERT(d->buffer.isEmpty()); > > The use of the Standard Library member "empty" is highly confusing at first > sight because it does not follow the Qt naming guidelines. It's even more > confusing because the next line has "isEmpty". When I read this code, I had to > wonder if that "empty" was a verb in the imperative, meaning the author was > trying to remove all elements from the container. I must admit I don't see a problem here. We are not talking about some random third-party library that people are pulling in gratuitously, but about the Standard Library, an integral part of C++ that every developer should be at least generally familiar with. Having said that, I personally follow the "use Qt types by default" approach, but should we really regard STL containers as dangerous intruders that need to be kept out if at all possible? Christian From philwave at gmail.com Mon Jul 4 10:03:11 2016 From: philwave at gmail.com (Philippe) Date: Mon, 04 Jul 2016 10:03:11 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <78e8bdea-8174-977e-e900-807e8d1f9a38@familiesomers.nl> References: <1932645.mCeXXNuYup@tjmaciei-mobl1> <78e8bdea-8174-977e-e900-807e8d1f9a38@familiesomers.nl> Message-ID: <20160704100310.6DC3.6F0322A@gmail.com> >>Actually, I disagree with that. As someone who has come to appreciate >>STL after growing up in the Qt world, Exact opposite here: I learned STL from its early days, and could never become at ease with its namings... and I started to breath with Qt containers :) Philippe From andre at familiesomers.nl Mon Jul 4 10:14:58 2016 From: andre at familiesomers.nl (=?UTF-8?Q?Andr=c3=a9_Somers?=) Date: Mon, 4 Jul 2016 10:14:58 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <20160704100310.6DC3.6F0322A@gmail.com> References: <1932645.mCeXXNuYup@tjmaciei-mobl1> <78e8bdea-8174-977e-e900-807e8d1f9a38@familiesomers.nl> <20160704100310.6DC3.6F0322A@gmail.com> Message-ID: Op 04/07/2016 om 10:03 schreef Philippe: >>> Actually, I disagree with that. As someone who has come to appreciate >>> STL after growing up in the Qt world, > Exact opposite here: I learned STL from its early days, and could never > become at ease with its namings... and I started to breath with Qt > containers :) > I'm not saying the namings are good, and I still find snake_case ugly. I dislike the use of abreviations, and yet, isEmpty() is way clearer than empty(). But the principles are very sound, especially the use of named algorithms over raw loops. Note that Qt has basicaly abandoned it's own algorithm collection for the stl one. That's mostly a Good Thing IMHO, though having your own collection of algorithms building on top of stl good practice I think. STL is by no means complete; you're encouraged to extend it. Defining a well-named free function to bridge the gap where it improves things is one way of enhancing both: you enhance STL by making it more readable to use, and you enhance Qt by embracing well-tested algorithms and containers. André From marc.mutz at kdab.com Mon Jul 4 10:53:05 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Mon, 4 Jul 2016 10:53:05 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <20160704100310.6DC3.6F0322A@gmail.com> References: <1932645.mCeXXNuYup@tjmaciei-mobl1> <78e8bdea-8174-977e-e900-807e8d1f9a38@familiesomers.nl> <20160704100310.6DC3.6F0322A@gmail.com> Message-ID: <201607041053.07385.marc.mutz@kdab.com> On Monday 04 July 2016 10:03:11 Philippe wrote: > >>Actually, I disagree with that. As someone who has come to appreciate > >>STL after growing up in the Qt world, > > Exact opposite here: I learned STL from its early days, and could never > become at ease with its namings... and I started to breath with Qt > containers :) The value of the STL is not in the containers, it's in the algorithms. We who use std containers in Qt would be on very thin ice if the Qt containers would stand an ice-balls chance in hell against the STL containers. But if using a std::deque in place of a QList speeds up code by 40%, then Qt has failed and either needs to fix its containers (impossible w/o abandoning CoW) or accept STL container use. Thanks, Marc -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From edward.welbourne at qt.io Mon Jul 4 14:07:19 2016 From: edward.welbourne at qt.io (Edward Welbourne) Date: Mon, 4 Jul 2016 12:07:19 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1>, Message-ID: Stephen Kelly gave QQuickListViewPrivate::applyInsertionChange as an example of "raw" for-loops being tricky to follow: >>>> There's a `++index` somewhere in the middle 3 scopes deep. Further >>>> up in the function `index` is assigned, but then assigned again >>>> (conditionally) from the `count` of a container. Then `index` is >>>> used later in the function, but I can't reason about what it is >>>> when it is used. >>>> >>>> There are many other problems with that function, which are caused >>>> by many 'raw' loops nested up to four levels, affecting variables >>>> assigned outside top-level if() conditions half a page >>>> up. Extracting such code into named functions would indicate the >>>> intent of the function. I've fixed issues in qmake [0] where for-loops caused similar problems. I *was* able to reason about them, but I made mistakes. Fortunately, we have some good disciplines like auto-testing and code-review, that helped me notice them. [0] e.g. https://codereview.qt-project.org/#/c/161133 Benjamin TERRIER opined: >>> I'd boldly reply to that that if one is unwilling to reason about a >>> piece of code, one should not be fixing it. and yet, when I am tracking an elusive bug to its lair, I have to make sense of all the pieces of code that I stumble upon in the course of my hunt. I may not be competent to fix it, but I have to be able to make sense of it to determine *whether* it's the cause of my bug; and, even if it isn't, I have to make enough sense of it to determine *how* its eccentricities interact with the rest of the tangle of moving parts that might be implicated in my bug. I don't mind having to go to someone else to get it fixed half as much as I do the problem of having to make sense of whether it's to blame, when I'm not getting any response to my e-mail to the author for help determining what part it plays in the bug I'm chasing. Each bug I hunt obliges me to make sense of way more pieces of code than the roughly one that I actually end up having to fix. >>> But I'd also agree that the code should be as readable as possible >>> to get a many developers to contribute. +1. Also: to waste as little of my time as possible. >>> Back to Qt current situation I think that the lack of comments in >>> some parts is a bigger throwback than the code style. +1. Sometimes code is solving a complex problem; then, it likely can't help but *be* complex. A gentle dusting of comments (and, in extreme cases, a big fat overview-and-theory comment somewhere easy to find in the right file) can go a long way towards helping the visiting bug-hunter to make sense of the thicket they're stumbling through. Stephen Kelly gave an example of some code I would complain about in review, for quite other reasons than those he intended, and then said: >> It is not possible to reason about code like that. I attest, for the record, that I can reason about code like that. Then again, I came to C++ via a long history of C and some pre-history I'd rather not talk about. I know it can get tricky, and I'm glad you didn't stoop to goto in your example. >> I have the feeling that faced with code like that, people just don't >> attempt to reason about it while at the same time trying to get on >> with what they are trying to do. There's always some code that's harder than others to make sense of. Everything should be made as simple as possible - but no simpler. When solving a complex problem, the solution is apt to be likewise complex; as long as its complexity is truly implied by the problem being solved, this has to be OK. >> Here's a recent example of a contributor responding exactly that way >> to such code: >> https://codereview.qt-project.org/#/c/161133 I fail to see a contributor responding the way you describe: you fixed the problem - thank you - and you clearly reasoned about the code to do so. It ain't pretty, but you found something that worked. >> The way to deal with functions like that is to extract loops and >> other concepts into functions with names. Breaking up long functions into conceptually compact parts is indeed a recommended practice - and has been for decades. This is uncontentious. (Standard practice, in contrast, is some place else entirely - which is why I do not regard software as an engineering discipline, yet.) >> Delegating things like that has the effect of making the function >> shorter. Adding comments instead would not have a positive effect on >> the size of the function and good names are less likely to bitrot >> than comments. Sometimes a function mutates enough to make its name misguided - but even so, that is more apt to be picked up in code review than comments going stale. >> In the above example you would start by extracting a qMaxValue >> function. ... or just by calling some suitable .max() method on the container, if it was sensibly defined. This is a case of a standard pattern that any API designer should take into account and that client code shouldn't implement "by hand", as in your example. The nice thing about the standard algorithms is that they free container classes from the need to implement endlessly many methods, such as max; an algorithm can use standard iteration to implement a generic max. Someone who needs max-and-min can do likewise, returning a pair. Someone who needs to also know the key (or index) at which max (or min) happened can have a generic solution using pairs in place of the simple values. There's a long long tail of less-often-wanted generics that traditional OO would have needed to be methods of every container class, with a painful (and likely jagged) cut-off as different containers vary how far down that tail they reach. Generic algorithms get rid of those methods and save the API designer from needing to decide how far down that tail to ride. The tricky stuff comes when you need to do something eccentric, like finding the max but treating -1 or 0 specially (for whatever reason), or doing something else entirely if the object whose attribute we're maximising meets some condition on its other members. For good reasons, those typically don't fit nicely into the standard patterns; and trying to shoe-horn them into those patterns tends to implicate traversing the data-structure more times than you will if you use raw loops (smartly). >> You could implement that function in terms of std::max_element, or >> you could write a loop in the function if that's more >> comfortable. Even in the latter case, it is not a 'raw loop'. You >> have named a concept and using it will make other code more readable. Where that is possible, yes - by all means - do that. Indeed, one good argument for using the standard patterns is so that raw for loops go away wherever the code is "essentially straight-forward". Then any surviving for loop becomes a clear alert to the presence of something out of the ordinary - such as essential complexity that we can't get away from. Coders still need to learn how to reason about such loops. Be glad you don't have to cope with the spaghetti that flows from liberal use of goto. >> I'm not going to recommend replacing all loops with some Qt version >> of range adaptors starting tomorrow. >> >> There are many small steps which have benefits for readability. There are many ways we can improve our code-base. Where changing to use implementations of standard patterns is one of them, by all means do it. Jaroslaw Staniek contributed: > 1. No doubt the algorithms and such improve our programming experience > and the simplifies activity that costs us most: reading/understanding > the code and intents. I agree with your focus: *where* standard implementations of common patterns *do* help readers make sense of code, they (like anything else that serves this goal) are welcome. > 4. I perceive *consistency in naming* as a higher value [...] A > building block of a project is its internal coding guideline. It's also worth noting that differences between projects can actually be helpful: when I'm looking at code in one project (e.g. Qt) that calls code from another (e.g. OpenSSL), the difference in naming style helps by alerting me to which bits of the code are "alien" and can't be relied on to follow the *other* guidelines (behaviour, not just naming) of our project. This is an argument against adding STL-style aliases for methods of our containers *unless* the container really does behave the way STL containers do - i.e. when someone used to the STL forms expectations based on STL-normality, due to seeing STL-style method names on a container, that container had better actually behave fully like an STL container, or they'll get surprised. > Engineers are good at switching context once a while, but I am not > sure they are good at switching it every few seconds. Context-switches are expensive. If I am obliged to make many of them (as is not uncommon when keeping up with the endless stream of code reviews) I get tired fast. Fortunately I can take a nap if I have to. To the extent that Qt Does Things Differently than STL, it is actually a feature that the two camps name things differently - that cues the reader in to which idioms to expect will work, based on which naming scheme is in use. To the extent Qt Works The Same Way As STL, it's good to mirror STL naming in the Qt API. Eddy. From edward.welbourne at qt.io Mon Jul 4 17:21:42 2016 From: edward.welbourne at qt.io (Edward Welbourne) Date: Mon, 4 Jul 2016 15:21:42 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1>, , Message-ID: Thanks to Olivier for pointing out a mistake: > I've fixed issues in qmake [0] where for-loops caused similar problems. > [0] e.g. https://codereview.qt-project.org/#/c/161133 That should have been: [0] https://codereview.qt-project.org#/c/141305/14//ALL,unified Eddy. From annulen at yandex.ru Mon Jul 4 17:47:15 2016 From: annulen at yandex.ru (Konstantin Tokarev) Date: Mon, 04 Jul 2016 18:47:15 +0300 Subject: [Development] Why QFontDatabase::hasFamily() is marked as internal? Message-ID: <1431467647235@web4o.yandex.ru> Hello, Are there any reasons not to make QFontDatabase::hasFamily() a part of public API? -- Regards, Konstantin From gzjjgod at gmail.com Mon Jul 4 17:59:13 2016 From: gzjjgod at gmail.com (Jiang Jiang) Date: Mon, 4 Jul 2016 23:59:13 +0800 Subject: [Development] Why QFontDatabase::hasFamily() is marked as internal? In-Reply-To: <1431467647235@web4o.yandex.ru> References: <1431467647235@web4o.yandex.ru> Message-ID: On Mon, Jul 4, 2016 at 11:47 PM, Konstantin Tokarev wrote: > Hello, > > Are there any reasons not to make QFontDatabase::hasFamily() a part of public API? Looks like it was originally added for QtWebKit and stayed internal as is since then. https://github.com/qt/qtbase/commit/b2553443739f78756ffe0cabc1b02fc62bda09c6 It probably wouldn’t hurt to make it public if it’s useful externally and someone(tm) is willing to submit a patch adding proper docs. - Jiang From mwoehlke.floss at gmail.com Mon Jul 4 19:26:13 2016 From: mwoehlke.floss at gmail.com (Matthew Woehlke) Date: Mon, 04 Jul 2016 13:26:13 -0400 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <3399679.28OPHdOIhQ@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <5776CEF6.9020603@kdab.com> <3399679.28OPHdOIhQ@tjmaciei-mobl1> Message-ID: On 2016-07-01 17:56, Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 22:13:42 PDT Giuseppe D'Angelo wrote: >> Even today: where is QList::push_back(T&&)? Where are our emplacement >> functions and their try versions? Where are our exception guarantees?) > > We don't care about exceptions, so we won't be adding those. > > As for the move-versions, since we can't take move-only types in our > containers due to the implicit sharing, does it really make a difference if we > have them or not? Yes... and ironically, for the same reason implicit sharing is useful; because the copy ctor might be horrendously expensive. Emplacement and move-insert are (also) useful purely from a performance perspective. > I would prefer the opposite: use non-Qt only if that is better than the Qt > equivalent. If you can't prove it or if it's too small, it's not worth the > difference in readability that it creates. Option N+1: Convince the committee to adopt Qt's naming conventions and convenience API's in STL2¹ ;-). (¹ Or whatever it's being called...) -- Matthew From mwoehlke.floss at gmail.com Mon Jul 4 19:54:45 2016 From: mwoehlke.floss at gmail.com (Matthew Woehlke) Date: Mon, 04 Jul 2016 13:54:45 -0400 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607020842.44832.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <5159741467402744@web6j.yandex.ru> <122393150.dApz54YNzL@tjmaciei-mobl1> <201607020842.44832.marc.mutz@kdab.com> Message-ID: On 2016-07-02 02:42, Marc Mutz wrote: > The STL has a great API. push_back() / back() vs. append() / last(), e.g. It > just happens to be largely consistent with itself instead of with Qt. But > camelCase is not intrinsically "better" than underscored_names, and I also > fail to see why first() should be intrinsically superior to front(). TBH, this is the fault of the English language :-). The words that Qt uses for its API are more intuitive to English speakers, if less consistent. The words STL uses are more logical¹ and consistent, but less intuitive. I've never actually stopped to think about STL being logical¹; every time I use it, it drives me nuts because the API is not "natural". (¹ In the sense of "strictly conforming to formal logic".) Consider... if I ask you what relation the letter 'A' has to the alphabet, is it the letter *at the front*, or is it the *first* letter? I bet you, and most (native, certainly) English speakers said it's the *first* letter. STL's word choices are... a bit like writing code in King James' English. I do however feel that Qt's consistent use of verbs for actions and non-verbs for properties (i.e. empty vs. isEmpty/is_empty) is far superior. -- Matthew From thiago.macieira at intel.com Mon Jul 4 22:01:55 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Mon, 04 Jul 2016 13:01:55 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <183a8a2c-240e-9afc-5834-f8c68f441eaa@qt.io> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <183a8a2c-240e-9afc-5834-f8c68f441eaa@qt.io> Message-ID: <3314025.8Kf2oNKqXH@tjmaciei-mobl1> On segunda-feira, 4 de julho de 2016 09:59:44 PDT Christian Kandeler wrote: > > The use of the Standard Library member "empty" is highly confusing at > > first > > sight because it does not follow the Qt naming guidelines. It's even more > > confusing because the next line has "isEmpty". When I read this code, I > > had to wonder if that "empty" was a verb in the imperative, meaning the > > author was trying to remove all elements from the container. > > I must admit I don't see a problem here. We are not talking about some > random third-party library that people are pulling in gratuitously, but > about the Standard Library, an integral part of C++ that every developer > should be at least generally familiar with. Of course, I was able to reason what it was after looking up the definition of the variable in question. It didn't cost me more than 60 seconds to do this, between the wondering "wtf is he doing", forming a hypothesis, proving it, then navigating back and then restoring my frame of mind. The problem is that I do more than one review a day. I would be surprised if there are more than 5 people who do more reviews than I do. And I spend less than 10% of my week on Qt, so it's important for me and for those whose changes I review that I be efficient. In this particular case, the fact of using a QVector of std::deques completely threw me off and I didn't understand the author's intention at all. I had to stop the review, which led to this email. > Having said that, I personally follow the "use Qt types by default" > approach, but should we really regard STL containers as dangerous > intruders that need to be kept out if at all possible? No, I agree we should allow them when there's a clear benefit. Qt has no equivalent for std::deque and I do think our time is best spent in other things than reimplementing one. That is the status quo and Option 4 in my list. But I am thinking of Option 3: use the Standard Library containers (cake) and still have our API (eat it too). -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Mon Jul 4 22:03:56 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Mon, 04 Jul 2016 13:03:56 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <3399679.28OPHdOIhQ@tjmaciei-mobl1> Message-ID: <9113587.zvgDvqfJTn@tjmaciei-mobl1> On segunda-feira, 4 de julho de 2016 13:26:13 PDT Matthew Woehlke wrote: > Option N+1: Convince the committee to adopt Qt's naming conventions and > convenience API's in STL2¹ ;-). > > (¹ Or whatever it's being called...) We can try, but that is orthogonal to the discussion. Such a standard does not exist and will not be usable until at least 2025. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Mon Jul 4 22:08:23 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Mon, 04 Jul 2016 13:08:23 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <201607020842.44832.marc.mutz@kdab.com> Message-ID: <1706543.7KqyZ9rnDB@tjmaciei-mobl1> On segunda-feira, 4 de julho de 2016 13:54:45 PDT Matthew Woehlke wrote: > Consider... if I ask you what relation the letter 'A' has to the > alphabet, is it the letter *at the front*, or is it the *first* letter? > I bet you, and most (native, certainly) English speakers said it's the > *first* letter. STL's word choices are... a bit like writing code in > King James' English. Hence "push" and "pop" for a stack, "front" and "back" for queues, but not the 2x2 combination of those on a random-access container... > I do however feel that Qt's consistent use of verbs for actions and > non-verbs for properties (i.e. empty vs. isEmpty/is_empty) is far superior. Not just verbs for actions, that's verbs in the imperative. We also use verbs, but in the past participle, for signals ("changed", "happened", "written", except where the English language falls short, like "read / read / read" - that's why "readyRead" instead of "bytesRead"). -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From kollix at aon.at Tue Jul 5 08:40:27 2016 From: kollix at aon.at (Martin Koller) Date: Tue, 05 Jul 2016 08:40:27 +0200 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <2156213.PCUHDssgLi@tjmaciei-mobl1> References: <5970992.y8V6gHAJt6@lapi.koller> <2053372.XPjC1Obgrh@lapi.koller> <2156213.PCUHDssgLi@tjmaciei-mobl1> Message-ID: <5826252.l3ClDsV50f@lapi.koller> On Saturday 02 July 2016 09:43:51 Thiago Macieira wrote: > Can you find which .o in QtGui made a reference to > qt_version_tag? Not sure I do it the correct way.. I grepped in objdump -x and find the symbol in all .o files, e.g.: ... 0000000000000000 l .group 0000000000000000 qt_version_tag 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 l d .group 0000000000000000 .group 0000000000000000 *UND* 0000000000000000 _GLOBAL_OFFSET_TABLE_ 0000000000000000 *UND* 0000000000000000 qt_version_tag_WinCC_OA in .obj/moc_qaccessible.o -- Best regards/Schöne Grüße Martin A: Because it breaks the logical sequence of discussion Q: Why is top posting bad? () ascii ribbon campaign - against html e-mail /\ - against proprietary attachments Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at From thiago.macieira at intel.com Tue Jul 5 09:24:22 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Tue, 05 Jul 2016 00:24:22 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <5826252.l3ClDsV50f@lapi.koller> References: <5970992.y8V6gHAJt6@lapi.koller> <2156213.PCUHDssgLi@tjmaciei-mobl1> <5826252.l3ClDsV50f@lapi.koller> Message-ID: <24170234.u22TmC7dJm@tjmaciei-mobl1> On terça-feira, 5 de julho de 2016 08:40:27 PDT Martin Koller wrote: > On Saturday 02 July 2016 09:43:51 Thiago Macieira wrote: > > Can you find which .o in QtGui made a reference to > > qt_version_tag? > > Not sure I do it the correct way.. I grepped in objdump -x and find the > 0000000000000000 *UND* 0000000000000000 qt_version_tag_WinCC_OA That's qt_version-tag_WinCC_OA. Please find the .o that refers to qt_version_tag, without suffix. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From kollix at aon.at Tue Jul 5 19:57:44 2016 From: kollix at aon.at (Martin Koller) Date: Tue, 05 Jul 2016 19:57:44 +0200 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <24170234.u22TmC7dJm@tjmaciei-mobl1> References: <5970992.y8V6gHAJt6@lapi.koller> <5826252.l3ClDsV50f@lapi.koller> <24170234.u22TmC7dJm@tjmaciei-mobl1> Message-ID: <2813808.n314I7OqCj@lapi.koller> On Tuesday 05 July 2016 00:24:22 Thiago Macieira wrote: > On terça-feira, 5 de julho de 2016 08:40:27 PDT Martin Koller wrote: > > On Saturday 02 July 2016 09:43:51 Thiago Macieira wrote: > > > Can you find which .o in QtGui made a reference to > > > qt_version_tag? > > > > Not sure I do it the correct way.. I grepped in objdump -x and find the > > > 0000000000000000 *UND* 0000000000000000 qt_version_tag_WinCC_OA > > That's qt_version-tag_WinCC_OA. Please find the .o that refers to > qt_version_tag, without suffix. I thought maybe the .group thingy 0000000000000000 l .group 0000000000000000 qt_version_tag is something interesting ... I did now a grep in all dirs (not only src/gui) and found: The files below ./3rdparty/harfbuzz-ng have 0000000000000000 *UND* 0000000000000000 qt_version_tag 0000000000000000 R_X86_64_GOT64 qt_version_tag -- Best regards/Schöne Grüße Martin A: Because it breaks the logical sequence of discussion Q: Why is top posting bad? () ascii ribbon campaign - against html e-mail /\ - against proprietary attachments Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at From thiago.macieira at intel.com Tue Jul 5 22:04:10 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Tue, 05 Jul 2016 13:04:10 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <2813808.n314I7OqCj@lapi.koller> References: <5970992.y8V6gHAJt6@lapi.koller> <24170234.u22TmC7dJm@tjmaciei-mobl1> <2813808.n314I7OqCj@lapi.koller> Message-ID: <4517176.GaT8XqCht6@tjmaciei-mobl1> On terça-feira, 5 de julho de 2016 19:57:44 PDT Martin Koller wrote: > I did now a grep in all dirs (not only src/gui) and found: > The files below ./3rdparty/harfbuzz-ng have > 0000000000000000 *UND* 0000000000000000 qt_version_tag > 0000000000000000 R_X86_64_GOT64 qt_version_tag Thanks, that is actually important. Does the Makefile for harfbuzz have -DQT_NAMESPACE=WinCC_OA? -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Tue Jul 5 22:12:40 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Tue, 05 Jul 2016 13:12:40 -0700 Subject: [Development] dev branch compile fails module-qtdatavis3d In-Reply-To: <4517176.GaT8XqCht6@tjmaciei-mobl1> References: <5970992.y8V6gHAJt6@lapi.koller> <2813808.n314I7OqCj@lapi.koller> <4517176.GaT8XqCht6@tjmaciei-mobl1> Message-ID: <10094212.LE6bgoFnJb@tjmaciei-mobl1> On terça-feira, 5 de julho de 2016 13:04:10 PDT Thiago Macieira wrote: > On terça-feira, 5 de julho de 2016 19:57:44 PDT Martin Koller wrote: > > I did now a grep in all dirs (not only src/gui) and found: > > The files below ./3rdparty/harfbuzz-ng have > > 0000000000000000 *UND* 0000000000000000 qt_version_tag > > 0000000000000000 R_X86_64_GOT64 qt_version_tag > > Thanks, that is actually important. > > Does the Makefile for harfbuzz have -DQT_NAMESPACE=WinCC_OA? Try this fix: https://codereview.qt-project.org/164425 -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From marc.mutz at kdab.com Wed Jul 6 11:08:22 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Wed, 6 Jul 2016 11:08:22 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <4490054.sMN0YLkbx6@tjmaciei-mobl1> Message-ID: <201607061108.23855.marc.mutz@kdab.com> On Sunday 03 July 2016 12:04:14 Stephen Kelly wrote: > It is not possible to reason about code like that. I have the feeling that > faced with code like that, people just don't attempt to reason about it > while at the same time trying to get on with what they are trying to do. The underlying theme here, I think, is: idiomatic code. Qt has its set of idioms (like ending QObject subclass ctors in QObject *parent=nullptr), but it largely ignores C++ idioms. And that leads to complicated code and throws off contributors that are used to idiomatic C++. Take this example: https://codereview.qt-project.org/159693 The copy-swap idiom is two decades old (at least as old as Effective C++ ed. 1), but the only uses in Qt are those that I introduced myself. Following the idiom trivialises the implementation of both copy and move assignment operators. Not following it leads to bugs such as the one linked above. Using algorithms is idiomatic. too: erase-remove is an idiom, also nearing two decades old. It reduces bugs, and helps grok the code for those that know the idioms, but, like in any other language, if you don't know the idioms, you don't really understand the language. C++ is the language Qt is written in. You need to learn the language's idioms. -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From announce at qt-project.org Wed Jul 6 11:18:13 2016 From: announce at qt-project.org (List for announcements regarding Qt releases and development) Date: Wed, 6 Jul 2016 09:18:13 +0000 Subject: [Development] [Announce] Qt Creator 4.1.0 Beta1 released Message-ID: We are happy to announce the release of Qt Creator 4.1.0 Beta1! https://blog.qt.io/blog/2016/07/06/qt-creator-4-1-0-beta-released/ Br, -- Eike Ziller Principal Software Engineer The Qt Company GmbH Rudower Chaussee 13 D-12489 Berlin eike.ziller at qt.io +123 45 6789012 http://qt.io Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B _______________________________________________ Announce mailing list Announce at qt-project.org http://lists.qt-project.org/mailman/listinfo/announce From thiago.macieira at intel.com Wed Jul 6 17:52:18 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Wed, 06 Jul 2016 08:52:18 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607061108.23855.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <201607061108.23855.marc.mutz@kdab.com> Message-ID: <1838403.mAHyQTJ32t@tjmaciei-mobl1> On quarta-feira, 6 de julho de 2016 11:08:22 PDT Marc Mutz wrote: > The underlying theme here, I think, is: idiomatic code. Qt has its set of > idioms (like ending QObject subclass ctors in QObject *parent=nullptr), but > it largely ignores C++ idioms. And that leads to complicated code and > throws off contributors that are used to idiomatic C++. [cut] > C++ is the language Qt is written in. You need to learn the language's > idioms. I dispute calling them "C++ idioms". Can you prove that all other major C++ libraries except Qt use them? For example, Google code, Folly, etc. Do they all use those idioms? Are their developers familiar with it? -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From thiago.macieira at intel.com Thu Jul 7 03:00:08 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Wed, 06 Jul 2016 18:00:08 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <2133524.ekmAkN6kfG@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> Message-ID: <1775643.FonJhWLViK@tjmaciei-mobl1> On sexta-feira, 1 de julho de 2016 12:34:15 PDT Thiago Macieira wrote: > On sexta-feira, 1 de julho de 2016 11:36:56 PDT Thiago Macieira wrote: > > Option 1: > > Not use Standard Library containers, just use the Qt containers as they > > exist. > > > > Option 2: > > Create new Qt containers to have the same complexity as Standard Library > > containers, but following the Qt naming conventions. Possibly with > > implicit > > sharing. > > > > Option 3: > > Create Qt API wrappers for those containers like std::deque, adding only a > > few inline functions to match the Qt-style API where the Standard Library > > > > API deviates. Examples are: > > empty -> isEmpty > > push_back -> append > > front -> first > > pop_front -> takeFirst > > cbegin -> constBegin > > cfind -> constFind > > Of course, Option 4: > Continue to allow Standard Library containers in internal code (no API or > ABI constraining) where there's a clear gain in performance and/or size. > > Option 5: > Allow Standard Library containers in internal code even if performance or > code size gains are not appreciable or have not been measured. Concluding this thread: The opinions are pretty much evenly split among the respondents, so for now we'll remain at status quo (Option 4). In case we're not getting the deserved attention due to Summer vacations, I'll post again in a month or so to see if there's any change. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From marc.mutz at kdab.com Thu Jul 7 09:10:50 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Thu, 7 Jul 2016 09:10:50 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <1775643.FonJhWLViK@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> Message-ID: <201607070910.51615.marc.mutz@kdab.com> On Thursday 07 July 2016 03:00:08 Thiago Macieira wrote: > In case we're not getting the deserved attention due to Summer vacations, > I'll post again in a month or so to see if there's any change. We have The Chief on record saying that we should use whatever is most efficient internally (https://codereview.qt-project.org/114327 comment from 2015-06-15), and you agreeing (ibid, 1st @ 2015-06-16). So from my pov, the only question is whether we stay with Option 4 or relax to Option 5, and I'm fine with either. Thanks, Marc -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From andre at familiesomers.nl Thu Jul 7 09:20:10 2016 From: andre at familiesomers.nl (=?UTF-8?Q?Andr=c3=a9_Somers?=) Date: Thu, 7 Jul 2016 09:20:10 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607070910.51615.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com> Message-ID: Op 07/07/2016 om 09:10 schreef Marc Mutz: > On Thursday 07 July 2016 03:00:08 Thiago Macieira wrote: >> In case we're not getting the deserved attention due to Summer vacations, >> I'll post again in a month or so to see if there's any change. > We have The Chief on record saying that we should use whatever is most efficient > internally (https://codereview.qt-project.org/114327 comment from > 2015-06-15), and you agreeing (ibid, 1st @ 2015-06-16). > > So from my pov, the only question is whether we stay with Option 4 or relax to > Option 5, and I'm fine with either. > I don't think that rules out option 3 either, does it? André From Martin.Smith at qt.io Thu Jul 7 09:25:18 2016 From: Martin.Smith at qt.io (Martin Smith) Date: Thu, 7 Jul 2016 07:25:18 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com>, Message-ID: How about a merger of options 3 & 4 for Qt 6.0? A QtSTL that combines the ease of use of the Qt collections with the efficiency of STL algorithms. martin ________________________________ From: Development on behalf of André Somers Sent: Thursday, July 7, 2016 9:20:10 AM To: development at qt-project.org Subject: Re: [Development] Use of Standard Library containers in Qt source code Op 07/07/2016 om 09:10 schreef Marc Mutz: > On Thursday 07 July 2016 03:00:08 Thiago Macieira wrote: >> In case we're not getting the deserved attention due to Summer vacations, >> I'll post again in a month or so to see if there's any change. > We have The Chief on record saying that we should use whatever is most efficient > internally (https://codereview.qt-project.org/114327 comment from > 2015-06-15), and you agreeing (ibid, 1st @ 2015-06-16). > > So from my pov, the only question is whether we stay with Option 4 or relax to > Option 5, and I'm fine with either. > I don't think that rules out option 3 either, does it? André _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangelog at gmail.com Thu Jul 7 10:39:21 2016 From: dangelog at gmail.com (Giuseppe D'Angelo) Date: Thu, 7 Jul 2016 10:39:21 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com> Message-ID: On Thu, Jul 7, 2016 at 9:25 AM, Martin Smith wrote: > > How about a merger of options 3 & 4 for Qt 6.0? A QtSTL that combines the > ease of use of the Qt collections with the efficiency of STL algorithms. If anything, why would it need to wait for Qt 6? -- Giuseppe D'Angelo From marc.mutz at kdab.com Thu Jul 7 11:36:57 2016 From: marc.mutz at kdab.com (Marc Mutz) Date: Thu, 7 Jul 2016 11:36:57 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <201607071136.59540.marc.mutz@kdab.com> On Thursday 07 July 2016 09:25:18 Martin Smith wrote: > How about a merger of options 3 & 4 for Qt 6.0? A QtSTL that combines the > ease of use of the Qt collections with the efficiency of STL algorithms. Yes, for Qt 6, a template that takes an STL API and provides the Qt methods on it is something I'd welcome. But not to be required in internal implementation, as is implied in this thread. Game devs on CppCon report that compilers have problems fully inlining STL container use where it should be fully inlined (I myself ran into such a case: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60621) We use STL containers because they are more friendly to the compiler[1], which equates to faster and/or smaller, adding more stuff on top will make them slower, unless we fiddle with compiler-specific settings such as inlining depths, if that helps at all (it didn't for the bug report linked above). Thanks, Marc [1] I don't think everyone here knows that every asm volatile as part of a QAtomic operation makes the compiler forget everything it knows about memory / value propagation, ie. it writes back registers to memory before and needs to re-load values from memory after the asm volatile. It gets better if QAtomic is backed by std::atomic, but even on x86, those ops aren't cheap. A cmpxchg takes more than 200 cycles to complete, if the memory is off-socket, compared to ≤ 0.5 cycles for a reg-reg operation. That's only the case if the object is actually shared among processors, but it shows just how bad it can be. On-die, it's still something like 20 cycles. -- Marc Mutz | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - Qt, C++ and OpenGL Experts From denis.shienkov at gmail.com Thu Jul 7 11:50:51 2016 From: denis.shienkov at gmail.com (Denis Shienkov) Date: Thu, 7 Jul 2016 12:50:51 +0300 Subject: [Development] Configurable Maintenance Tool Message-ID: Hi All, Is it possible to make the Maintenance Tool utility is more configurable? Or, maybe, is it planned in future? e.g. I want to able to add/remove some modules by own choosing: - QtMultimedia - QtConnectivity - QtSerialPort and so on.. But, currently the Maintenance Tool does not provide this feature, and I remove all desired "unused" modules "by hand"... BR, Denis -------------- next part -------------- An HTML attachment was scrubbed... URL: From Marco.Bubke at qt.io Thu Jul 7 12:06:05 2016 From: Marco.Bubke at qt.io (Marco Bubke) Date: Thu, 7 Jul 2016 10:06:05 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com>, , Message-ID: I think it simply a question of time to get used to the STL. You get used to many things. I think we should mind about the new features of C++ which are coming, which cannot integrated very well with Qt because we use a different idiom. I really think we should make it easier for the developer but if we provide no way to go the fast path do we really make it easier? If the context is changing over time, is it not smart to reevaluate decision again and maybe go a different route? I don't mean to do it all the time but maybe there is a middle path between different "fundamentalisms". [😉] ________________________________ From: Development on behalf of Martin Smith Sent: Thursday, July 7, 2016 9:25:18 AM To: André Somers; development at qt-project.org Subject: Re: [Development] Use of Standard Library containers in Qt source code How about a merger of options 3 & 4 for Qt 6.0? A QtSTL that combines the ease of use of the Qt collections with the efficiency of STL algorithms. martin ________________________________ From: Development on behalf of André Somers Sent: Thursday, July 7, 2016 9:20:10 AM To: development at qt-project.org Subject: Re: [Development] Use of Standard Library containers in Qt source code Op 07/07/2016 om 09:10 schreef Marc Mutz: > On Thursday 07 July 2016 03:00:08 Thiago Macieira wrote: >> In case we're not getting the deserved attention due to Summer vacations, >> I'll post again in a month or so to see if there's any change. > We have The Chief on record saying that we should use whatever is most efficient > internally (https://codereview.qt-project.org/114327 comment from > 2015-06-15), and you agreeing (ibid, 1st @ 2015-06-16). > > So from my pov, the only question is whether we stay with Option 4 or relax to > Option 5, and I'm fine with either. > I don't think that rules out option 3 either, does it? André _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: OutlookEmoji-😉.png Type: image/png Size: 390 bytes Desc: OutlookEmoji-😉.png URL: From konstantin at podsvirov.pro Thu Jul 7 12:14:45 2016 From: konstantin at podsvirov.pro (Konstantin Podsvirov) Date: Thu, 07 Jul 2016 13:14:45 +0300 Subject: [Development] Configurable Maintenance Tool In-Reply-To: References: Message-ID: <2756971467886485@web9g.yandex.ru> An HTML attachment was scrubbed... URL: From thiago.macieira at intel.com Thu Jul 7 09:20:07 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Thu, 07 Jul 2016 00:20:07 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <201607070910.51615.marc.mutz@kdab.com> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com> Message-ID: <9830555.ImG14tleL6@tjmaciei-mobl1> On quinta-feira, 7 de julho de 2016 09:10:50 PDT Marc Mutz wrote: > On Thursday 07 July 2016 03:00:08 Thiago Macieira wrote: > > In case we're not getting the deserved attention due to Summer vacations, > > I'll post again in a month or so to see if there's any change. > > We have The Chief on record saying that we should use whatever is most > efficient internally (https://codereview.qt-project.org/114327 comment > from 2015-06-15), and you agreeing (ibid, 1st @ 2015-06-16). He hasn't chimed in on this discussion, which makes me wonder if he's out for vacations. > So from my pov, the only question is whether we stay with Option 4 or relax > to Option 5, and I'm fine with either. For me, it's whether we stay with 4 or write the classes from Option 3. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From ci.monitoring at qt.io Fri Jul 8 11:58:19 2016 From: ci.monitoring at qt.io (Ci Monitoring) Date: Fri, 8 Jul 2016 09:58:19 +0000 Subject: [Development] monitoring of CI servers Message-ID: Hi, For your information, Qt Continuous Integration (CI) servers are monitored 24/7. However, if you notice any problems in Qt CI systems, please send email to this address: ci.monitoring at qt.io. Out of Eastern European Time Zone office hours there might be slight delay. Thank you for understanding. Br, Qt team -------------- next part -------------- An HTML attachment was scrubbed... URL: From swarit.wipra at gmail.com Sat Jul 9 20:01:19 2016 From: swarit.wipra at gmail.com (swarit wipra) Date: Sat, 9 Jul 2016 23:31:19 +0530 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s Message-ID: Hi folks, i have issues in showing huge data in QTableView ,data read from sqlite database which is being updated dynamically .. 2k rows in 2s. i am using QSQLRelationModel let me describe the scenario in detail. My Qt application has a view i.e QTableView , each row has following structure: **************************************** *QPushButton*|QLabel | QLabel | QLabel * **************************************** i have created it using QItemDelegate each row isinserted dynamicaly , after sometime gui gets freezed. could anyone tell me the way to fix the issue. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From milian.wolff at kdab.com Sun Jul 10 13:25:48 2016 From: milian.wolff at kdab.com (Milian Wolff) Date: Sun, 10 Jul 2016 13:25:48 +0200 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: Message-ID: <2419699.p3rdbzShFY@agathebauer> On Samstag, 9. Juli 2016 23:31:19 CEST swarit wipra wrote: > Hi folks, > > i have issues in showing huge data in QTableView ,data read from sqlite > database which is being updated dynamically .. 2k rows in 2s. > i am using QSQLRelationModel > let me describe the scenario in detail. > > My Qt application has a view i.e QTableView , each row has following > structure: > > **************************************** > *QPushButton*|QLabel | QLabel | QLabel * > **************************************** > i have created it using QItemDelegate > > each row isinserted dynamicaly , after sometime gui gets freezed. > > could anyone tell me the way to fix the issue. Profile the code, find the hotspot, fix it. From the above, it becomes clear already that you should not be using QLabel for plain text delegates but rather the default delegate. Bye -- Milian Wolff | milian.wolff at kdab.com | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5903 bytes Desc: not available URL: From olszak.tomasz at gmail.com Mon Jul 11 11:38:06 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 10:38:06 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. Message-ID: Hello, QImage:: transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) docs: "Returns a copy of the image that is transformed using the given transformation matrix and transformation mode." But if matrix.type() == QTransform::TxNone then shallow instead of deep copy is returned. I'm happy to submit a fix but I don't know what is expected behaviour? Should implementation follow docs or docs or docs follow implementation here? T. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Simon.Hausmann at qt.io Mon Jul 11 11:59:34 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Mon, 11 Jul 2016 09:59:34 +0000 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: Hi, Could you elaborate on what you see as the discrepancy between docs and implementation? The docs don't say whether it's a shallow or a deep copy, so it looks to me that the implementation is within the bounds of the docs. Plus it seems sensible to return a shallow copy, doesn't it? Simon ________________________________ From: Development on behalf of Tomasz Olszak Sent: Monday, July 11, 2016 11:38:06 AM To: development at qt-project.org Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. Hello, QImage:: transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) docs: "Returns a copy of the image that is transformed using the given transformation matrix and transformation mode." But if matrix.type() == QTransform::TxNone then shallow instead of deep copy is returned. I'm happy to submit a fix but I don't know what is expected behaviour? Should implementation follow docs or docs or docs follow implementation here? T. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olszak.tomasz at gmail.com Mon Jul 11 12:53:51 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 11:53:51 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: QImage::copy returns deep copy and has similar documentation so I assumed that when docs say copy it means deep copy. Let's consider common case: 1. QImage img created from raw data pointer got from e.g. driver. 2. img used in thread to perform some transforms 3. Save result as deep copy Ensuring step 3 is most efficient and does not perform unnecessary copying I need to write something like: QTransform t; if (m.type() == QTransform::TxNone) return img.copy(); else return img.transformed(m); AFAIU img.transformed(m).copy() will copy twice when m.type() != QTransform::TxNone right? Don't you think that is seems strange and is not documented enough? 2016-07-11 10:59 GMT+01:00 Simon Hausmann : > Hi, > > > Could you elaborate on what you see as the discrepancy between docs and > implementation? The docs don't say whether > > it's a shallow or a deep copy, so it looks to me that the implementation > is within the bounds of the docs. > > > Plus it seems sensible to return a shallow copy, doesn't it? > > > > Simon > ------------------------------ > *From:* Development qt.io at qt-project.org> on behalf of Tomasz Olszak > *Sent:* Monday, July 11, 2016 11:38:06 AM > *To:* development at qt-project.org > *Subject:* [Development] QImage::transformed returns shallow copy for > QTransform::TxNone matrix type. > > Hello, > > QImage:: transformed(const QTransform &matrix, Qt::TransformationMode mode > = Qt::FastTransformation) docs: > > "Returns a copy of the image that is transformed using the given > transformation matrix and transformation mode." > > But if matrix.type() == QTransform::TxNone then shallow instead of deep > copy is returned. > > I'm happy to submit a fix but I don't know what is expected behaviour? > Should implementation follow docs or docs or docs follow implementation > here? > > T. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Simon.Hausmann at qt.io Mon Jul 11 13:10:13 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Mon, 11 Jul 2016 11:10:13 +0000 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: , Message-ID: Hi, Thank you for the explanation of your use-case. What remains unclear to me is why it is necessary for you to ensure a deep copy? Is it related to the fact that your image is created from a raw data pointer and after your worker thread is done, you cannot guarantee for the life-time of the raw data anymore? Perhaps you could use the QImage constructor that takes a cleanup function (and cleanupInfo pointer). If your worker thread ends up making a copy of the image data as a result of your transformation, then your original copy can and will be deleted when you discard the source of the transform() call. That is something that you can keep track of. Vice-versa if it's not being called, then you know that transformed() (or generally speaking _any_ sequence of operations you may have done) still operate on a shallow copy. Then you can do an explicit deep copy. Generally speaking my impression - assuming I did understand your use-case correctly - is that your problem stems from the unknown life-cycle of your data. I don't think the behavior of QImage::transformed() should be made worse for the common case where shallow copying benefits performance and memory consumption. Simon ________________________________ From: Development on behalf of Tomasz Olszak Sent: Monday, July 11, 2016 12:53:51 PM To: development at qt-project.org Subject: Re: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. QImage::copy returns deep copy and has similar documentation so I assumed that when docs say copy it means deep copy. Let's consider common case: 1. QImage img created from raw data pointer got from e.g. driver. 2. img used in thread to perform some transforms 3. Save result as deep copy Ensuring step 3 is most efficient and does not perform unnecessary copying I need to write something like: QTransform t; if (m.type() == QTransform::TxNone) return img.copy(); else return img.transformed(m); AFAIU img.transformed(m).copy() will copy twice when m.type() != QTransform::TxNone right? Don't you think that is seems strange and is not documented enough? 2016-07-11 10:59 GMT+01:00 Simon Hausmann >: Hi, Could you elaborate on what you see as the discrepancy between docs and implementation? The docs don't say whether it's a shallow or a deep copy, so it looks to me that the implementation is within the bounds of the docs. Plus it seems sensible to return a shallow copy, doesn't it? Simon ________________________________ From: Development > on behalf of Tomasz Olszak > Sent: Monday, July 11, 2016 11:38:06 AM To: development at qt-project.org Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. Hello, QImage:: transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) docs: "Returns a copy of the image that is transformed using the given transformation matrix and transformation mode." But if matrix.type() == QTransform::TxNone then shallow instead of deep copy is returned. I'm happy to submit a fix but I don't know what is expected behaviour? Should implementation follow docs or docs or docs follow implementation here? T. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olszak.tomasz at gmail.com Mon Jul 11 13:40:25 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 12:40:25 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: The pointer comes from external object and it's lifetime is managed by it. I need to ensure that I will not use it anymore after leaving certain function. Hence it don't even need to be thread operation, So using clean function won't help here. The problem here is that you can't say if transformed returns shallow or deep copy. Result depends on argument value. Of course the transform returning shallow copy on identity matrix is nice but should be documented somewhere. After reading docs I expected deep copy like from copy function. But maybe it's only me :) Thanks for profound explanation. 2016-07-11 12:10 GMT+01:00 Simon Hausmann : > Hi, > > > Thank you for the explanation of your use-case. What remains unclear to me > is why it is necessary for you to ensure a deep copy? > > > Is it related to the fact that your image is created from a raw data > pointer and after your worker thread is done, you cannot guarantee > > for the life-time of the raw data anymore? > > > Perhaps you could use the QImage constructor that takes a cleanup function > (and cleanupInfo pointer). If your worker thread > > ends up making a copy of the image data as a result of your > transformation, then your original copy can and will be deleted > > when you discard the source of the transform() call. That is something > that you can keep track of. Vice-versa if it's not being called, > > then you know that transformed() (or generally speaking _any_ sequence of > operations you may have done) still operate on a shallow > > copy. Then you can do an explicit deep copy. > > > Generally speaking my impression - assuming I did understand your use-case > correctly - is that your problem stems from the unknown > > life-cycle of your data. I don't think the behavior of > QImage::transformed() should be made worse for the common case where shallow > > copying benefits performance and memory consumption. > > > Simon > ------------------------------ > *From:* Development qt.io at qt-project.org> on behalf of Tomasz Olszak > *Sent:* Monday, July 11, 2016 12:53:51 PM > *To:* development at qt-project.org > *Subject:* Re: [Development] QImage::transformed returns shallow copy for > QTransform::TxNone matrix type. > > QImage::copy returns deep copy and has similar documentation so I assumed > that when docs say copy it means deep copy. > > Let's consider common case: > > 1. QImage img created from raw data pointer got from e.g. driver. > 2. img used in thread to perform some transforms > 3. Save result as deep copy > > Ensuring step 3 is most efficient and does not perform unnecessary copying > I need to write something like: > > QTransform t; > if (m.type() == QTransform::TxNone) > return img.copy(); > else > return img.transformed(m); > > AFAIU img.transformed(m).copy() will copy twice when m.type() != > QTransform::TxNone right? > > Don't you think that is seems strange and is not documented enough? > > 2016-07-11 10:59 GMT+01:00 Simon Hausmann : > >> Hi, >> >> >> Could you elaborate on what you see as the discrepancy between docs and >> implementation? The docs don't say whether >> >> it's a shallow or a deep copy, so it looks to me that the implementation >> is within the bounds of the docs. >> >> >> Plus it seems sensible to return a shallow copy, doesn't it? >> >> >> >> Simon >> ------------------------------ >> *From:* Development > qt.io at qt-project.org> on behalf of Tomasz Olszak > > >> *Sent:* Monday, July 11, 2016 11:38:06 AM >> *To:* development at qt-project.org >> *Subject:* [Development] QImage::transformed returns shallow copy for >> QTransform::TxNone matrix type. >> >> Hello, >> >> QImage:: transformed(const QTransform &matrix, Qt::TransformationMode >> mode = Qt::FastTransformation) docs: >> >> "Returns a copy of the image that is transformed using the given >> transformation matrix and transformation mode." >> >> But if matrix.type() == QTransform::TxNone then shallow instead of deep >> copy is returned. >> >> I'm happy to submit a fix but I don't know what is expected behaviour? >> Should implementation follow docs or docs or docs follow implementation >> here? >> >> T. >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Simon.Hausmann at qt.io Mon Jul 11 13:52:03 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Mon, 11 Jul 2016 11:52:03 +0000 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: , Message-ID: Hi, What I'm suggesting is not to use the cleanup function to release any memory. As you have explained that is not possible as you do not own the data. But you can use the cleanup callback as a way to determine if Qt still has a reference to your image data or not. If your image _was_ transformed then there should not be any reference anymore. If it wasn't called, then you do need to call copy() explicitly to release the reference. Another way would be to call QImage::isDetached(), but that is not public API. Both are approached that allow you to replace your existing check with something that is less dependent on the implementation of QImage::transformed - in case it changes one day - but are supposed to make your code more robust. Simon ________________________________ From: Tomasz Olszak Sent: Monday, July 11, 2016 1:40:25 PM To: Simon Hausmann Cc: development at qt-project.org Subject: Re: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. The pointer comes from external object and it's lifetime is managed by it. I need to ensure that I will not use it anymore after leaving certain function. Hence it don't even need to be thread operation, So using clean function won't help here. The problem here is that you can't say if transformed returns shallow or deep copy. Result depends on argument value. Of course the transform returning shallow copy on identity matrix is nice but should be documented somewhere. After reading docs I expected deep copy like from copy function. But maybe it's only me :) Thanks for profound explanation. 2016-07-11 12:10 GMT+01:00 Simon Hausmann >: Hi, Thank you for the explanation of your use-case. What remains unclear to me is why it is necessary for you to ensure a deep copy? Is it related to the fact that your image is created from a raw data pointer and after your worker thread is done, you cannot guarantee for the life-time of the raw data anymore? Perhaps you could use the QImage constructor that takes a cleanup function (and cleanupInfo pointer). If your worker thread ends up making a copy of the image data as a result of your transformation, then your original copy can and will be deleted when you discard the source of the transform() call. That is something that you can keep track of. Vice-versa if it's not being called, then you know that transformed() (or generally speaking _any_ sequence of operations you may have done) still operate on a shallow copy. Then you can do an explicit deep copy. Generally speaking my impression - assuming I did understand your use-case correctly - is that your problem stems from the unknown life-cycle of your data. I don't think the behavior of QImage::transformed() should be made worse for the common case where shallow copying benefits performance and memory consumption. Simon ________________________________ From: Development > on behalf of Tomasz Olszak > Sent: Monday, July 11, 2016 12:53:51 PM To: development at qt-project.org Subject: Re: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. QImage::copy returns deep copy and has similar documentation so I assumed that when docs say copy it means deep copy. Let's consider common case: 1. QImage img created from raw data pointer got from e.g. driver. 2. img used in thread to perform some transforms 3. Save result as deep copy Ensuring step 3 is most efficient and does not perform unnecessary copying I need to write something like: QTransform t; if (m.type() == QTransform::TxNone) return img.copy(); else return img.transformed(m); AFAIU img.transformed(m).copy() will copy twice when m.type() != QTransform::TxNone right? Don't you think that is seems strange and is not documented enough? 2016-07-11 10:59 GMT+01:00 Simon Hausmann >: Hi, Could you elaborate on what you see as the discrepancy between docs and implementation? The docs don't say whether it's a shallow or a deep copy, so it looks to me that the implementation is within the bounds of the docs. Plus it seems sensible to return a shallow copy, doesn't it? Simon ________________________________ From: Development > on behalf of Tomasz Olszak > Sent: Monday, July 11, 2016 11:38:06 AM To: development at qt-project.org Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. Hello, QImage:: transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) docs: "Returns a copy of the image that is transformed using the given transformation matrix and transformation mode." But if matrix.type() == QTransform::TxNone then shallow instead of deep copy is returned. I'm happy to submit a fix but I don't know what is expected behaviour? Should implementation follow docs or docs or docs follow implementation here? T. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangelog at gmail.com Mon Jul 11 13:52:30 2016 From: dangelog at gmail.com (Giuseppe D'Angelo) Date: Mon, 11 Jul 2016 13:52:30 +0200 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: On Mon, Jul 11, 2016 at 1:40 PM, Tomasz Olszak wrote: > The problem here is that you can't say if transformed returns shallow or > deep copy. Result depends on argument value. Of course the transform > returning shallow copy on identity matrix is nice but should be documented > somewhere. After reading docs I expected deep copy like from copy function. > But maybe it's only me :) Then always deep copy and then move on with the processing? Because relying on shallow copies is a bit of a gamble -- by the same reasoning, can you be sure that setPixel(x, y, color) always detaches? What if it gets implemented in a way that first checks if the pixel already has that color, and if so, it doesn't do anything? -- Giuseppe D'Angelo From olszak.tomasz at gmail.com Mon Jul 11 14:42:17 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 13:42:17 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: Yes seems more robust but it also seems like using a sledgehammer to crack a nut. Seems like it is not worth to burn you time for that. If everyone is ok with docs I'm too :) 2016-07-11 12:52 GMT+01:00 Simon Hausmann : > Hi, > > > What I'm suggesting is not to use the cleanup function to release any > memory. As you have explained that is not possible as you do not own the > data. But you can use > > the cleanup callback as a way to determine if Qt still has a reference to > your image data or not. If your image _was_ transformed then there should > not be any reference > > anymore. If it wasn't called, then you do need to call copy() explicitly > to release the reference. > > > Another way would be to call QImage::isDetached(), but that is not public > API. > > > Both are approached that allow you to replace your existing check with > something that is less dependent on the implementation of > QImage::transformed - in case > > it changes one day - but are supposed to make your code more robust. > > > > Simon > ------------------------------ > *From:* Tomasz Olszak > *Sent:* Monday, July 11, 2016 1:40:25 PM > *To:* Simon Hausmann > *Cc:* development at qt-project.org > > *Subject:* Re: [Development] QImage::transformed returns shallow copy for > QTransform::TxNone matrix type. > > The pointer comes from external object and it's lifetime is managed by it. > I need to ensure that I will not use it anymore after leaving certain > function. Hence it don't even need to be thread operation, So using clean > function won't help here. > > The problem here is that you can't say if transformed returns shallow or > deep copy. Result depends on argument value. Of course the transform > returning shallow copy on identity matrix is nice but should be documented > somewhere. After reading docs I expected deep copy like from copy function. > But maybe it's only me :) > > Thanks for profound explanation. > > > 2016-07-11 12:10 GMT+01:00 Simon Hausmann : > >> Hi, >> >> >> Thank you for the explanation of your use-case. What remains unclear to >> me is why it is necessary for you to ensure a deep copy? >> >> >> Is it related to the fact that your image is created from a raw data >> pointer and after your worker thread is done, you cannot guarantee >> >> for the life-time of the raw data anymore? >> >> >> Perhaps you could use the QImage constructor that takes a cleanup >> function (and cleanupInfo pointer). If your worker thread >> >> ends up making a copy of the image data as a result of your >> transformation, then your original copy can and will be deleted >> >> when you discard the source of the transform() call. That is something >> that you can keep track of. Vice-versa if it's not being called, >> >> then you know that transformed() (or generally speaking _any_ sequence of >> operations you may have done) still operate on a shallow >> >> copy. Then you can do an explicit deep copy. >> >> >> Generally speaking my impression - assuming I did understand your >> use-case correctly - is that your problem stems from the unknown >> >> life-cycle of your data. I don't think the behavior of >> QImage::transformed() should be made worse for the common case where shallow >> >> copying benefits performance and memory consumption. >> >> >> Simon >> ------------------------------ >> *From:* Development > qt.io at qt-project.org> on behalf of Tomasz Olszak > > >> *Sent:* Monday, July 11, 2016 12:53:51 PM >> *To:* development at qt-project.org >> *Subject:* Re: [Development] QImage::transformed returns shallow copy >> for QTransform::TxNone matrix type. >> >> QImage::copy returns deep copy and has similar documentation so I assumed >> that when docs say copy it means deep copy. >> >> Let's consider common case: >> >> 1. QImage img created from raw data pointer got from e.g. driver. >> 2. img used in thread to perform some transforms >> 3. Save result as deep copy >> >> Ensuring step 3 is most efficient and does not perform unnecessary >> copying I need to write something like: >> >> QTransform t; >> if (m.type() == QTransform::TxNone) >> return img.copy(); >> else >> return img.transformed(m); >> >> AFAIU img.transformed(m).copy() will copy twice when m.type() != >> QTransform::TxNone right? >> >> Don't you think that is seems strange and is not documented enough? >> >> 2016-07-11 10:59 GMT+01:00 Simon Hausmann : >> >>> Hi, >>> >>> >>> Could you elaborate on what you see as the discrepancy between docs and >>> implementation? The docs don't say whether >>> >>> it's a shallow or a deep copy, so it looks to me that the implementation >>> is within the bounds of the docs. >>> >>> >>> Plus it seems sensible to return a shallow copy, doesn't it? >>> >>> >>> >>> Simon >>> ------------------------------ >>> *From:* Development >> qt.io at qt-project.org> on behalf of Tomasz Olszak < >>> olszak.tomasz at gmail.com> >>> *Sent:* Monday, July 11, 2016 11:38:06 AM >>> *To:* development at qt-project.org >>> *Subject:* [Development] QImage::transformed returns shallow copy for >>> QTransform::TxNone matrix type. >>> >>> Hello, >>> >>> QImage:: transformed(const QTransform &matrix, Qt::TransformationMode >>> mode = Qt::FastTransformation) docs: >>> >>> "Returns a copy of the image that is transformed using the given >>> transformation matrix and transformation mode." >>> >>> But if matrix.type() == QTransform::TxNone then shallow instead of deep >>> copy is returned. >>> >>> I'm happy to submit a fix but I don't know what is expected behaviour? >>> Should implementation follow docs or docs or docs follow implementation >>> here? >>> >>> T. >>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olszak.tomasz at gmail.com Mon Jul 11 14:45:18 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 13:45:18 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: QTransform m. img.transformed(m).copy() will create one copy. But: QTransform m. m.rotate(10); img.transformed(m).copy() will copy image twice; On embedded device, if you do some video decoding it is a problem :) 2016-07-11 12:52 GMT+01:00 Giuseppe D'Angelo : > On Mon, Jul 11, 2016 at 1:40 PM, Tomasz Olszak > wrote: > > The problem here is that you can't say if transformed returns shallow or > > deep copy. Result depends on argument value. Of course the transform > > returning shallow copy on identity matrix is nice but should be > documented > > somewhere. After reading docs I expected deep copy like from copy > function. > > But maybe it's only me :) > > Then always deep copy and then move on with the processing? Because > relying on shallow copies is a bit of a gamble -- by the same > reasoning, can you be sure that setPixel(x, y, color) always detaches? > What if it gets implemented in a way that first checks if the pixel > already has that color, and if so, it doesn't do anything? > > -- > Giuseppe D'Angelo > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Simon.Hausmann at qt.io Mon Jul 11 14:54:58 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Mon, 11 Jul 2016 12:54:58 +0000 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: , Message-ID: Hi, I realize that there may be an even simpler way of ensure that you get a deep copy, but only if transformed() hasn't already made one (so that you don't have to worry about your potentially dangling pointer): Instead of using copy(), why not call the non-const bits() function (and don't use the returned value). That will detach (and thus deep-copy) the data if your transformation produced no copy. If a copy was produced, then that will be the only copy and no copying happens. Simon ________________________________ From: Tomasz Olszak Sent: Monday, July 11, 2016 2:45:18 PM To: Giuseppe D'Angelo Cc: Simon Hausmann; development at qt-project.org Subject: Re: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. QTransform m. img.transformed(m).copy() will create one copy. But: QTransform m. m.rotate(10); img.transformed(m).copy() will copy image twice; On embedded device, if you do some video decoding it is a problem :) 2016-07-11 12:52 GMT+01:00 Giuseppe D'Angelo >: On Mon, Jul 11, 2016 at 1:40 PM, Tomasz Olszak > wrote: > The problem here is that you can't say if transformed returns shallow or > deep copy. Result depends on argument value. Of course the transform > returning shallow copy on identity matrix is nice but should be documented > somewhere. After reading docs I expected deep copy like from copy function. > But maybe it's only me :) Then always deep copy and then move on with the processing? Because relying on shallow copies is a bit of a gamble -- by the same reasoning, can you be sure that setPixel(x, y, color) always detaches? What if it gets implemented in a way that first checks if the pixel already has that color, and if so, it doesn't do anything? -- Giuseppe D'Angelo -------------- next part -------------- An HTML attachment was scrubbed... URL: From olszak.tomasz at gmail.com Mon Jul 11 15:08:54 2016 From: olszak.tomasz at gmail.com (Tomasz Olszak) Date: Mon, 11 Jul 2016 14:08:54 +0100 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: Oh good spot, thanks for that. It doesn't depend on QIMage::transformed impl. Thanks! 2016-07-11 13:54 GMT+01:00 Simon Hausmann : > Hi, > > > I realize that there may be an even simpler way of ensure that you get a > deep copy, but only if transformed() hasn't already > > made one (so that you don't have to worry about your potentially dangling > pointer): > > > Instead of using copy(), why not call the non-const bits() function (and > don't use the returned value). That will detach (and thus > > deep-copy) the data if your transformation produced no copy. If a copy was > produced, then that will be the only copy and no > > copying happens. > > > > > Simon > ------------------------------ > *From:* Tomasz Olszak > *Sent:* Monday, July 11, 2016 2:45:18 PM > *To:* Giuseppe D'Angelo > *Cc:* Simon Hausmann; development at qt-project.org > *Subject:* Re: [Development] QImage::transformed returns shallow copy for > QTransform::TxNone matrix type. > > QTransform m. > img.transformed(m).copy() > > will create one copy. But: > > QTransform m. > m.rotate(10); > img.transformed(m).copy() > > will copy image twice; On embedded device, if you do some video decoding > it is a problem :) > > 2016-07-11 12:52 GMT+01:00 Giuseppe D'Angelo : > >> On Mon, Jul 11, 2016 at 1:40 PM, Tomasz Olszak >> wrote: >> > The problem here is that you can't say if transformed returns shallow or >> > deep copy. Result depends on argument value. Of course the transform >> > returning shallow copy on identity matrix is nice but should be >> documented >> > somewhere. After reading docs I expected deep copy like from copy >> function. >> > But maybe it's only me :) >> >> Then always deep copy and then move on with the processing? Because >> relying on shallow copies is a bit of a gamble -- by the same >> reasoning, can you be sure that setPixel(x, y, color) always detaches? >> What if it gets implemented in a way that first checks if the pixel >> already has that color, and if so, it doesn't do anything? >> >> -- >> Giuseppe D'Angelo >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.tvete at qt.io Mon Jul 11 16:03:32 2016 From: paul.tvete at qt.io (Paul Olav Tvete) Date: Mon, 11 Jul 2016 16:03:32 +0200 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: Message-ID: <3374551.Hg99cgf9bJ@dragaera> On mandag 11. juli 2016 12.54.58 CEST Simon Hausmann wrote: > Instead of using copy(), why not call the non-const bits() function (and > don't use the returned value). That will detach [...] Instead of using bits(), why not call detach() directly? ;) - Paul From b.terrier at gmail.com Mon Jul 11 16:05:50 2016 From: b.terrier at gmail.com (Benjamin TERRIER) Date: Mon, 11 Jul 2016 16:05:50 +0200 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: <3374551.Hg99cgf9bJ@dragaera> References: <3374551.Hg99cgf9bJ@dragaera> Message-ID: 2016-07-11 16:03 GMT+02:00 Paul Olav Tvete : > On mandag 11. juli 2016 12.54.58 CEST Simon Hausmann wrote: >> Instead of using copy(), why not call the non-const bits() function (and >> don't use the returned value). That will detach [...] > > Instead of using bits(), why not call detach() directly? ;) > > - Paul > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development Hi, QImage::detach() is not public API. However QPixmap::detach() is, so why QImage::detach() couldn't be made public too? BR, Benjamin From Simon.Hausmann at qt.io Mon Jul 11 16:07:01 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Mon, 11 Jul 2016 14:07:01 +0000 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: <3374551.Hg99cgf9bJ@dragaera> References: , <3374551.Hg99cgf9bJ@dragaera> Message-ID: Detach() is marked with \internal - wouldn't want to suggest the use of private api;) Simon ________________________________ From: Paul Olav Tvete Sent: Jul 11, 2016 16:03 To: development at qt-project.org Subject: Re: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. On mandag 11. juli 2016 12.54.58 CEST Simon Hausmann wrote: > Instead of using copy(), why not call the non-const bits() function (and > don't use the returned value). That will detach [...] Instead of using bits(), why not call detach() directly? ;) - Paul _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: From kde at carewolf.com Mon Jul 11 16:47:08 2016 From: kde at carewolf.com (Allan Sandfeld Jensen) Date: Mon, 11 Jul 2016 16:47:08 +0200 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: <3374551.Hg99cgf9bJ@dragaera> Message-ID: <201607111647.09054.kde@carewolf.com> On Monday 11 July 2016, Benjamin TERRIER wrote: > 2016-07-11 16:03 GMT+02:00 Paul Olav Tvete : > > On mandag 11. juli 2016 12.54.58 CEST Simon Hausmann wrote: > >> Instead of using copy(), why not call the non-const bits() function (and > >> don't use the returned value). That will detach [...] > > > > Instead of using bits(), why not call detach() directly? ;) > > > > - Paul > > > > _______________________________________________ > > Development mailing list > > Development at qt-project.org > > http://lists.qt-project.org/mailman/listinfo/development > > Hi, > > QImage::detach() is not public API. > However QPixmap::detach() is, so why QImage::detach() couldn't be made > public too? > It probably should be. It is a lot more sensible to use than copy(rect()). BR `Allan From andre at familiesomers.nl Mon Jul 11 20:33:43 2016 From: andre at familiesomers.nl (=?UTF-8?Q?Andr=c3=a9_Somers?=) Date: Mon, 11 Jul 2016 20:33:43 +0200 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: Message-ID: Op 09/07/2016 om 20:01 schreef swarit wipra: > Hi folks, > > i have issues in showing huge data in QTableView ,data read from > sqlite database which is being updated dynamically .. 2k rows in 2s. > i am using QSQLRelationModel > let me describe the scenario in detail. > > My Qt application has a view i.e QTableView , each row has following > structure: > > **************************************** > *QPushButton*|QLabel | QLabel | QLabel * > **************************************** > i have created it using QItemDelegate > > each row isinserted dynamicaly , after sometime gui gets freezed. > > could anyone tell me the way to fix the issue. Don't implement it like this. You are creating 8k widgets and act suprised that it isn't fast... Even if you did not use QLabel but the default delegate, 2k push buttons is still pushing it I think. Note that this is by no means a new issue. Search and you will find better options, even ones using widgets but creating far less instances. André From nospam at vuorela.dk Mon Jul 11 21:21:06 2016 From: nospam at vuorela.dk (Sune Vuorela) Date: Mon, 11 Jul 2016 19:21:06 +0000 (UTC) Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. References: <3374551.Hg99cgf9bJ@dragaera> <201607111647.09054.kde@carewolf.com> Message-ID: On 2016-07-11, Allan Sandfeld Jensen wrote: > On Monday 11 July 2016, Benjamin TERRIER wrote: >> QImage::detach() is not public API. >> However QPixmap::detach() is, so why QImage::detach() couldn't be made >> public too? >> > It probably should be. It is a lot more sensible to use than copy(rect()). https://codereview.qt-project.org/#/c/164886/ /Sune From cristian.adam at gmail.com Tue Jul 12 00:20:01 2016 From: cristian.adam at gmail.com (Cristian Adam) Date: Tue, 12 Jul 2016 00:20:01 +0200 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2133524.ekmAkN6kfG@tjmaciei-mobl1> <1775643.FonJhWLViK@tjmaciei-mobl1> <201607070910.51615.marc.mutz@kdab.com> Message-ID: On Thu, Jul 7, 2016 at 12:06 PM, Marco Bubke wrote: > I think it simply a question of time to get used to the STL. You get used > to many things. > > I think we should mind about the new features of C++ which are coming, > which cannot integrated very well with Qt because we use a different idiom. > > I really think we should make it easier for the developer but if we > provide no way to go the fast path do we really make it easier? > > If the context is changing over time, is it not smart to reevaluate > decision again and maybe go a different route? I don't mean to do it all > the time but maybe there is a middle path between different > "fundamentalisms". [image: 😉] > Luckily there's Copper Spice, and it seems they want to be the more *modern* C++ Qt library. Their latest presentation has at page 6 this: [image: Inline image 1] The STL containers part is not yet done. Will they keep the move semantics for the upcoming containers? What would QString refactor would bring? UTF-8? QStringView? Cheers, Cristian. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: OutlookEmoji-😉.png Type: image/png Size: 390 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: copper_spice_1.3.png Type: image/png Size: 92329 bytes Desc: not available URL: From thiago.macieira at intel.com Tue Jul 12 07:33:16 2016 From: thiago.macieira at intel.com (Thiago Macieira) Date: Mon, 11 Jul 2016 22:33:16 -0700 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> Message-ID: <2712893.3zGXhzZ5Tl@tjmaciei-mobl1> On terça-feira, 12 de julho de 2016 00:20:01 PDT Cristian Adam wrote: > Their latest presentation > y/copperspice_the_next_generation_of_signals.pdf> has > at page 6 this: Criticism: * Qt's dependency on qmake: that's only for building Qt itself, not for your application. Otherwise, we could always criticise any library for choosing to use buildsystem X instead of Y. * Remove moc: why? Moc has a very important use besides signals, that being of reflection of C++. Until at least C++ 2020, but most likely WAY further, there's no replacement for that. Therefore, removing moc is removing important functionality. Let's see CS implement QtScript, QtDBus and QtQml without moc... * Use native C++ atomics: done in Qt 5.7, except for MSVC which doesn't implement it properly. * Signal / slot delivery as a separate library: interesting, I'll give CS that, but not sure what the value of this is. * Containers: leveraging STL only makes sense if we drop implicit sharing. There are many arguments in favour and against doing that, which I will not get into. What I will say: doing implicit-sharing with STL is the worst of both worlds. * Use C++ native pointers: granted, that's also the reason why we're not reimplementing std::unique_ptr or extending QScopedPointer to have move semantics. * Refactor QString: huh? > What would QString refactor would bring? UTF-8? QStringView? Why would we want UTF-8? There's no native type for it, unlike UTF-16's char16_t. And ALL the good Unicode-capable API in most OSes uses UTF-16 (Java, ICU, Win32, Cocoa, all are UTF-16; POSIX's wide-char API is neither good nor guaranteed to be UTF-32). -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center From b.terrier at gmail.com Tue Jul 12 10:15:01 2016 From: b.terrier at gmail.com (Benjamin TERRIER) Date: Tue, 12 Jul 2016 10:15:01 +0200 Subject: [Development] QImage::transformed returns shallow copy for QTransform::TxNone matrix type. In-Reply-To: References: <3374551.Hg99cgf9bJ@dragaera> <201607111647.09054.kde@carewolf.com> Message-ID: 2016-07-11 21:21 GMT+02:00 Sune Vuorela : > On 2016-07-11, Allan Sandfeld Jensen wrote: >> On Monday 11 July 2016, Benjamin TERRIER wrote: >>> QImage::detach() is not public API. >>> However QPixmap::detach() is, so why QImage::detach() couldn't be made >>> public too? >>> >> It probably should be. It is a lot more sensible to use than copy(rect()). > > https://codereview.qt-project.org/#/c/164886/ > > /Sune > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development Just something worth stating here, from Mark Mutz on the codereview: "QImage::detach() doesn't (if the QImage was constructed from the mutable-uchar* ctor)." So it's seem that all detach() functions which are internal will not detach when using external data which is the case discussed here in the first place. However detach() member functions which are part of the public API (e.g QPixmap::detach()) will always detach. The consequence is that for Tomasz Olszak's use case calling QImage::detach() is a bad idea because (1) it is not public API and (2) it will NOT detach. So the only solution seems to call the non const version of bits() as suggested earlier. BR, Benjamin Terrier From mitch.curtis at qt.io Tue Jul 12 10:49:47 2016 From: mitch.curtis at qt.io (Mitch Curtis) Date: Tue, 12 Jul 2016 08:49:47 +0000 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: Message-ID: As someone who has more experience with Qt Quick, I gotta ask... does QTableView create widgets for every row in the model all at once? > -----Original Message----- > From: Development [mailto:development-bounces+mitch.curtis=qt.io at qt- > project.org] On Behalf Of André Somers > Sent: Monday, 11 July 2016 8:34 PM > To: development at qt-project.org > Subject: Re: [Development] QTableView gets freezed in showing data read > from SQLite database , which is updated dynamically with 2000 rows in 2s > > > > Op 09/07/2016 om 20:01 schreef swarit wipra: > > Hi folks, > > > > i have issues in showing huge data in QTableView ,data read from > > sqlite database which is being updated dynamically .. 2k rows in 2s. > > i am using QSQLRelationModel > > let me describe the scenario in detail. > > > > My Qt application has a view i.e QTableView , each row has following > > structure: > > > > **************************************** > > *QPushButton*|QLabel | QLabel | QLabel * > > **************************************** > > i have created it using QItemDelegate > > > > each row isinserted dynamicaly , after sometime gui gets freezed. > > > > could anyone tell me the way to fix the issue. > Don't implement it like this. You are creating 8k widgets and act suprised > that it isn't fast... Even if you did not use QLabel but the default > delegate, 2k push buttons is still pushing it I think. > > Note that this is by no means a new issue. Search and you will find better > options, even ones using widgets but creating far less instances. > > André > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development From giuseppe.dangelo at kdab.com Tue Jul 12 11:27:33 2016 From: giuseppe.dangelo at kdab.com (Giuseppe D'Angelo) Date: Tue, 12 Jul 2016 11:27:33 +0200 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: Message-ID: <5784B805.6020904@kdab.com> Il 12/07/2016 10:49, Mitch Curtis ha scritto: > As someone who has more experience with Qt Quick, I gotta ask... does QTableView create widgets for every row in the model all at once? It does not create any sub widget. The whole point of the design of item views is to use a few delegate objects (1, out of the box) to paint themselves, not to create thousands of sub-widgets. (Besides, this is the wrong ML for discussing this problem...) Cheers, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4007 bytes Desc: Firma crittografica S/MIME URL: From Marco.Bubke at qt.io Tue Jul 12 11:47:48 2016 From: Marco.Bubke at qt.io (Marco Bubke) Date: Tue, 12 Jul 2016 09:47:48 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: <2712893.3zGXhzZ5Tl@tjmaciei-mobl1> References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> , <2712893.3zGXhzZ5Tl@tjmaciei-mobl1> Message-ID: > Why would we want UTF-8? There's no native type for it, unlike UTF-16's > char16_t. And ALL the good Unicode-capable API in most OSes uses UTF-16 (Java, > ICU, Win32, Cocoa, all are UTF-16; POSIX's wide-char API is neither good nor > guaranteed to be UTF-32). UTF-8 is used by many libraries and converting between UTF-16 and UTF-8 makes things not faster or better. If you work with text which is annotated with ASCII, which is quite common today, the advantages of Utf8 looks quite compelling. But without changing QString to UTF-8 our UTF-8 support could be much better . For example we convert mostly to a QByteArray which has to be copied again because we have move the ownership of that string to API which is not supporting QByteArray. In that case it would be already nice that you would have something like QByteArray::takeData(). And this is only one case. Lets face it, the world is much bigger than Qt, and I think there is much to gain if we integrate better with alien libraries. Actually as I used Qt in the nineties it was my impression that Qt had that mindset but than it changed gradually. ________________________________ From: Development on behalf of Thiago Macieira Sent: Tuesday, July 12, 2016 7:33:16 AM To: development at qt-project.org Subject: Re: [Development] Use of Standard Library containers in Qt source code On terça-feira, 12 de julho de 2016 00:20:01 PDT Cristian Adam wrote: > Their latest presentation > y/copperspice_the_next_generation_of_signals.pdf> has > at page 6 this: Criticism: * Qt's dependency on qmake: that's only for building Qt itself, not for your application. Otherwise, we could always criticise any library for choosing to use buildsystem X instead of Y. * Remove moc: why? Moc has a very important use besides signals, that being of reflection of C++. Until at least C++ 2020, but most likely WAY further, there's no replacement for that. Therefore, removing moc is removing important functionality. Let's see CS implement QtScript, QtDBus and QtQml without moc... * Use native C++ atomics: done in Qt 5.7, except for MSVC which doesn't implement it properly. * Signal / slot delivery as a separate library: interesting, I'll give CS that, but not sure what the value of this is. * Containers: leveraging STL only makes sense if we drop implicit sharing. There are many arguments in favour and against doing that, which I will not get into. What I will say: doing implicit-sharing with STL is the worst of both worlds. * Use C++ native pointers: granted, that's also the reason why we're not reimplementing std::unique_ptr or extending QScopedPointer to have move semantics. * Refactor QString: huh? > What would QString refactor would bring? UTF-8? QStringView? Why would we want UTF-8? There's no native type for it, unlike UTF-16's char16_t. And ALL the good Unicode-capable API in most OSes uses UTF-16 (Java, ICU, Win32, Cocoa, all are UTF-16; POSIX's wide-char API is neither good nor guaranteed to be UTF-32). -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: From mitch.curtis at qt.io Tue Jul 12 14:19:03 2016 From: mitch.curtis at qt.io (Mitch Curtis) Date: Tue, 12 Jul 2016 12:19:03 +0000 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: <5784B805.6020904@kdab.com> References: <5784B805.6020904@kdab.com> Message-ID: > -----Original Message----- > From: Development [mailto:development-bounces+mitch.curtis=qt.io at qt- > project.org] On Behalf Of Giuseppe D'Angelo > Sent: Tuesday, 12 July 2016 11:28 AM > To: development at qt-project.org > Subject: Re: [Development] QTableView gets freezed in showing data read > from SQLite database , which is updated dynamically with 2000 rows in 2s > > Il 12/07/2016 10:49, Mitch Curtis ha scritto: > > As someone who has more experience with Qt Quick, I gotta ask... does > QTableView create widgets for every row in the model all at once? > > It does not create any sub widget. The whole point of the design of item > views is to use a few delegate objects (1, out of the box) to paint > themselves, not to create thousands of sub-widgets. So what Andre said ("2k push buttons") is wrong? > (Besides, this is the wrong ML for discussing this problem...) Why? I'm just clarifying a point brought up in response to someone's question about usage of Qt. > Cheers, > > -- > Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer > KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The > Qt Experts From mitch.curtis at qt.io Tue Jul 12 14:20:41 2016 From: mitch.curtis at qt.io (Mitch Curtis) Date: Tue, 12 Jul 2016 12:20:41 +0000 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: <5784B805.6020904@kdab.com> Message-ID: > -----Original Message----- > From: Development [mailto:development-bounces+mitch.curtis=qt.io at qt- > project.org] On Behalf Of Mitch Curtis > Sent: Tuesday, 12 July 2016 2:19 PM > To: Giuseppe D'Angelo ; development at qt- > project.org > Subject: Re: [Development] QTableView gets freezed in showing data read > from SQLite database , which is updated dynamically with 2000 rows in 2s > > > > > -----Original Message----- > > From: Development [mailto:development-bounces+mitch.curtis=qt.io at qt- > > project.org] On Behalf Of Giuseppe D'Angelo > > Sent: Tuesday, 12 July 2016 11:28 AM > > To: development at qt-project.org > > Subject: Re: [Development] QTableView gets freezed in showing data > > read from SQLite database , which is updated dynamically with 2000 > > rows in 2s > > > > Il 12/07/2016 10:49, Mitch Curtis ha scritto: > > > As someone who has more experience with Qt Quick, I gotta ask... > > > does > > QTableView create widgets for every row in the model all at once? > > > > It does not create any sub widget. The whole point of the design of > > item views is to use a few delegate objects (1, out of the box) to > > paint themselves, not to create thousands of sub-widgets. > > So what Andre said ("2k push buttons") is wrong? > > > (Besides, this is the wrong ML for discussing this problem...) > > Why? I'm just clarifying a point brought up in response to someone's > question about usage of Qt. Ah, right, I didn't realise the original post was in the dev list.. > > Cheers, > > > > -- > > Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software > > Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK > > +44-1625-809908 KDAB - The Qt Experts > > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development From giuseppe.dangelo at kdab.com Tue Jul 12 14:35:08 2016 From: giuseppe.dangelo at kdab.com (Giuseppe D'Angelo) Date: Tue, 12 Jul 2016 14:35:08 +0200 Subject: [Development] QTableView gets freezed in showing data read from SQLite database , which is updated dynamically with 2000 rows in 2s In-Reply-To: References: <5784B805.6020904@kdab.com> Message-ID: <5784E3FC.5080700@kdab.com> Il 12/07/2016 14:19, Mitch Curtis ha scritto: >> >It does not create any sub widget. The whole point of the design of item >> >views is to use a few delegate objects (1, out of the box) to paint >> >themselves, not to create thousands of sub-widgets. > So what Andre said ("2k push buttons") is wrong? Well, no, from the first message in the thread it looked like OP's was indeed filling the view by manually creating thousands of QPushButton / QLabel / etc. Cheers, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4007 bytes Desc: Firma crittografica S/MIME URL: From charleyb123 at gmail.com Tue Jul 12 14:58:11 2016 From: charleyb123 at gmail.com (charleyb123 .) Date: Tue, 12 Jul 2016 06:58:11 -0600 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2712893.3zGXhzZ5Tl@tjmaciei-mobl1> Message-ID: On Tue, Jul 12, 2016 at 3:47 AM, Marco Bubke wrote: > , Lets face it, the world is much bigger than Qt, and I think there > is much to gain if we integrate better with alien libraries. > My understanding is that most alien libraries are not binary-based (i.e., they are ternary or use other forms of multi-valued-logic (MVL)). ;-)) --charley -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jake.Petroules at qt.io Tue Jul 12 17:25:20 2016 From: Jake.Petroules at qt.io (Jake Petroules) Date: Tue, 12 Jul 2016 15:25:20 +0000 Subject: [Development] Use of Standard Library containers in Qt source code In-Reply-To: References: <6461895.FPZQEgjcFK@tjmaciei-mobl1> <2712893.3zGXhzZ5Tl@tjmaciei-mobl1> Message-ID: <9489423D-3A33-4F2D-8C7F-285C6B6ED073@qt.io> I always find it hilarious how people start debates about UTF-8 vs UTF-16 in string APIs. Let us not forget that in an ideal world, the QString API wouldn't expose the underlying encoding *at all*, and it would be an implementation detail unknown to users. See Swift's String class for example: https://developer.apple.com/swift/blog/?id=30 If you're thinking in terms of code units instead of in terms of grapheme clusters, you don't truly understand Unicode. And also end up with historical radioactive waste like UTF-16. On Jul 12, 2016, at 5:58 AM, charleyb123 . > wrote: On Tue, Jul 12, 2016 at 3:47 AM, Marco Bubke > wrote: , Lets face it, the world is much bigger than Qt, and I think there is much to gain if we integrate better with alien libraries. My understanding is that most alien libraries are not binary-based (i.e., they are ternary or use other forms of multi-valued-logic (MVL)). ;-)) --charley _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -- Jake Petroules - jake.petroules at qt.io Consulting Services Engineer - The Qt Company Qbs build tool evangelist - qbs.io -------------- next part -------------- An HTML attachment was scrubbed... URL: From oswald.buddenhagen at qt.io Wed Jul 13 11:08:07 2016 From: oswald.buddenhagen at qt.io (Oswald Buddenhagen) Date: Wed, 13 Jul 2016 11:08:07 +0200 Subject: [Development] [FYI] commit/review policy refactored Message-ID: <20160713090807.GA15458@troll08> just a heads-up that i (finally) split off the review policy from the commit policy. see https://wiki.qt.io/Review_Policy . if you have suggestions for improvement, please discuss them upfront on irc. you're expected to read the document even if you're not interested in actively improving it any time soon. ;) From Martin.Smith at qt.io Wed Jul 13 11:57:28 2016 From: Martin.Smith at qt.io (Martin Smith) Date: Wed, 13 Jul 2016 09:57:28 +0000 Subject: [Development] [FYI] commit/review policy refactored In-Reply-To: <20160713090807.GA15458@troll08> References: <20160713090807.GA15458@troll08> Message-ID: Sometimes I am listed as a reviewer for a code change in Qt that also involves documentation changes. The code change is sometimes outside my expertise, but I assume I have been included to approve the documentation changes. I always give +1 in such cases. Is that correct? martin ________________________________ From: Development on behalf of Oswald Buddenhagen Sent: Wednesday, July 13, 2016 11:08:07 AM To: development at qt-project.org; qt-creator at qt-project.org Subject: [Development] [FYI] commit/review policy refactored just a heads-up that i (finally) split off the review policy from the commit policy. see https://wiki.qt.io/Review_Policy . if you have suggestions for improvement, please discuss them upfront on irc. you're expected to read the document even if you're not interested in actively improving it any time soon. ;) _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: From oswald.buddenhagen at qt.io Wed Jul 13 12:14:53 2016 From: oswald.buddenhagen at qt.io (Oswald Buddenhagen) Date: Wed, 13 Jul 2016 12:14:53 +0200 Subject: [Development] [FYI] commit/review policy refactored In-Reply-To: References: <20160713090807.GA15458@troll08> Message-ID: <20160713101453.GA22702@troll08> On Wed, Jul 13, 2016 at 11:57:28AM +0200, Martin Smith wrote: > Sometimes I am listed as a reviewer for a code change in Qt that also involves > documentation changes. The code change is sometimes outside my expertise, but I > assume I have been included to approve the documentation changes. I always give > +1 in such cases. Is that correct? > yes. i added a respective point to the policy. From Kai.Koehne at qt.io Wed Jul 13 12:15:44 2016 From: Kai.Koehne at qt.io (Kai Koehne) Date: Wed, 13 Jul 2016 10:15:44 +0000 Subject: [Development] [FYI] commit/review policy refactored In-Reply-To: <20160713090807.GA15458@troll08> References: <20160713090807.GA15458@troll08> Message-ID: > -----Original Message----- > From: Development [mailto:development-bounces+kai.koehne=qt.io at qt- > project.org] On Behalf Of Oswald Buddenhagen > Sent: Wednesday, July 13, 2016 11:08 AM > To: development at qt-project.org; qt-creator at qt-project.org > Subject: [Development] [FYI] commit/review policy refactored > > just a heads-up that i (finally) split off the review policy from the commit > policy. see https://wiki.qt.io/Review_Policy . > if you have suggestions for improvement, please discuss them upfront on irc. I prefer to reply here :) The page is obviously written from the viewpoint of a maintainer. I'd prefer to write It in a less intimidating way to the contributor, and make it helpful for first time, inexperienced contributors. > As a Contributor Maybe link back to https://wiki.qt.io/Commit_Policy . "Make sure that your commit matches the Qt Commit Policy. > 1. Invite relevant reviewers. > * Always invite the respective domain experts, not somebody convenient. Scrap the 'not somebody convenient'. It's the job of the reviewer to decide what he can approve. Instead, mention how one can find the 'domain expert'. Something like * Domain experts can usually be found by inspecting the git log, and mailing lists. If in doubt also add the [https://wiki.qt.io/Maintainers Maintainer] of an area if there is one. > 2. Give reviewers ample time to respond. > * Unless everyone who can be reasonably expected to have a relevant opinion to offer has already done so, a full working day waiting time is the absolute minimum; three days are reasonable. > * In particular, give watchers (usually higher-level maintainers) enough time to voice concerns even if you did not explicitly invite them. The sub-points are only valid if you have a +2 already. So maybe move them down to a section ("If your change got approved"). Rather mention that it can take some working days until added people respond. > 3. Discuss objections. Do not override a -1 unless there is a broad expert consensus that the objection is unfounded. A Contributor cannot usually 'override' a -1 - that can only be done by an approver. Maybe your point is though that, if you got a +2, and somebody voiced objections, one shouldn't stage it? > 4. Do not ignore/fight the Early Warning System. Justify each override. > [...] Isn't that limited to Approvers, too? > 5. Do not approve your own changes. [...] Again that's limited to Approvers, and should be in the 'As a Reviewer' section. Regards Kai From alexander.blasche at qt.io Wed Jul 13 12:44:13 2016 From: alexander.blasche at qt.io (Alexander Blasche) Date: Wed, 13 Jul 2016 10:44:13 +0000 Subject: [Development] Source break policy for function overloads Message-ID: Hi, Yesterday, I stumbled over a break in QtSerialBus due to the addition of new QTimer::setInterval(..) overloads in qtbase/dev. This was introduced by https://codereview.qt-project.org/#/c/160889/ Unfortunately this has the undesirable side effect that lines like: q->connect(q, &QModbusClient::timeoutChanged, element.timer.data(), &QTimer::setInterval); do not compile anymore. The function pointer to setInterval() becomes ambiguous. While the fix (https://codereview.qt-project.org/#/c/165034/) was not difficult once you know what is happening this can hit every customer and basically reduces the source compatibility promise into absurdity. While talking to several devs in the office I could not find a congruent opinion on this issue. Do we or even can we care? Do we have a policy? -- Alex From oswald.buddenhagen at qt.io Wed Jul 13 12:48:51 2016 From: oswald.buddenhagen at qt.io (Oswald Buddenhagen) Date: Wed, 13 Jul 2016 12:48:51 +0200 Subject: [Development] [FYI] commit/review policy refactored In-Reply-To: References: <20160713090807.GA15458@troll08> Message-ID: <20160713104851.GB22702@troll08> On Wed, Jul 13, 2016 at 12:15:44PM +0200, Kai Köhne wrote: > The page is obviously written from the viewpoint of a maintainer. I'd > prefer to write It in a less intimidating way to the contributor, and > make it helpful for first time, inexperienced contributors. > first-timers can ask in case of doubt. this is meant to be a policy, not an intro. somewhat unsurprisingly, i finally took the effort to do this work because i witnessed several unrelated violations in the last weeks/ months. > > As a Contributor > > Maybe link back to https://wiki.qt.io/Commit_Policy . > it's linked from the reviewer section, which i find more logical. > "Make sure that your commit matches the Qt Commit Policy. > > > 1. Invite relevant reviewers. > > * Always invite the respective domain experts, not somebody convenient. > > Scrap the 'not somebody convenient'. It's the job of the reviewer to decide what he can approve. > it's the responsibility of both sides. don't pretend that these social dynamics don't exist. > Instead, mention how one can find the 'domain expert'. Something like > > * Domain experts can usually be found by inspecting the git log, and mailing lists. If in doubt also add the [https://wiki.qt.io/Maintainers Maintainer] of an area if there is one. > that's already listed in the contribution guidelines and i wanted to avoid excessive redundancy. i may reconsider, or move parts of the content. some more linking is necessary anyway. > > 2. Give reviewers ample time to respond. > > * Unless everyone who can be reasonably expected to have a relevant opinion to offer has already done so, a full working day waiting time is the absolute minimum; three days are reasonable. > > * In particular, give watchers (usually higher-level maintainers) enough time to voice concerns even if you did not explicitly invite them. > > The sub-points are only valid if you have a +2 already. So maybe move them down to a section ("If your change got approved"). Rather mention that it can take some working days until added people respond. > that's a good idea. a section about staging and re-staging is needed anyway. > > 3. Discuss objections. Do not override a -1 unless there is a broad expert consensus that the objection is unfounded. > > A Contributor cannot usually 'override' a -1 - that can only be done by an approver. Maybe your point is though that, if you got a +2, and somebody voiced objections, one shouldn't stage it? > every approver is a contributor by definition. ;) but i guess "disregard" is a better word than "override" in this case. > > 4. Do not ignore/fight the Early Warning System. Justify each override. > > [...] > > Isn't that limited to Approvers, too? > ... > > 5. Do not approve your own changes. > [...] > > Again that's limited to Approvers, > yes > and should be in the 'As a Reviewer' section. > no. it's addressing the contributor. From Kai.Koehne at qt.io Wed Jul 13 13:10:20 2016 From: Kai.Koehne at qt.io (Kai Koehne) Date: Wed, 13 Jul 2016 11:10:20 +0000 Subject: [Development] [Qt-creator] [FYI] commit/review policy refactored In-Reply-To: <20160713104851.GB22702@troll08> References: <20160713090807.GA15458@troll08> <20160713104851.GB22702@troll08> Message-ID: > -----Original Message----- > From: Qt-creator [mailto:qt-creator-bounces+kai.koehne=qt.io at qt- > project.org] On Behalf Of Oswald Buddenhagen > Sent: Wednesday, July 13, 2016 12:49 PM > To: development at qt-project.org; qt-creator at qt-project.org > Subject: Re: [Qt-creator] [Development] [FYI] commit/review policy > refactored > > On Wed, Jul 13, 2016 at 12:15:44PM +0200, Kai Köhne wrote: > > The page is obviously written from the viewpoint of a maintainer. I'd > > prefer to write It in a less intimidating way to the contributor, and > > make it helpful for first time, inexperienced contributors. > > > first-timers can ask in case of doubt. this is meant to be a policy, not an intro. If we'll have a separate intro page (which is linked from here), then fine with me :) > somewhat unsurprisingly, i finally took the effort to do this work because i > witnessed several unrelated violations in the last weeks/ months. That's what I suspected :) > > > As a Contributor > > > > Maybe link back to https://wiki.qt.io/Commit_Policy . > > > it's linked from the reviewer section, which i find more logical. Fair enough. > > "Make sure that your commit matches the Qt Commit Policy. > > > > > 1. Invite relevant reviewers. > > > * Always invite the respective domain experts, not somebody > convenient. > > > > Scrap the 'not somebody convenient'. It's the job of the reviewer to decide > what he can approve. > > > it's the responsibility of both sides. don't pretend that these social dynamics > don't exist. Well, in doubt the blame is always on the approver, not on the contributor. Also, it's perfectly fine to add 'convenient' people, be it only to check commit logs, or notify them about stuff. The point is just that they shouldn't approve it if they're not 'domain experts' - which is covered in the Approver's section. > > Instead, mention how one can find the 'domain expert'. Something like > > > > * Domain experts can usually be found by inspecting the git log, and > mailing lists. If in doubt also add the [https://wiki.qt.io/Maintainers > Maintainer] of an area if there is one. > > > that's already listed in the contribution guidelines and i wanted to avoid > excessive redundancy. i may reconsider, or move parts of the content. some > more linking is necessary anyway. Fine with me if there's another page that's linked. > > > 2. Give reviewers ample time to respond. > > > * Unless everyone who can be reasonably expected to have a relevant > opinion to offer has already done so, a full working day waiting time is the > absolute minimum; three days are reasonable. > > > * In particular, give watchers (usually higher-level maintainers) enough > time to voice concerns even if you did not explicitly invite them. > > > > The sub-points are only valid if you have a +2 already. So maybe move > them down to a section ("If your change got approved"). Rather mention > that it can take some working days until added people respond. > > > that's a good idea. a section about staging and re-staging is needed anyway. > > > > 3. Discuss objections. Do not override a -1 unless there is a broad expert > consensus that the objection is unfounded. > > > > A Contributor cannot usually 'override' a -1 - that can only be done by an > approver. Maybe your point is though that, if you got a +2, and somebody > voiced objections, one shouldn't stage it? > > > every approver is a contributor by definition. ;) Not every contributor is an approver though, so it makes IMO more sense to put stuff specific to approvers into the reviewers section. Or prefix them with "For contributors that are also approvers:". > but i guess "disregard" is a > better word than "override" in this case. Fine with me. I think 'consensus' instead of 'broad expert consensus' is enough too :) > > > 4. Do not ignore/fight the Early Warning System. Justify each override. > > > [...] > > > > Isn't that limited to Approvers, too? > > > ... > > > > 5. Do not approve your own changes. > > [...] > > > > Again that's limited to Approvers, > > > yes > > > and should be in the 'As a Reviewer' section. > > > no. it's addressing the contributor. A contributor that's also an approver, which is the minority. My point is: This text reads like a proverbial stick you want to use against fellows that overstep their limits (as you perceive it). I'm somewhat skeptical that putting down draconical rules somewhere on the wiki helps on this , but whatever. My fear is that this is rather read, and taken literally, by first-time/seldom contributors that already feel intimidated by the whole process in the first place ('can't I just append my patch to bugreports?'). So let's make it clear what they have to take care of, and what not. Regards Kai From jedrzej.nowacki at qt.io Wed Jul 13 13:39:19 2016 From: jedrzej.nowacki at qt.io (=?utf-8?B?SsSZZHJ6ZWo=?= Nowacki) Date: Wed, 13 Jul 2016 13:39:19 +0200 Subject: [Development] Source break policy for function overloads In-Reply-To: References: Message-ID: <163158774.0JonikA3mm@42> On Wednesday 13 of July 2016 10:44:13 Alexander Blasche wrote: > Hi, > > Yesterday, I stumbled over a break in QtSerialBus due to the addition of new > QTimer::setInterval(..) overloads in qtbase/dev. This was introduced by > > https://codereview.qt-project.org/#/c/160889/ > > Unfortunately this has the undesirable side effect that lines like: > > q->connect(q, &QModbusClient::timeoutChanged, element.timer.data(), > &QTimer::setInterval); > > do not compile anymore. The function pointer to setInterval() becomes > ambiguous. While the fix (https://codereview.qt-project.org/#/c/165034/) > was not difficult once you know what is happening this can hit every > customer and basically reduces the source compatibility promise into > absurdity. > > While talking to several devs in the office I could not find a congruent > opinion on this issue. Do we or even can we care? Do we have a policy? > > -- > Alex > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development Hi, We do not have SC promise only BC. We tend to not break SC without reason, for example we avoid juggling with header files just to "cleanup" stuff, but definitely we reserve right to add overloads and new functions. That is the current state, whatever it make sense or not is a different discussion. Cheers, Jędrek From Kai.Koehne at qt.io Wed Jul 13 13:55:32 2016 From: Kai.Koehne at qt.io (Kai Koehne) Date: Wed, 13 Jul 2016 11:55:32 +0000 Subject: [Development] Source break policy for function overloads In-Reply-To: <163158774.0JonikA3mm@42> References: <163158774.0JonikA3mm@42> Message-ID: > -----Original Message----- > From: Development [mailto:development-bounces+kai.koehne=qt.io at qt- > [...] > We do not have SC promise only BC. We tend to not break SC without > reason, for example we avoid juggling with header files just to "cleanup" > stuff, but definitely we reserve right to add overloads and new functions. > That is the current state, whatever it make sense or not is a different > discussion. We should fix https://wiki.qt.io/Qt-Version-Compatibility then. I agree though that we can't guarantee source compatibility in all cases (indirect includes are one example). We could establish a rule that methods marked with Q_SLOTS shouldn't be overloaded. Not that this would've helped, since QTimer::setInterval is not marked as a slot. Regards Kai From giuseppe.dangelo at kdab.com Wed Jul 13 14:15:44 2016 From: giuseppe.dangelo at kdab.com (Giuseppe D'Angelo) Date: Wed, 13 Jul 2016 14:15:44 +0200 Subject: [Development] Source break policy for function overloads In-Reply-To: References: Message-ID: <578630F0.4080108@kdab.com> Il 13/07/2016 12:44, Alexander Blasche ha scritto: > While talking to several devs in the office I could not find a congruent opinion on this issue. Do we or even can we care? Do we have a policy? While it would be nice not to add overloads to signals and slots, and we can keep an eye on that, the fact that you can connect to *any* function makes such a policy hard to enforce (unless we start introducing a weird naming policy for functions). Note that this has nothing to do with Qt, but it's a C++ language "feature" -- hence I would say that if you care about your source compatibility you should start using qOverload in your code base every time you take a pointer to a function. My 2 cents, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4007 bytes Desc: Firma crittografica S/MIME URL: From oswald.buddenhagen at qt.io Wed Jul 13 15:17:53 2016 From: oswald.buddenhagen at qt.io (Oswald Buddenhagen) Date: Wed, 13 Jul 2016 15:17:53 +0200 Subject: [Development] [Qt-creator] [FYI] commit/review policy refactored In-Reply-To: References: <20160713090807.GA15458@troll08> <20160713104851.GB22702@troll08> Message-ID: <20160713131753.GA10013@troll08> On Wed, Jul 13, 2016 at 01:10:20PM +0200, Kai Köhne wrote: > Oswald Buddenhagen wrote: > > On Wed, Jul 13, 2016 at 12:15:44PM +0200, Kai Köhne wrote: > > > "Make sure that your commit matches the Qt Commit Policy. > > > > > > > 1. Invite relevant reviewers. > > > > * Always invite the respective domain experts, not somebody convenient. > > > > > > Scrap the 'not somebody convenient'. It's the job of the reviewer to decide > > > what he can approve. > > > > > it's the responsibility of both sides. don't pretend that these social dynamics > > don't exist. > > Well, in doubt the blame is always on the approver, not on the contributor. > when the outcome is predictable, it doesn't matter who is technically responsible. by inviting a reviewer (in particular, just *one* reviewer) you're expressing an expectation. > Also, it's perfectly fine to add 'convenient' people, be it only to > check commit logs, or notify them about stuff. > then you're not inviting them to an actual review, and you're expected to state that, and disregard their approval in case they still give it. > > every approver is a contributor by definition. ;) > > Not every contributor is an approver though, so it makes IMO more sense to put stuff specific to approvers into the reviewers section. > > Or prefix them with "For contributors that are also approvers:". > you're mixing things up. this is about the roles in any given contribution, not about the titles anyone may hold. this is indicated by the use of definite articles in the section headers (apart from the fact that "reviewer" is no defined title in the first place). > I think 'consensus' instead of 'broad expert consensus' is enough too :) > the point was about clarifying that the opinion of one actual expert weights more than half a dozen me-too's from non-experts. > My point is: This text reads like a proverbial stick you want to use > against fellows that overstep their limits (as you perceive it). > that's exactly the point of anything that calls itself a policy. otherwise it would be a convention. > I'm somewhat skeptical that putting down draconical rules somewhere on > the wiki helps on this , but whatever. > no, but it helps when it's written down clearly and the majority gives the impression of expecting that these rules are followed. given that this page just codifies the usual practice of the last five years, it seems reasonable to think that this is the case. From Simon.Hausmann at qt.io Wed Jul 13 15:55:20 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Wed, 13 Jul 2016 13:55:20 +0000 Subject: [Development] Source break policy for function overloads In-Reply-To: <163158774.0JonikA3mm@42> References: , <163158774.0JonikA3mm@42> Message-ID: Hi, I think in the interest of our users and the popularity of Qt, the maintenance of source compatibility should be a supremely important goal. That said, breakages of source compatibility for the sake of cleanups appear to have been accepted by approvers in the past. I think if we allow source compatibility breakages like the one here (overloaded slot added), then I think it should require a prominent notice in the changelog / release notes. One can argue that with includes it's pretty easy to "fix" the error, but with the QObject::connect error on ambiguous overloads the error messages are crap and I think we should make an effort help our users. Simon ________________________________ From: Development on behalf of Jędrzej Nowacki Sent: Wednesday, July 13, 2016 1:39:19 PM To: development at qt-project.org Subject: Re: [Development] Source break policy for function overloads On Wednesday 13 of July 2016 10:44:13 Alexander Blasche wrote: > Hi, > > Yesterday, I stumbled over a break in QtSerialBus due to the addition of new > QTimer::setInterval(..) overloads in qtbase/dev. This was introduced by > > https://codereview.qt-project.org/#/c/160889/ > > Unfortunately this has the undesirable side effect that lines like: > > q->connect(q, &QModbusClient::timeoutChanged, element.timer.data(), > &QTimer::setInterval); > > do not compile anymore. The function pointer to setInterval() becomes > ambiguous. While the fix (https://codereview.qt-project.org/#/c/165034/) > was not difficult once you know what is happening this can hit every > customer and basically reduces the source compatibility promise into > absurdity. > > While talking to several devs in the office I could not find a congruent > opinion on this issue. Do we or even can we care? Do we have a policy? > > -- > Alex > _______________________________________________ > Development mailing list > Development at qt-project.org > http://lists.qt-project.org/mailman/listinfo/development Hi, We do not have SC promise only BC. We tend to not break SC without reason, for example we avoid juggling with header files just to "cleanup" stuff, but definitely we reserve right to add overloads and new functions. That is the current state, whatever it make sense or not is a different discussion. Cheers, Jędrek _______________________________________________ Development mailing list Development at qt-project.org http://lists.qt-project.org/mailman/listinfo/development -------------- next part -------------- An HTML attachment was scrubbed... URL: From giuseppe.dangelo at kdab.com Wed Jul 13 16:16:39 2016 From: giuseppe.dangelo at kdab.com (Giuseppe D'Angelo) Date: Wed, 13 Jul 2016 16:16:39 +0200 Subject: [Development] Source break policy for function overloads In-Reply-To: References: <163158774.0JonikA3mm@42> Message-ID: <57864D47.1010506@kdab.com> Il 13/07/2016 15:55, Simon Hausmann ha scritto: > > I think if we allow source compatibility breakages like the one here > (overloaded slot added), then I think > > it should require a prominent notice in the changelog / release notes. Note that setInterval is not even a slot (but an overload of start(), a slot, was also added in the same commit). Do we need to add changelog notes for *any* overload added to free functions or QObject subclass member functions? Cheers, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4007 bytes Desc: Firma crittografica S/MIME URL: From Simon.Hausmann at qt.io Wed Jul 13 16:30:52 2016 From: Simon.Hausmann at qt.io (Simon Hausmann) Date: Wed, 13 Jul 2016 14:30:52 +0000 Subject: [Development] Source break policy for function overloads In-Reply-To: <57864D47.1010506@kdab.com> References: <163158774.0JonikA3mm@42> , <57864D47.1010506@kdab.com> Message-ID: Hi, I suppose that if this is the first time an overload is added, then the risk of ambiguity exists. It seems that this is the case here. If released API has overloads and a new overload is added, then the caller code using QObject::connect would already use qOverload or similar, right? In that case perhaps it is not necessary to document the addition as source compatibility may be preserved. It all comes down to the question: What impression do we want to give people when they upgrade to a newer version of Qt? Simon ________________________________ From: Development on behalf of Giuseppe D'Angelo Sent: Wednesday, July 13, 2016 4:16:39 PM To: development at qt-project.org Subject: Re: [Development] Source break policy for function overloads Il 13/07/2016 15:55, Simon Hausmann ha scritto: > > I think if we allow source compatibility breakages like the one here > (overloaded slot added), then I think > > it should require a prominent notice in the changelog / release notes. Note that setInterval is not even a slot (but an overload of start(), a slot, was also added in the same commit). Do we need to add changelog notes for *any* overload added to free functions or QObject subclass member functions? Cheers, -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts -------------- next part -------------- An HTML attachment was scrubbed... URL: From ola at silentwings.no Wed Jul 13 16:45:05 2016 From: ola at silentwings.no (=?UTF-8?Q?Ola_R=C3=B8er_Thorsen?=) Date: Wed, 13 Jul 2016 16:45:05 +0200 Subject: [Development] Source break policy for function overloads In-Reply-To: References: <163158774.0JonikA3mm@42> <57864D47.1010506@kdab.com> Message-ID: 2016-07-13 16:30 GMT+02:00 Simon Hausmann : > > It all comes down to the question: What impression do we want to give > people when they upgrade to > > a newer version of Qt? > > > In my experience, I first had problems with this when I converted to the new "connect" syntax some years ago and hit the overloaded "error" functions in QAbstractSocket where just one of them is a signal. It cost me quite some time figuring out how to solve that, ending with getting help on the interest mailing list. If qOverload would have existed back then, I would not have known that I should or could use that either. So if similar problems appear when upgrading Qt because of added functionality it will cost developers a lot of time. The compiler error will probably not point to a suggested solution like "use qOverload" or "use static_cast(&QTcpSocket::error)" instead. In my opinion, please try to avoid these overloads as much as possible. Cheers, Ola -------------- next part -------------- An HTML attachment was scrubbed... URL: From sschilz at pasco.com Wed Jul 13 18:08:11 2016 From: sschilz at pasco.com (Steve Schilz) Date: Wed, 13 Jul 2016 16:08:11 +0000 Subject: [Development] QWebEngine - H.264 playback, proprietary codecs. Message-ID: <6CAA1D13-1848-483C-84EA-857BE73C7CDF@pasco.com> We are using QWebEngine to drive a hybrid app (Html5 + Javascript + C++) on windows. According to QWebEngineFeatures Doc, http://doc.qt.io/qt-5/qtwebengine-features.html#pepper-plugin-api You must pass a flag to qmake, WEBENGINE_CONFIG+=use_proprietary_codecs, and build Qt from source yourself in order to support h.264 video decoding. In researching this, I became aware that Cisco provides a downloadable binary codec, where Cisco pays the MPEG-LA royalties. Apparently this is the method used To provide h.264 playback in Firefox. If you watch the intellectual property rights video at http://vimeo.com/cullenfluffyjennings/openh264-ipr, they explain why they Did this, and how you can even make changes to the codec via open source if needed. Would it make sense for QWebEngine to support this codec, in order to be able to provide ‘out of the box’ (via download at end user’s computer), support for h.264 playback in