I'm using Qt 4.7.0 (32 bit) on Windows(mingw32).
The app is crashing when setVisible(),setDisabled(),hide() and show() are called. Official documentation, forums and google haven't helped so far. The QLineEdit variable is declared in the xml (passwordEdit).
The crash occurs only in debug mode, not in release mode.
ui->passwordEdit->setVisible(false);
The app was crashing because I was updating widgets' visibility and other properties from another thread. I didn't realize you have to do it from within the GUI thread. Using postEvent solved the problem.
Related
I am trying to extend a legacy win32 application functionalities. The legacy application has a Multiple Document Interface(MDI) as it's main window and is purely written in win32 API. Is it possible to show a QWidget in win32 MDI area as a child?
Are you using MFC?
What's important to understand is that running Qt always requires you have a running Qt event loop. So what you need is to properly process your MFC/win32 events an the Qt events.
There is the Qt solution QtWinMigrage for that supports Qt 4 and Qt >= 5.4 (Qt 5.0-5.3 are broken). Examples also show your use case.
This is certainly a good starting point if your application is based on CWinApp.
Further details can be found by searching the internet and reading about the QAbstractEventDispatcher. Hope this helps!
Recently I upgraded from Qt 5.3.0 to Qt 5.3.1 and noticed that my TableView's which use a QSortFilterProxyModel as their model no longer update when I sort the proxy model.
You can see this in action by using the sample code here!
If you compile it with Qt 5.3.0 the table will sort but if you compile it with Qt 5.3.1 the model will sort (verified with qDebug statements) but the TableView will not update. This happens on both Windows and Linux.
To get around it I had to add emit layoutChanged() after I call this->sort().
My question is has anyone else noticed this and found out if this is by design or is a defect.
Thanks
I did a little more digging and I found a Qt bug filed for exactly this issue. QTBUG-40035 TableView, Sort doesn't work.
Turns out in Qt 5.3.1 another bug was resolved QTBUG-37983 which changed the QQMLDelegateModel to emit layoutChanged( QList, QAbstractItemModel::LayoutChangedHint) instead of simply emitting layoutChanged(). The TableView does not seem to be listening to the parameratized version of the layoutChanged() signal which is why I can fix this by manually emitting layoutChanged() after I call sort().
This apparently has been fixed by QTBUG-39492 in Qt 5.3.2
I have an application that I was developing with Qt 4.7.4 but I had the problem (the bug is reported) with the button's (too small) hit area. So I change for Qt 4.8.0. Now my problem with the button is resolved, but my application runs really slower that it ran with Qt 4.7.4. Is there anything I need to do? Kind of settings...
Thanks
I've built Qt from sources with MSVC2008 as it was recommended to avoid any incompatibility issues. I'm having a problem though when using Qt functions that return QList objects.
QList<QNetworkInterface> *netInterfaces = new QList<QNetworkInterface>;
*netInterfaces = QNetworkInterface::allInterfaces();
delete netInterfaces;
This code will always crash on "delete netInterfaces" in free.c when trying to free memory. It states the heap is corrupted and I have no idea why, as everything was compiled with the same version of MSVC.
It happens for all Qt functions that return QList objects even when I just call the function:
QNetworkInterface::allInterfaces();
With the code above, application will always crash immediately when trying to free heap allocated by Qt.
Weird thing is, this only happens with the Debug build. Release build works fine without any crashes.
My Qt 4.8.0 was compiled with /MT (Multi-threaded) and I link to the library dynamically. My application is also compiled as Multi-threaded.
Does anyone know what could be the possible cause of the issue here?
I've found the solution to my problem. Apparently Qt has it's own set of heap allocators and while I had a Multi-threaded (/MT) build and a shared library, Qt would allocate heap using their own memory handlers in the DLL. After this memory was allocated by Qt, my application was trying to free these memory blocks in my own code which resulted in crashes as heap structure differed between Qt and the main application.
I've rebuilt Qt with /MT flag, but now I produced a static library instead of the shared one. After I linked Qt statically with my application all heap problems magically went away.
I may be wrong a bit with my explaination here, but I hope at least the solution will help some people who find this thread. I've seen quite a few people having this problem on the internet and the key is to actually understand that you shouldn't link shared library when it's built with /MT flag. /MD would be totally fine.
Here is the thread I found that enlightened me: http://qt-project.org/forums/viewthread/16513
Cheers!
Today I found that I could not debug in pure C projetc, but I could debug in qt gui project.
The error was “ during startup program exited with code 0×0”.
I was using Win 7 ultimate 64bit sp1. I had tried in another computer, it was the same.
My program ran when I was not trying to debug it.
Could someone help?
Qt SDK 1.2 includes qt lib 4.8 and qt creator 2.4.1.
Uncheck run in terminal, in Projects -> Run Options
If the debugger does not work properly, try the following:
Make sure you use at least Qt Creator 2.1.
Make sure the debugger is set up properly. For more information, see Setting Up Debugger.
In the Debug mode, select Windows > Views > Debugger Log to open the Debugger Log view. Browse the contents of the pane on the right hand side to find out what went wrong. Always attach the contents of the pane to debugger-related questions to the Qt Creator mailing list (qt-creator#trolltech.com) or paste them to creator.pastebin.com before asking questions in the IRC (on the #qt-creator channel at FreeNode).