Re: [Interest] sharing singleton instance between C++ and QML

2023-10-28 Thread Constantin Makshin
Hi Ulf. MOC is fine, it's the Q_GADGET macro: #define Q_GADGET_EXPORT(...) \ public: \ static __VA_ARGS__ const QMetaObject staticMetaObject; \ void qt_check_for_QGADGET_macro(); \ typedef void QtGadgetHelper; \ private: \ QT_WARNING_PUSH \ Q_OBJECT_NO_ATTRIBUTES_WARNING \

Re: [Interest] how do I load massive table views instantly?

2020-06-10 Thread Constantin Makshin
>> 1) quickly calculate/get the total number of items and return that value >> from rowCount() to let views properly configure their scroll bars; > is that a method one overrides? where is "rowCount()" defined? > do i override it by subclassing QSortFilterProxyModel? Yes, it's one of the pure virt

Re: [Interest] how do I load massive table views instantly?

2020-06-04 Thread Constantin Makshin
Here is my idea: 1) quickly calculate/get the total number of items and return that value from rowCount() to let views properly configure their scroll bars; 2) load data in the background; 3) return some placeholder values from data() for items that have not been loaded yet; 4) when a new batch o

Re: [Interest] Building strings with .arg() (arrrgh)

2020-03-05 Thread Constantin Makshin
Every `arg(numeric_value)` overload uses a temporary `QString` object to build a text representation of `numeric_value` needed by the actual placeholder-replacement function. Even `arg(QChar)` and `arg(char)` create single-character `QString`s and pass them to either `arg(const QString&)` or `a

Re: [Interest] Strange unexplainable RCC error

2019-05-26 Thread Constantin Makshin
https://doc.qt.io/qt-5/resources.html The resource files listed in the .qrc file are files that are part of the application's source tree. *The specified paths are relative to the directory containing the .qrc file.* Note that the listed resource files must be located in the same directory as th

Re: [Interest] Stack trace on Windows

2019-04-02 Thread Constantin Makshin
A small registry tweak will make Windows write dump file each time your application crashes. https://docs.microsoft.com/en-us/windows/desktop/wer/collecting-user-mode-dumps On 04/02/2019 08:39 PM, Boris Ralchenko wrote: > Hello, > > Question to Windows gurus - what is the best way to get stack

Re: [Interest] tst_qatomicinteger build failure (5.9 i386/x86_64)

2017-09-01 Thread Constantin Makshin
Hi Christian. May be changing template class QBasicAtomicInteger in "src/corelib/thread/qbasicatomic.h" to template class Q_DECL_ALIGN(Q_ALIGNOF(typename QAtomicOps::Type)) QBasicAtomicInteger will fix the problem. On 09/01/2017 11:10 AM, Christian Gagneraud wrote: > On 1 September 2017 at

Re: [Interest] QtCreator & CMake

2017-05-16 Thread Constantin Makshin
Hi Igor. VCTIP is "Microsoft® VC compiler and tools experience improvement data uploader", telemetry collection tool built into Visual C++. On 05/15/2017 11:26 AM, Igor Mironchik wrote: > Hello, > > When I open CMake project with QtCreator I can see build directory in my > sources tree... > > p

Re: [Interest] Support for Visual Studio 2017

2017-02-25 Thread Constantin Makshin
17-fea... where I > mentioned WCFB02." > > Tom Isaacson > > > -Original Message- > From: Interest > [mailto:interest-bounces+tom.isaacson=navico@qt-project.org] On Behalf Of > Constantin Makshin > Sent: Saturday, 25 February 2017 00:22 > To: Q

Re: [Interest] Support for Visual Studio 2017

2017-02-24 Thread Constantin Makshin
Still looks somewhat risky to me. Unless VS2017 uses C++ standard library implementation from VS2015's "msvcp140.dll", of course. On 02/24/2017 12:44 PM, Tom Isaacson wrote: > I had the prebuilt VS2015 libraries downloaded and installed and I was able > to rebuild and run our app in VS2017. I did

Re: [Interest] using QSetting when host application is using it as well

2017-02-04 Thread Constantin Makshin
nt so QStandardPaths is not > available, but I could use QDesktopServices instead, e.g.: > > QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.HomeLocation) > > > What would be the difference to os.path.expanduser('~') though? > > Cheers, > frank >

Re: [Interest] using QSetting when host application is using it as well

2017-02-01 Thread Constantin Makshin
Hi Frank. Looks like the host application uses QSettings::setPath() (http://doc.qt.io/qt-5/qsettings.html#setPath) to enforce a specific directory for configuration files. Calling that method from your code is obviously a bad idea (high risk of screwing up the host application), so your "fallback"

Re: [Interest] Qt, openssl and redistribution (of binary packages)

2017-01-23 Thread Constantin Makshin
On 01/23/2017 01:12 PM, René J. V. Bertin wrote: > Constantin Makshin wrote: > > Thank you Constantin, > >> Qt can be redistributed under the terms of LGPL which allows linking >> against everything so there are no license-related issues in linking Qt >> and OpenSS

Re: [Interest] Qt, openssl and redistribution (of binary packages)

2017-01-22 Thread Constantin Makshin
Hi René. Qt can be redistributed under the terms of LGPL which allows linking against everything so there are no license-related issues in linking Qt and OpenSSL. AFAIK the primary (if not the only one) reason against linking to libraries like OpenSSL is that redistribution of cryptographic softwa

Re: [Interest] Are slots even needed these days?

2016-03-18 Thread Constantin Makshin
ço de 2016 08:23:48 PDT Constantin Makshin wrote: > > Another thing I personally don't like in the new connection syntax is > > that it forces signals to be public, making it possible to do all type > > of wonders by faking/simulating events on behalf of other objects. > > >

Re: [Interest] Are slots even needed these days?

2016-03-18 Thread Constantin Makshin
Another thing I personally don't like in the new connection syntax is that it forces signals to be public, making it possible to do all type of wonders by faking/simulating events on behalf of other objects. For example: QLineEdit* edit = new QLineEdit("foo"); // ... edit->textChanged("bar"); On

Re: [Interest] emulate windows 10 behaviour on a QT window

2015-11-10 Thread Constantin Makshin
I don't think you can do much more than maximizing your window when its Y coordinate becomes less than a certain [small] value. On 11/11/2015 12:57 AM, Nicolas Jäger wrote: > Hi, > I have to use QT5 on windows 10 (both are not my choice...), I wrote an ui > with QT, I have a > borderless window a

Re: [Interest] A QThread question...

2015-10-21 Thread Constantin Makshin
The idea to run different portions of the same process as different users not only looks weird, but is also [very] bad from security point of view — no matter how many threads you create, they still run in the same address space so nothing will stop one user-thread from accidentally or intentionall

Re: [Interest] Qtcontainerbench std::vector vs QVector

2015-07-27 Thread Constantin Makshin
On 07/27/2015 10:42 PM, Gunnar Roth wrote: > Hi Constantin. > Thank you for looking at my benchmark. > >> Am 24.07.2015 um 08:57 schrieb Constantin Makshin : >> >> Well, after looking at the code I can say that the was you wrote this >> benchmark "abuses

Re: [Interest] Qtcontainerbench std::vector vs QVector

2015-07-23 Thread Constantin Makshin
ck 10097 96 - On 07/23/2015 08:51 AM, Gunnar Roth wrote: > >> Am 23.07.2015 um 07:00 schrieb Constantin Makshin : >> >> "vector" branch is identical to "master“. > Not a

Re: [Interest] Qtcontainerbench std::vector vs QVector

2015-07-22 Thread Constantin Makshin
"vector" branch is identical to "master". On 07/22/2015 10:20 PM, Gunnar Roth wrote: > Hi, > for whom it may concern i post my results for vector iterating using > iterator and index plus insert via push_back. > > the test code is at https://github.com/gunrot/qtcontainerbench in > branch vector.

Re: [Interest] QProgressBar::reset... when it doesn't

2015-05-19 Thread Constantin Makshin
Doesn't look like a bug to me. The description of QProgressBar::reset() says: > The progress bar "rewinds" and shows no progress. Indeterminate progress bars have no progress/value by definition so there's nothing to reset. I admit that setting a non-zero range just to "disable" a progress bar loo

Re: [Interest] XML schema validation alternatives?

2015-05-11 Thread Constantin Makshin
libxml (http://xmlsoft.org/, MIT license) is a relatively popular library which supports both DTD (http://xmlsoft.org/html/libxml-valid.html) and schema (http://xmlsoft.org/html/libxml-xmlschemas.html#xmlSchemaNewValidCtxt) validation. On 05/11/2015 10:49 PM, Murphy, Sean wrote: > I was trying to

Re: [Interest] The calling thread must be STA, because many UI components require this.

2015-04-02 Thread Constantin Makshin
To set the thread as STA, initialize COM by calling either CoInitialize(nullptr) or CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) But remember at least two things: 1) only the first call to CoInitialize[Ex]() matters — all subsequent ones will fail unless they're told to set the same apartment

Re: [Interest] Is chaining of multiple SQL statements with bound values possible?

2015-03-16 Thread Constantin Makshin
Are you sure the backend supports preparing of combined statements? If it does, then the best way to find the source of the problem would be running your program under the debugger and stepping into QtSql internals. On Mar 16, 2015 6:05 PM, "Guido Seifert" wrote: > Hi, > my problem: > > When I co

Re: [Interest] Does removing 'private slots' from .h files have any advantages? Disadvantages?

2015-03-08 Thread Constantin Makshin
Both advantages and disadvantages will come from the fact that MOC won't generate anything for methods in these sections. Pros: 1) less code and data -> smaller executable; 2) less code -> faster compilation; 3) smaller "MOC table" -> faster lookups when connecting and/or processing signals. Cons

Re: [Interest] Q_OS_ANDROID macro

2015-02-04 Thread Constantin Makshin
A bit ugly but simple solution is to remove that #ifndef from the header file and put it to slot method definitions, i.e.: // header file public slots: void recordAdded(const BonjourRecord &record); void recordRemoved(const BonjourRecord &record); void bonjourRecordResolved(const QHost

Re: [Interest] Qt container size()

2015-01-29 Thread Constantin Makshin
IMHO QByteArray is a much better candidate for that "position". On 01/30/2015 01:25 AM, André Pönitz wrote: > I would be willing to make an exception for QVector (and only that), > this could, or even should, be a lightweight "fullsize" container. > The portability reason carry less weight in this

Re: [Interest] QBuffer::seek warnings in QtConcurrent

2015-01-27 Thread Constantin Makshin
Nice finding, Guiseppe. :) You're right that this may be unrelated to Igor's problem, but lines 811–813 look like a nice bait for JPEG images with malformed EXIF header[s] — values less than 8 will wrap around zero, leading to an attempt to skip unknown amount of data (QDataStream::skipRawData() t

Re: [Interest] How can I use QPointer as an argument?

2015-01-12 Thread Constantin Makshin
QPointer is a template class and therefore can't be used by itself, i.e. without specifying the template parameter. In your case you should either: 1) specify a particular QObject-related class in the declaration/definition of myFunction(), e.g. void myFunction (QPointer* myPointer) {

Re: [Interest] Compilation error with QtConcurrent::run

2014-12-10 Thread Constantin Makshin
I don't think the documentation on QtConcurrent::run() needs to be changed because this problem is not related/specific to Qt. On Dec 10, 2014 8:35 PM, "Juan Navarro" wrote: > I did it creating a typedef for the needed method: > > typedef bool (QImage::*QImageSaveFn)(const QString&, const char*,

Re: [Interest] Qt5 and "global" configuration

2014-11-14 Thread Constantin Makshin
Probably lack of similar problems with my screens (both notebook and desktop) made me over-optimistic. :) On 11/14/2014 03:20 PM, Stanislav Baiduzhyi wrote: > On Friday 14 November 2014 15:10:05 Constantin Makshin wrote: >> On 11/14/2014 02:41 PM, Stanislav Baiduzhyi wrote: >>

Re: [Interest] Qt5 and "global" configuration

2014-11-14 Thread Constantin Makshin
On 11/14/2014 02:41 PM, Stanislav Baiduzhyi wrote: > - when you're using some brand new laptop your physical screen dimension may > not be present in X db yet, which means that X just takes your screen > resolution, assumes 96dpi and calculates physical dimensions based on that, > which usually

Re: [Interest] Threading Question

2014-10-11 Thread Constantin Makshin
ther thread because of > this reason. > > > > On Thu, Oct 9, 2014 at 8:01 AM, Constantin Makshin <mailto:cmaks...@gmail.com>> wrote: > > The description of QObject::moveToThread() says the whole object's > "subtree" is moved, so th

Re: [Interest] Threading Question

2014-10-09 Thread Constantin Makshin
The description of QObject::moveToThread() says the whole object's "subtree" is moved, so that hypothesis doesn't sound very plausible. On Oct 9, 2014 3:06 PM, "Jason Kretzer" wrote: > Ack! You are correct. > > I guess I would do something like this to remedy that: > > in the main: > BackgroundT

Re: [Interest] Threading Question

2014-10-08 Thread Constantin Makshin
Two suggestions: 1) add qDebug-s around the "emit someSignal();" line to see whether it returns or not, hanging somewhere in validateResult(); 2) try to explicitly specify the Qt::QueuedConnection type for the someSignal() connection — if it helps, then the [most likely] cause is Qt choosing wrong

Re: [Interest] QTableView, readonly and selectable column text/data?

2014-08-15 Thread Constantin Makshin
On Aug 15, 2014 4:52 PM, "Mark Gaiser" wrote: > In my case i simply make a QLineEdit and set readOnly to false. Wasn't the last part of the sentence supposed to be "set readOnly to true"? :) ___ Interest mailing list Interest@qt-project.org http://lists.

Re: [Interest] how to properly close a SQLite database?

2014-06-24 Thread Constantin Makshin
QSqlDatabase::close() closes the database backend connection but leaves QtSql one intact, i.e. even after close() your QSqlDatabase object occupies its slot in the [global] list of existing database objects. So in order to let QSqlDatabase::removeDatabase() do its job you have to destroy all QSqlDa

Re: [Interest] [ANN] libstudxml - modern XML API for C++

2014-05-21 Thread Constantin Makshin
Hello, Boris. I took a look at the API guide and here are my thoughts. Compatibility of the low-level parser with range-based for loop and semi-automatic type conversion are nice features, but: 1) your words about libstudxml being free from external dependencies contradict with the fact that actu

Re: [Interest] qApp macro equivalent for QApplication subclasses

2014-03-20 Thread Constantin Makshin
I don't see anything bad even in redefining the "qApp" macro itself (inclusion guards in Qt headers will protect your redefinition from being reverted) instead of inventing your "myApp" one. On 03/20/2014 10:58 PM, Andrej Kacian wrote: > Hello all, > > I was wondering, if I subclass QApplication

Re: [Interest] Process started with QProcess::startDetached is still a child, and is killed when parent quits

2014-03-06 Thread Constantin Makshin
IMHO it makes [some] sense for the debugger to kill all processes created by the one being debugged — that gives some guarantee that repeated debugging sessions won't cause uncontrollable growth of number of running processes, the debugged application won't meet locks or other resource sharing prob

Re: [Interest] PDF to QByteArray

2014-02-27 Thread Constantin Makshin
If you want to test sending en email, send it an check what happens. Or, at least, print the final (i.e. with all encoding and other things being done, exactly what you'd send to an SMTP server) message. Don't try to print a PDF file contents "as is" — it's not a 100% text-based format and may cont

Re: [Interest] DPI

2014-02-23 Thread Constantin Makshin
I'd say there's no 100% reliable cross-platform solution and Qt can't do anything about it — the screen itself may return incorrect information about its physical size, OS may somehow misinterpret that information or simply fake it by reversing the calculations (i.e. calculate physical size by mult

Re: [Interest] Compile Speed Question regarding MOC

2014-02-18 Thread Constantin Makshin
Look at the problem from the other side: 1) separate "moc_*.cpp" has to be compiled only during full [re]builds or when the corresponding class' header file is changed; 2) when "moc_*.cpp" is #include-d into the implementation .cpp file, they are both compiled at every change. I think it's pretty

Re: [Interest] Qt 5.2 winextras - QWinJumpList

2014-02-10 Thread Constantin Makshin
I found two functions used in QWinJumpList which, according to MSDN, was introduced in Windows XP SP2. Dependency Walker (http://www.dependencywalker.com) might help you pinpoint the source of the problem. On 02/11/2014 07:56 AM, Constantin Makshin wrote: > I looked at the QWinTaskbarBut

Re: [Interest] Qt 5.2 winextras - QWinJumpList

2014-02-10 Thread Constantin Makshin
I looked at the QWinTaskbarButton source code (QWinTaskbarProgress is just a convenience class that delegates all interaction with the OS to QWinTaskbarButton) and didn't find anything suspicious, the only "importable" function it uses is definitely available in XP. So my guess is that the incompa

Re: [Interest] QMake generation config file from variables in .pro file

2014-01-29 Thread Constantin Makshin
I wonder why such useful feature is left undocumented... On 01/30/2014 01:27 AM, Guido Seifert wrote: > Wow, have to try this immediately. If this works it would be much better > than what I concocted. :-) > > Guido > >> Hi, >> >> actually this is possible with qmake. >> If you have a file named

Re: [Interest] Integrating with WPF through ANGLE's IDirect3DSurface9

2014-01-25 Thread Constantin Makshin
end being either DX9 or DX11 though, but at > least when using ANGLE directly I think you can choose which backend you > want to use. Not sure if/how that is exposed through Qt or the EGL APIs > though. > > - Thomas > > > On Sat, Jan 25, 2014 at 2:01 AM, Constantin Mak

Re: [Interest] Integrating with WPF through ANGLE's IDirect3DSurface9

2014-01-24 Thread Constantin Makshin
Ah, ignore my previous message, I misunderstood the original question (really shouldn't be wandering around the Internet at ~5AM :) ). Function eglQuerySurfacePointerANGLE() from ANGLE's EGL extension " EGL_ANGLE_query_surface_pointer" may be what you're looking for. On Jan 24, 2014 8:57 PM, "Thom

Re: [Interest] Integrating with WPF through ANGLE's IDirect3DSurface9

2014-01-24 Thread Constantin Makshin
No, ANGLE doesn't expose its Direct3D device. Moreover, ANGLE supports Direct3D 11 so it doesn't seem to be a very good idea to make any assumptions about presence of a D3D9 device. On Jan 24, 2014 8:57 PM, "Thomas Sevaldrud" wrote: > Hello, > > I know that what I'm about to ask is somewhat of a

Re: [Interest] QtThread

2014-01-21 Thread Constantin Makshin
There's no real need to use debug version of Qt if you don't want to debug Qt itself, so in most cases the programmer won't see that warning. On Jan 21, 2014 5:08 PM, wrote: > Le Mon, 20 Jan 2014 08:32:28 -0800, Thiago Macieira > écrivait: > > >I'd rather not add a check for things you shouldn'

Re: [Interest] whether a color image can SAFELY be converted to a grayscale image

2014-01-14 Thread Constantin Makshin
It means "without losing any [color] information". On Jan 14, 2014 3:59 PM, "iMath" <2281570...@qq.com> wrote: > In the Image Formats part of QImage doc says > " > The allGray() and isGrayscale() functions tell whether a color image can > safely be converted to a grayscale image. > " > what does "

Re: [Interest] Question about reading glsl shader source from a QResource using compression

2014-01-13 Thread Constantin Makshin
Presence and level of resource compression depends on command line parameters passed to the resource compiler. IIRC compression is disabled by default so all resources are stored "as is" unless you explicitly tell the resource compiler to compress them and correct way of retrieving resource data de

Re: [Interest] Create the main widget on heap in main()

2014-01-11 Thread Constantin Makshin
" wrote: > Am 11.01.2014 um 13:30 schrieb Etienne Sandré-Chardonnal < > etienne.san...@m4x.org>: > > 2014/1/11 Constantin Makshin > >> True, but why would one need a parented object in main()? :-) >> > > True, but an object that should be deleted at

Re: [Interest] Create the main widget on heap in main()

2014-01-11 Thread Constantin Makshin
True, but why would one need a parented object in main()? :-) On Jan 11, 2014 3:13 PM, "Etienne Sandré-Chardonnal" wrote: > QObjects with a parent should never be allocated on stack (otherwise, you > delete them twice) > > > 2014/1/11 Constantin Makshin > >>

Re: [Interest] Create the main widget on heap in main()

2014-01-11 Thread Constantin Makshin
Saving some stack space may make sense on mobile platforms, but in general yes, creating objects on the heap in main() is pretty much the same thing as creating them on the stack. On Jan 11, 2014 2:02 PM, "Alejandro Exojo" wrote: > El Saturday 11 January 2014, 程梁 escribió: > > Yes, I tought there

Re: [Interest] 回复: Does isGrayscale() can tell whether a color imagecan safely be converted to a grayscale image?

2014-01-11 Thread Constantin Makshin
"they could be used to tell whether a color > image can safely be converted to a grayscale image." > > > -- 原始邮件 -- > *发件人:* "Constantin Makshin";; > *发送时间:* 2014年1月11日(星期六) 下午5:27 > *收件人:* "Qt Interest"; >

Re: [Interest] Does isGrayscale() can tell whether a color image can safely be converted to a grayscale image?

2014-01-11 Thread Constantin Makshin
My opinion is that there's no need for those methods descriptions to duplicate information already provided in the class documentation. On Jan 11, 2014 12:27 PM, "iMath" <2281570...@qq.com> wrote: > In the Image Formats part of QImage doc says > " > The allGray() and isGrayscale() functions tell w

Re: [Interest] C'tor member initialisation with 'this'

2014-01-10 Thread Constantin Makshin
s the object's destructor gets called when a pointer to it is destroyed by going out of scope or any other means. On Jan 10, 2014 9:42 PM, "Frank Hemer" wrote: > On Friday 10 January 2014 20:51:35 Constantin Makshin wrote: > > Everything is OK unless QNetworkAccessManager&#

Re: [Interest] C'tor member initialisation with 'this'

2014-01-10 Thread Constantin Makshin
Everything is OK unless QNetworkAccessManager's constructor (or anything further in the call chain) tries to use that pointer for anything beyond copying it somewhere else. What exactly is looking suspicious to you? On Jan 10, 2014 5:32 PM, "Frank Hemer" wrote: > Hi, > > when looking at the code

Re: [Interest] QProgressDialog

2013-12-31 Thread Constantin Makshin
That behavior looks reasonable to me -- the dialog must tell the system to redraw it, but doing that with an unchanged dialog would be waste of time. And obviously one can't change value of an indeterminate progress bar/dialog as it doesn't have any value at all. :-) Also the case when both minimu

Re: [Interest] Something funny. QAccelerometer

2013-12-19 Thread Constantin Makshin
AFAIR, simulator's primary (available out of the box at least) "pseudo environments" were Symbian and Maemo 5. With both systems being in zombie state even at the time of Qt ownership transfer, there's a chance that Nokia didn't see any benefits in keeping the project and decided not to give it to

Re: [Interest] Storing complex SQL relations with Qt

2013-12-12 Thread Constantin Makshin
Usually if you don't explicitly ask for a transaction, RDBMS creates an implicit one for each statement. AFAIK, SQLite uses this idea too. And the next to last paragraph at http://www.sqlite.org/autoinc.html gives an impression that uniqueness of values in AUTOINCREMENT columns isn't affected by t

Re: [Interest] Best practice for sorting multiple (connected) QLists

2013-11-19 Thread Constantin Makshin
Another advantages of this approach are more efficient memory utilisation (less storage and [re]allocation overhead) somewhat better cache locality because all fields related to a particular person will be close to each other in memory instead of being spread all over the place ("somewhat better" b

Re: [Interest] Why are QUuid saved as blobs and not strings in QSqlite driver?

2013-11-11 Thread Constantin Makshin
Probably because binary representation is more space-efficient. On Nov 12, 2013 11:32 AM, "Philipp Kursawe" wrote: > Is there a reason why UUIDs are not saved using toRfc4122().toLatin1() in > the database? > > ___ > Interest mailing list > Interest@qt-

Re: [Interest] correct d_ptr implementation

2013-11-11 Thread Constantin Makshin
point of either. > There is no need for a private constructor or assignment operator then, > as nobody can access them anyway, right? > > If you want to allow subclassing the private part (like Qt does), then I > guess you're right. But IMHO that means that the d_ptr isn't real

Re: [Interest] correct d_ptr implementation

2013-11-11 Thread Constantin Makshin
pport "= delete" from C++11, placing an intentionally-unimplemented constructor[s] and/or assignment operator into the private section is the most common way to mark them as unavailable. On 11/11/2013 10:22 PM, an...@familiesomers.nl wrote: > Constantin Makshin schreef op 11.11.201

Re: [Interest] correct d_ptr implementation

2013-11-11 Thread Constantin Makshin
1) put your 'd_ptr' into a smart pointer of some kind (usually QScopedPointer), your example leaks memory; 2) placing 'q_ptr' in the public section doesn't make much sense because it's supposed to be used only by the DisplayWidgetPrivate instance to access its "owner" (DisplayWidget doesn't need an

Re: [Interest] Network configuration from qt under linux

2013-11-09 Thread Constantin Makshin
You (your application) can edit "/etc/network/interfaces" directly, its syntax is fairly simple. On Nov 10, 2013 1:27 AM, "Simone" wrote: > Hello, > We developed an application that need to configure all the network > configurations from our GUI. > We must let the end user be able to configure th

Re: [Interest] Qt 5.1.1 SQLite blocks database

2013-10-30 Thread Constantin Makshin
Obviously, that would mean losing all benefits of QtSql in the form of a RDBMS-neutral API and, as a consequence, [relatively] easy migration between backends. To Martin: Are you sure the problem is caused by changes in Qt and not SQLite? Comparing "src/sql/drivers/sqlite/qsql_sqlite.cpp" on Gitor

Re: [Interest] "QDataStream::version()" -- safe to assume 8-bit?

2013-10-26 Thread Constantin Makshin
Since QDataStream versions form a contiguous sequence of integer numbers and new ones are added in [some] minor Qt updates, I'd say you have a LOT of time before these numbers stop fitting into 7-8 bits. As for the magic number issue, you may store it *after* the stream version number -- if the ve

Re: [Interest] Install both Qt5 and Qt4.7 at one Ubuntu

2013-10-07 Thread Constantin Makshin
There shouldn't be any problems unless Ubuntu staff broke something (I have both 4.8 and 5.x in Debian). On Oct 7, 2013 1:51 PM, "Николай Шатохин" wrote: > > Hello. > > I need Qt4.7 for developing apps for embedded systems and Qt5 for desktop apps. Is it possible to install it both in Ubuntu 13.04

Re: [Interest] QTemporaryFile::open(OpenMode flags) is protected, but not in documentation

2013-09-26 Thread Constantin Makshin
It's used exactly for that purpose -- storing large amounts of temporary data which doesn't need super-low access times (so there's no need to waste RAM). You can do whatever you like with that data, just don't close the file. And, to be honest, I don't see any [good] reason to close a temporary fi

Re: [Interest] QTemporaryFile::open(OpenMode flags) is protected, but not in documentation

2013-09-25 Thread Constantin Makshin
According to the Qt 4.8 source code on Gitorious, closing QTemporaryFile just sets the read-write pointer to the beginning of the file and [re]opening it enforces QIODevice::ReadWrite mode (line 82 of "src/corelib/io/qtemporaryfile.h" and line 318 of "src/corelib/io/qtemporaryfile.cpp") which doesn

Re: [Interest] QTemporaryFile::open(OpenMode flags) is protected, but not in documentation

2013-09-25 Thread Constantin Makshin
QTemporaryFile alays opens in read-write mode and, as it was explained on this list some time ago, is not actually closed until the object is destroyed ([primarily] for security reasons). On Sep 26, 2013 12:32 AM, "Etienne Sandré-Chardonnal" < etienne.san...@m4x.org> wrote: > In Qt 4.8.1, QTempora

Re: [Interest] how render a qgraphicsscene to svg and paste it to the clipboard

2013-09-14 Thread Constantin Makshin
Use a QByteArray as the output device for QSvgGenerator and copy it to the clipboard using QClipboard::setMimeData(). On 09/14/2013 10:12 AM, helfertho...@free.fr wrote: > Hi, > > I am using the qgraphicsview/qgraphicscene framework. I am able to write file > from the drawn scene to multiple fil

Re: [Interest] Byte Swapping float and double

2013-09-07 Thread Constantin Makshin
In this case such casting must be done only through pointers, otherwise you'll just round the floating point number to some (direction dependens on the system and its configuration) integer. On Sep 8, 2013 12:22 AM, "Ilya Diallo" wrote: > Casting to qint32/qin64 (twice for 128 bits floats) and th

Re: [Interest] QTcpServer stop accepting connections

2013-09-05 Thread Constantin Makshin
Probably it's some kind of client-side protection from DoS-ing a web server by occupying all its network sockets. On Sep 5, 2013 6:15 PM, "Benjamin Zeller" wrote: > Ok i just found out what the problem is. > Its a "feature" of chrome and firefox, they only open > a few connections to a server and

Re: [Interest] 64 bit capable QVector

2013-09-03 Thread Constantin Makshin
rink a block of memory in-place) makes me a bit sad... > > > You meant allocators used by default. > Such problems can be solved by using custom allocators. > > Regards, > Alex > > > > > On Tue, Sep 3, 2013 at 4:55 PM, Constantin Makshin wrote: > >> W

Re: [Interest] 64 bit capable QVector

2013-09-03 Thread Constantin Makshin
iction, but then I decided > that QT containers are just a convenience classes which are > designed to work with either widgets or data of limited size > displayed > by that widgets. > > If guaranteed performance is needed you

Re: [Interest] 64 bit capable QVector

2013-09-03 Thread Constantin Makshin
Thanks for the explanation, although I still don't appreciate the choice (mostly regarding the size, not signedness). :) On 09/03/2013 10:48 PM, Thiago Macieira wrote: > On terça-feira, 3 de setembro de 2013 22:18:39, Constantin Makshin wrote: >> Could you please explain (or giv

Re: [Interest] Fwd: Lambda based connections are not disconnected upon QObject deletion

2013-09-03 Thread Constantin Makshin
The connection in your example doesn't use 'obj' at all (there are no non-static overloads of connect() that allow binding to lambda functions), so the crash can't be caused by deletion of that object. On 09/03/2013 11:58 AM, Philipp Kursawe wrote: > Using this code: > > @ > obj->connect(sender,

Re: [Interest] 64 bit capable QVector

2013-09-03 Thread Constantin Makshin
Could you please explain (or give a link to an article or something like that) the reasons Qt developers used to choose signed 32-bit integer for this purpose? Signed 32-bit container sizes, i.e. number of elements in a container, would be acceptable (considering the equation 'n * sizeof(T)' for th

Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-31 Thread Constantin Makshin
For ASCII-only hardcoded constant strings it's better to use QLatin1String because of its significantly lower overhead compared to QString (no additional memory [de]allocations and copying, it uses the original 'const char*' as its contents). For storing strings I'd recommend using UTF-8 because i

Re: [Interest] Converting std::string.c_str() code to use QString methods

2013-08-30 Thread Constantin Makshin
ybe I should go with .toStdString().c_str() to remain as compatible as > possible. > > -- > MJ. > > On Aug 30, 2013, at 3:26 PM, Constantin Makshin wrote: > >> std::string is more like QByteArray than QString because it's just a >> dynamically-resizea

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-28 Thread Constantin Makshin
what every function, system or not, returns. On Aug 28, 2013 9:40 AM, "Thiago Macieira" wrote: > On quarta-feira, 28 de agosto de 2013 09:20:30, Constantin Makshin wrote: > > Damn, I just realized that I won't be able to test MSVC's localtime() > > because Russ

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
omeone else has to do it. On Aug 28, 2013 8:51 AM, "Constantin Makshin" wrote: > Well, after some thoughts and looking at Qt 4.8 source code (Gitorious, > at least its web interface, was closed for maintenance yesterday in the > evening) my guess is that the problem

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
aving, leading to that 1-hour difference Calogero is experiencing. I'll probably test this theory in a few hours when I get to a Windows machine. On 08/28/2013 02:53 AM, Thiago Macieira wrote: > On quarta-feira, 28 de agosto de 2013 01:01:55, Constantin Makshin wrote: >> The original

Re: [Interest] Strange undeletable QTemporaryFile. Is it a bug?

2013-08-27 Thread Constantin Makshin
I agree that explicit object deinitialization (closing files, freeing memory, etc.) in the callee is a bad thing (implicit through destructors or object's management of its [internal] data is OK IMHO). bar() was just a hypothetical example with the idea "rely on the [expected] behavior of the decla

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
seeing. DST gets incorrectly applied because it's active at the moment of conversion, although it wasn't used at the moment the original timestamp represents. I bet that the problem will go away when DST ends [again]. :) On 08/27/2013 11:42 PM, Thiago Macieira wrote: > On terça-feira,

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
for that > date/time. Then you can convert reliably between different local times or > UTC. We ended up with our own class for tracking time that does that. (Kind > of like the .NET DateTimeOffset compared to the DateTime class). > > > -Daniel > > -Original Messag

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
ply a result of Microsoft's NIH syndrome and share the [general] behavior with their standard counterparts. On 08/27/2013 09:57 PM, Thiago Macieira wrote: > On terça-feira, 27 de agosto de 2013 21:40:29, Constantin Makshin wrote: >> When converting time from UTC to local time, Windows u

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-27 Thread Constantin Makshin
When converting time from UTC to local time, Windows uses the *current* state of daylight saving, not one that was active at the time the original timestamp is "pointing" to. On 08/27/2013 01:55 PM, Frank Hemer wrote: > On Tuesday 27 August 2013 10:19:06 Calogero Mauceri wrote: >> On 8/26/2013 7:3

Re: [Interest] Strange undeletable QTemporaryFile. Is it a bug?

2013-08-26 Thread Constantin Makshin
uestion will not ever rise again. > > On Sun, Aug 25, 2013 at 4:02 AM, Constantin Makshin <mailto:cmaks...@gmail.com>> wrote: > > void bar (QIODevice& zzz) > { > // ... > zzz.close(); // Oops > } > > void foo () > {

Re: [Interest] Relashionship between time_t and QDateTime

2013-08-26 Thread Constantin Makshin
As far as I understand the description of QDateTime::fromTime_t(), it automatically converts the passed value from UTC to local time. On the other hand, QFileInfo::lastModified() may immediately return the value retrieved from the system without any transformations. On Aug 26, 2013 7:43 PM, "Caloge

Re: [Interest] Strange undeletable QTemporaryFile. Is it a bug?

2013-08-25 Thread Constantin Makshin
ived classes it does not what the name implies" doesn't work. On Aug 24, 2013 2:05 PM, "Till Oliver Knoll" wrote: > Am 24.08.2013 um 09:46 schrieb Constantin Makshin : > > Overriding a public method to make it private doesn't make much sense > because th

Re: [Interest] Strange undeletable QTemporaryFile. Is it a bug?

2013-08-24 Thread Constantin Makshin
Overriding a public method to make it private doesn't make much sense because this restriction can be easily circumvented by casting the pointer/reference to a base class (explicitly or by passing it to a function, in the context of this thread, expects a QFile or even more generic QIODevice). On A

Re: [Interest] Strange problem in template class (Iterator as value type of a QHash)

2013-08-23 Thread Constantin Makshin
g++ isn't bad at all, but sometimes its error messages may be quite confusing/cryptic. On Aug 23, 2013 8:39 PM, "Mandeep Sandhu" wrote: > >> Error from Clang: >> >> error: template argument for template type parameter must be a type; did >> you forget 'typename'? >> > > It' right, in that I need

Re: [Interest] Compiling Programs with C++11 with Qt5, which was compiled without C++11 flag. Possible?

2013-08-14 Thread Constantin Makshin
The second error message says "'complex' cannot be used as a function", but the only place where the word "complex" can be seen on the screenshot is that guy's own code. This observation and the fact that with broken C++11 code Qt itself wouldn't be compilable (unless package maintainers explicitly

Re: [Interest] Qt4 QODBCDriver class and header file no longer in Qt5?

2013-07-31 Thread Constantin Makshin
While class names and #include-s are certainly safer because they are checked at compile-time, but text names unleash the real power of QtSql — unified API (which, IMHO, doesn't make much sense if you stick your application to one particular RDBMS) and ability to make the database interface selecta

  1   2   >