Solved Windows deploy failure
-
I write a small chat app by QT, My Qt version is 5.6.2 MinGw 32bit, my system is windows7 sp1 64bit. At first, my program run well from Qt Creator , it behaves normally and achieves my goal, so I decide to deploy it. I use windeployqt to deploy it, my deploy folder looks like this
After I click client.exe, it shows the loginpage like this
After I type the username, password and click login button, somethins strange happens
the client.exe stopped working, I open the dump file by visual studio , it shows the error code 0xC0000005 The thread tries to read and write a virtual address and it does not have the appropriate access to the address
the xml file shows<?xml version="1.0" encoding="UTF-16"?> <WERReportMetadata> <OSVersionInformation> <WindowsNTVersion>6.1</WindowsNTVersion> <Build>7601 Service Pack 1</Build> <Product>(0x1): Windows 7 Ultimate</Product> <Edition>Ultimate</Edition> <BuildString>7601.23677.amd64fre.win7sp1_ldr.170209-0600</BuildString> <Revision>1130</Revision> <Flavor>Multiprocessor Free</Flavor> <Architecture>X64</Architecture> <LCID>2052</LCID> </OSVersionInformation> <ProblemSignatures> <EventType>APPCRASH</EventType> <Parameter0>client.exe</Parameter0> <Parameter1>0.0.0.0</Parameter1> <Parameter2>044ded10</Parameter2> <Parameter3>Qt5Core.dll</Parameter3> <Parameter4>5.6.2.0</Parameter4> <Parameter5>08dba018</Parameter5> <Parameter6>c0000005</Parameter6> <Parameter7>00074dfd</Parameter7> </ProblemSignatures> <DynamicSignatures> <Parameter1>6.1.7601.2.1.0.256.1</Parameter1> <Parameter2>2052</Parameter2> <Parameter22>0a9e</Parameter22> <Parameter23>0a9e372d3b4ad19135b953a78882e789</Parameter23> <Parameter24>0a9e</Parameter24> <Parameter25>0a9e372d3b4ad19135b953a78882e789</Parameter25> </DynamicSignatures> <SystemInformation> <MID>801EB16B-3D8F-401B-8DF4-36BC08AD0EF7</MID> <SystemManufacturer>Dell Inc.</SystemManufacturer> <SystemProductName>OptiPlex 3010</SystemProductName> <BIOSVersion>A10</BIOSVersion> </SystemInformation> </WERReportMetadata>
Maybe the problem is Qt5Core.dll, but the client.exe run fine and behave well in the release folder, so I am very confused. Then I copy the deploy folder to another computer which doesn't install Qt. Thel client.exe shows the loginpage too, but stop working when it need to show the mainwindow
So how can I figure my problem , since it runs well in Qt Creator both in debug version and release version
Thanks in advance,
xiaxun -
I use Dependency Walker to test the client.exe, here is the result
it shows the Link Checksum and Real Checksum of QT5CORE.DLL are different, is it the reason? -
Hi, the checksums are irrelevant (Windows does not care) so I think Qt5Core.dll is not the problem.
But the list in your Dependency Walker shows some Windows system .DLLs that are 64-bit and that your Qt files are 32-bit, that could be the reason for the crash. -
@hskoglund @SGaist
how can I force my appliction to link my 32bit windows libary, since my system is windows 64 bit, here is my configure page
I searched the google and found some solution, do I neet to add CFLAGS += -m32 in my pro file.
I also search this pagelink textSince my Dependency Walker picture above is 64bit version, now I also try the 32bit Dependency Walker in my 64bit system, it output with nothing wrong, does it make any difference?
Thanks in advance -
Hi,
Something's not clear here, how many different version of Qt do you have on your system ?
What parameters did you pass to
windeployqt
? -
@SGaist
Hi, SGaist, thanks for your answer.I only install qt-opensource-windows-x86-mingw492-5.6.2
I didn't pass any paramenters to windeployqt -
@Masonsu said in QT Windows deploy failure:
I also search this pagelink textSince my Dependency Walker picture above is 64bit version, now I also try the 32bit Dependency Walker in my 64bit system, it output with nothing wrong, does it make any difference?
The bit depth of dependency walker doesn't matter. You can use 32 or 64 bit for your application.
What I do in this situation is put it together manually. Create a directory, put your exe in it. Run your exe and it will pop up with a message box saying something like "your app needs xxx.dll to run". Copy that dll into your directory and run again. It will show the next one. Keep doing this until your application starts.
Oh and in order to do this you have to make sure you don't have your mingw dlls or your Qt dlls in your PATH or they will auto detect and run. If you don't want to remove them from the path what you can do is use another system (preferably a virtual machine or one without any development stuff installed) and copy your exe there, then supporting dlls as prompted.
This is the long way to do this and something that should automatically be done by windeployqt. But in cases where I've had issues, this is a tried and true approach that I use. If you can make it run on a fresh windows VM without and development stuff installed, it will definitely run on an end user's PC. :)
-
@ambershark
I tried as you said, I remove the Qt from the PATH, the program works well in my computer now, but fails on another computer , the exception point to Qt5Core.dll ,Since it is a release version, I don't know how to debug it. -
What Qt modules are you using in this application ?
-
@Masonsu My guess is you don't have the platform plugins.
Most dlls it will tell you but for plugins (especially platform) it just crashes a lot.
In your main directory create directories
plugins/platforms
and then put the appropriate platform libs in there. I don't remember what they are for windows off the top of my head. They will be in/your/qt/path/plugins/platforms
. If you have issues copy everything from that dir into your new one.Lastly if you still have issues, you can use a qt.conf file in your application directory to tell it where your plugins are.. create a text file qt.conf that looks like:
[Paths] Plugins = plugins
-
@ambershark said in QT Windows deploy failure:
qt.conf
I am sorry , I tried as you said, but it failed again. Here is my pro file
#-------------------------------------------------Project created by QtCreator 2016-11-21T21:11:16
#-------------------------------------------------
QT += core gui network sql multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = client
TEMPLATE = appunix:LIBS += -L/usr/local/lib -lprotobuf
win32:INCLUDEPATH = E:/mingw/msys/1.0/local/include
win32:LIBS = -LE:/mingw/msys/1.0/local/lib -lprotobufSOURCES += main.cpp
mainwindow.cpp
login.cpp
usertr.pb.cpp
socket.cpp
chatlog.cpp
chattab.cpp
sendfile.cpp
qchat.cpp
useinfo.cpp
dbmanager.cpp
filewidget.cpp
newgroup.cpp
groupchat.cpp
newgroupmember.cppHEADERS += mainwindow.h
login.h
usertr.pb.h
socket.h
chatlog.h
chattab.h
sendfile.h
qchat.h
useinfo.h
dbmanager.h
filewidget.h
newgroup.h
helper.h
groupchat.h
newgroupmember.hFORMS +=
chatlog.ui
chattab.ui
filewidget.ui
groupchat.ui
login.ui
mainwindow.ui
newgroup.ui
newgroupmember.ui
useinfo.uiRESOURCES +=
icons.qrcDISTFILES +=
the protobuf library was complied by MinGw4.9.2 32bit and it is a static library
Now I am guessing that something is wrong with my code but it works normally on my Development machine, it is so strange -
@Masonsu I highly doubt it's your code. I've seen this many times before. We'll get it figured out. :)
Ok so if you could show me a directory listing of your application's directory and all sub dirs. Using a command prompt you could do:
cd /your/path dir /s /a > dirlist.txt
Then post that dirlist.txt file here. Also show me the contents of your qt.conf file if you made one.
Also you shouldn't need the mingw includepath or libs path. If those need to be set in the .pro file that is already a problem, in my opinion, for your build. Especially since they are hardcoded to only work on your system. But that isn't what's causing the issue, that is just for your information later on to make your build better. It should work on any system without having to change the pro file or having things in certain directories to mirror yours.
-
@ambershark
Hi, ambershark, Thanks for your answer驱动器 D 中的卷是 新加卷
卷的序列号是 5CD3-411FD:\new_new 的目录
2017/03/28 11:41 <DIR> .
2017/03/28 11:41 <DIR> ..
2017/03/27 22:11 <DIR> build
2017/03/27 19:32 <DIR> cache
2017/03/23 12:26 10,383 chatlog.cpp
2017/03/23 10:37 1,527 chatlog.h
2017/01/02 21:53 1,489 chatlog.ui
2017/03/23 12:26 12,100 chattab.cpp
2017/03/23 12:26 2,055 chattab.h
2016/12/10 19:51 859 chattab.ui
2017/03/27 19:24 1,275 client.pro
2017/03/28 11:36 23,651 client.pro.user
2017/03/22 22:11 7,711 dbmanager.cpp
2017/03/22 22:11 1,157 dbmanager.h
2017/03/28 11:41 0 dirlist.txt
2017/03/27 19:16 <DIR> emoji
2017/03/18 22:28 729 filewidget.cpp
2017/03/18 21:10 404 filewidget.h
2017/03/18 21:30 1,494 filewidget.ui
2017/03/23 11:48 8,086 groupchat.cpp
2017/03/23 10:36 1,156 groupchat.h
2017/03/21 11:16 1,955 groupchat.ui
2017/03/20 16:58 277 helper.h
2017/03/27 19:16 <DIR> icons
2017/03/19 19:45 292 icons.qrc
2017/03/27 19:27 6,144 Jimmy_database.db
2017/03/28 09:53 5,587 login.cpp
2017/03/16 21:37 1,245 login.h
2017/03/16 20:57 12,966 login.ui
2017/03/16 15:36 163 main.cpp
2017/03/28 11:35 8,561 mainwindow.cpp
2017/03/24 14:15 1,866 mainwindow.h
2017/03/24 14:16 3,497 mainwindow.ui
2017/03/22 20:13 2,513 newgroup.cpp
2017/03/20 23:23 574 newgroup.h
2017/03/22 20:09 4,389 newgroup.ui
2017/03/23 10:57 1,997 newgroupmember.cpp
2017/03/22 19:22 633 newgroupmember.h
2017/03/22 16:49 1,295 newgroupmember.ui
2017/03/18 15:34 1,233 qchat.cpp
2017/03/17 19:24 434 qchat.h
2017/03/28 09:53 6,277 sendfile.cpp
2017/03/18 21:30 1,110 sendfile.h
2017/03/22 22:08 3,559 socket.cpp
2017/03/22 22:26 1,565 socket.h
2017/03/27 19:16 <DIR> sound
2017/03/27 19:26 6,144 Tom_database.db
2017/03/17 21:53 3,572 useinfo.cpp
2017/03/17 21:53 849 useinfo.h
2017/03/17 10:36 5,530 useinfo.ui
2017/03/22 23:19 197,614 usertr.pb.cpp
2017/03/22 23:19 115,816 usertr.pb.h
45 个文件 471,733 字节D:\new_new\build 的目录
2017/03/27 22:11 <DIR> .
2017/03/27 22:11 <DIR> ..
2017/03/27 22:11 <DIR> debug
2017/03/27 22:11 19,637 Makefile
2017/03/27 22:11 239,142 Makefile.Debug
2017/03/27 22:11 239,597 Makefile.Release
2017/03/27 22:11 644 object_script.client.Debug
2017/03/27 22:11 702 object_script.client.Release
2017/03/28 11:35 <DIR> release
2017/03/27 22:11 3,556 ui_chatlog.h
2017/03/27 22:11 1,832 ui_chattab.h
2017/03/27 22:11 2,948 ui_filewidget.h
2017/03/27 22:11 4,801 ui_groupchat.h
2017/03/27 22:11 16,054 ui_login.h
2017/03/27 22:11 6,883 ui_mainwindow.h
2017/03/27 22:11 7,469 ui_newgroup.h
2017/03/27 22:11 3,030 ui_newgroupmember.h
2017/03/27 22:11 9,905 ui_useinfo.h
14 个文件 556,200 字节D:\new_new\build\debug 的目录
2017/03/27 22:11 <DIR> .
2017/03/27 22:11 <DIR> ..
0 个文件 0 字节D:\new_new\build\release 的目录
2017/03/28 11:35 <DIR> .
2017/03/28 11:35 <DIR> ..
2017/03/27 22:12 46,831 chatlog.o
2017/03/27 22:12 74,421 chattab.o
2017/03/28 11:35 1,399,808 client.exe
2017/03/27 22:12 41,034 dbmanager.o
2017/03/27 22:12 11,338 filewidget.o
2017/03/27 22:12 43,518 groupchat.o
2017/03/28 09:54 68,771 login.o
2017/03/27 22:11 1,531 main.o
2017/03/28 11:35 43,435 mainwindow.o
2017/03/27 22:12 5,502 moc_chatlog.cpp
2017/03/27 22:12 11,108 moc_chatlog.o
2017/03/27 22:12 12,794 moc_chattab.cpp
2017/03/27 22:12 15,003 moc_chattab.o
2017/03/27 22:12 2,686 moc_dbmanager.cpp
2017/03/27 22:12 3,921 moc_dbmanager.o
2017/03/27 22:12 4,083 moc_filewidget.cpp
2017/03/27 22:12 8,923 moc_filewidget.o
2017/03/27 22:12 7,833 moc_groupchat.cpp
2017/03/27 22:12 15,059 moc_groupchat.o
2017/03/27 22:12 6,078 moc_login.cpp
2017/03/27 22:12 10,233 moc_login.o
2017/03/27 22:12 9,848 moc_mainwindow.cpp
2017/03/27 22:12 14,091 moc_mainwindow.o
2017/03/27 22:12 4,582 moc_newgroup.cpp
2017/03/27 22:12 9,179 moc_newgroup.o
2017/03/27 22:12 4,754 moc_newgroupmember.cpp
2017/03/27 22:12 10,499 moc_newgroupmember.o
2017/03/27 22:12 4,481 moc_qchat.cpp
2017/03/27 22:12 5,471 moc_qchat.o
2017/03/27 22:12 8,212 moc_sendfile.cpp
2017/03/27 22:12 11,942 moc_sendfile.o
2017/03/27 22:12 7,421 moc_socket.cpp
2017/03/27 22:12 6,396 moc_socket.o
2017/03/27 22:12 4,802 moc_useinfo.cpp
2017/03/27 22:12 9,324 moc_useinfo.o
2017/03/27 22:12 37,711 newgroup.o
2017/03/27 22:12 21,596 newgroupmember.o
2017/03/27 22:12 3,201 qchat.o
2017/03/27 22:12 536,825 qrc_icons.cpp
2017/03/27 22:12 105,371 qrc_icons.o
2017/03/28 09:54 30,877 sendfile.o
2017/03/27 22:11 12,566 socket.o
2017/03/27 22:12 40,018 useinfo.o
2017/03/27 22:11 155,765 usertr.pb.o
44 个文件 2,888,842 字节D:\new_new\cache 的目录
2017/03/27 19:32 <DIR> .
2017/03/27 19:32 <DIR> ..
2017/03/27 19:31 812 Jimmy1f60a.png
2017/03/27 19:28 775 Jimmy1f60f.png
2017/03/27 19:27 888 Jimmy1f61a.png
2017/03/27 19:32 867 Jimmy1f61d.png
2017/03/27 19:27 25,047 Tom106.gif
2017/03/27 19:27 812 Tom1f60a.png
6 个文件 29,201 字节D:\new_new\emoji 的目录
2017/03/27 19:16 <DIR> .
2017/03/27 19:16 <DIR> ..
2017/03/27 19:16 <DIR> Free Tuzki
2017/03/27 19:16 <DIR> picture
0 个文件 0 字节D:\new_new\emoji\Free Tuzki 的目录
2017/03/27 19:16 <DIR> .
2017/03/27 19:16 <DIR> ..
2016/12/10 11:30 12,911 102.gif
2016/12/10 11:30 10,874 104.gif
2016/12/10 11:30 25,047 106.gif
2016/12/10 11:30 25,047 108.gif
2016/12/10 11:30 6,245 109.gif
2016/12/10 11:30 3,092 10_003.gif
2016/12/10 11:30 25,085 110.gif
2016/12/10 11:30 11,776 112.gif
2016/12/10 11:30 13,135 113.gif
2016/12/10 11:30 11,496 114.gif
2016/12/10 11:30 6,193 115.gif
2016/12/10 11:30 33,143 116.gif
2016/12/10 11:30 5,375 117.gif
2016/12/10 11:30 11,951 118.gif
2016/12/10 11:30 5,071 120.gif
2016/12/10 11:30 2,553 121.gif
2016/12/10 11:30 8,594 122.gif
2016/12/10 11:30 10,709 124.gif
2016/12/10 11:30 32,079 125.gif
2016/12/10 11:30 6,750 126.gif
2016/12/10 11:30 697 128.gif
2016/12/10 11:30 11,495 129.gif
2016/12/10 11:30 25,024 131.gif
2016/12/10 11:30 8,607 134.gif
2016/12/10 11:30 5,565 135.gif
2016/12/10 11:30 15,098 136.gif
2016/12/10 11:30 17,109 137.gif
2016/12/10 11:30 14,964 139.gif
2016/12/10 11:30 14,390 140.gif
2016/12/10 11:30 33,012 141.gif
2016/12/10 11:30 11,900 144.gif
2016/12/10 11:30 5,892 146.gif
2016/12/10 11:30 28,489 149.gif
2016/12/10 11:30 7,860 150.gif
2016/12/10 11:30 6,122 151.gif
2016/12/10 11:30 2,026 153.gif
2016/12/10 11:30 4,049 155.gif
2016/12/10 11:30 10,959 156.gif
2016/12/10 11:30 29,975 157.gif
2016/12/10 11:30 2,705 158.gif
2016/12/10 11:30 9,752 159.gif
2016/12/10 11:30 6,415 160.gif
2016/12/10 11:30 9,410 161.gif
2016/12/10 11:30 13,907 163.gif
2016/12/10 11:30 62 getdata.xgi
2016/12/10 11:30 475 icon18_wrench_allbkg.png
2016/12/10 11:30 9,012 image (1).gif
2016/12/10 11:30 12,230 image (10).gif
2016/12/10 11:30 3,597 image (11).gif
2016/12/10 11:30 7,113 image (12).gif
2016/12/10 11:30 5,645 image (13).gif
2016/12/10 11:30 7,567 image (14).gif
2016/12/10 11:30 4,739 image (15).gif
2016/12/10 11:30 8,594 image (16).gif
2016/12/10 11:30 10,763 image (17).gif
2016/12/10 11:30 7,560 image (18).gif
2016/12/10 11:30 2,245 image (19).gif
2016/12/10 11:30 10,894 image (2).gif
2016/12/10 11:30 13,151 image (20).gif
2016/12/10 11:30 7,539 image (21).gif
2016/12/10 11:30 10,958 image (22).gif
2016/12/10 11:30 7,994 image (23).gif
2016/12/10 11:30 11,160 image (24).gif
2016/12/10 11:30 15,213 image (25).gif
2016/12/10 11:30 34,807 image (26).gif
2016/12/10 11:30 14,156 image (27).gif
2016/12/10 11:30 9,070 image (28).gif
2016/12/10 11:30 23,110 image (29).gif
2016/12/10 11:30 6,307 image (3).gif
2016/12/10 11:30 8,497 image (30).gif
2016/12/10 11:30 6,248 image (31).gif
2016/12/10 11:30 11,600 image (32).gif
2016/12/10 11:30 10,024 image (33).gif
2016/12/10 11:30 11,144 image (34).gif
2016/12/10 11:30 13,928 image (35).gif
2016/12/10 11:30 1,435 image (36).gif
2016/12/10 11:30 3,932 image (37).gif
2016/12/10 11:30 12,098 image (38).gif
2016/12/10 11:30 13,915 image (39).gif
2016/12/10 11:30 1,039 image (4).gif
2016/12/10 11:30 29,035 image (40).gif
2016/12/10 11:30 7,969 image (41).gif
2016/12/10 11:30 4,316 image (42).gif
2016/12/10 11:30 7,859 image (43).gif
2016/12/10 11:30 26,832 image (44).gif
2016/12/10 11:30 5,368 image (5).gif
2016/12/10 11:30 11,677 image (6).gif
2016/12/10 11:30 19,166 image (7).gif
2016/12/10 11:30 6,303 image (8).gif
2016/12/10 11:30 34,901 image (9).gif
2016/12/10 11:30 33,362 image.gif
91 个文件 1,087,157 字节D:\new_new\emoji\picture 的目录
2017/03/27 19:16 <DIR> .
2017/03/27 19:16 <DIR> ..
2016/05/27 00:53 810 1f600.png
2016/05/27 00:53 767 1f601.png
2016/05/27 00:53 1,136 1f602.png
2016/05/27 00:53 686 1f603.png
2016/05/27 00:53 737 1f604.png
2016/05/27 00:53 851 1f605.png
2016/05/27 00:53 901 1f606.png
2016/05/27 00:53 935 1f607.png
2016/05/27 00:53 1,078 1f608.png
2016/05/27 00:54 746 1f609.png
2016/05/27 00:54 812 1f60a.png
2016/05/27 00:54 896 1f60b.png
2016/05/27 00:54 785 1f60c.png
2016/05/27 00:54 1,069 1f60d.png
2016/05/27 00:54 824 1f60e.png
2016/05/27 00:54 775 1f60f.png
2016/05/27 00:54 517 1f610.png
2016/05/27 00:54 438 1f611.png
2016/05/27 00:54 632 1f612.png
2016/05/27 00:54 861 1f613.png
2016/05/27 00:54 718 1f614.png
2016/05/27 00:54 647 1f615.png
2016/05/27 00:54 844 1f616.png
2016/05/27 00:54 738 1f617.png
2016/05/27 00:54 843 1f618.png
2016/05/27 00:54 648 1f619.png
2016/05/27 00:54 888 1f61a.png
2016/05/27 00:54 752 1f61b.png
2016/05/27 00:55 1,061 1f61c.png
2016/05/27 00:55 867 1f61d.png
2016/05/27 00:55 757 1f61e.png
2016/05/27 00:55 715 1f61f.png
2016/05/27 00:55 845 1f620.png
2016/05/27 00:55 845 1f621.png
2016/05/27 00:55 1,123 1f622.png
2016/05/27 00:55 891 1f623.png
2016/05/31 05:30 1,529 1f624.png
2016/05/27 00:55 835 1f625.png
2016/05/27 00:55 633 1f626.png
2016/05/27 00:55 821 1f627.png
2016/05/27 00:55 1,002 1f628.png
2016/05/27 00:55 871 1f629.png
2016/05/27 00:55 1,185 1f62a.png
2016/05/31 05:30 1,126 1f62b.png
2016/05/27 00:55 694 1f62c.png
2016/05/31 05:30 1,236 1f62d.png
2016/05/27 00:55 575 1f62e.png
2016/05/27 00:55 634 1f62f.png
2016/05/27 00:55 971 1f630.png
2016/05/31 05:30 1,583 1f631.png
2016/05/27 00:55 862 1f632.png
2016/05/27 00:55 1,127 1f633.png
2016/05/27 00:56 1,075 1f634.png
2016/05/27 00:56 710 1f635.png
2016/05/27 00:56 465 1f636.png
2016/05/31 05:30 1,322 1f637.png
2016/05/27 00:56 580 1f641.png
2016/05/27 00:56 600 1f642.png
2016/05/27 00:56 602 1f643.png
59 个文件 50,476 字节D:\new_new\icons 的目录
2017/03/27 19:16 <DIR> .
2017/03/27 19:16 <DIR> ..
2016/11/26 14:45 34,214 avatar1.png
2016/11/26 14:46 28,354 avatar2.png
2016/11/26 14:46 22,899 avatar3.png
2016/11/28 16:23 458,788 BitFury-Slapped-with-Lawsuit-from-Former-Employee.-newsbtc-bitcoin-news.png
2016/11/27 23:01 20,720 Da_Qiao_-_RTKXI.jpg
2017/03/18 21:49 4,055 people-b.png
2017/03/18 21:49 8,806 People-MSN.png
2016/11/28 19:18 137,133 southtyrol350698.jpg
2017/03/18 21:48 4,583 user.png
2016/11/28 15:24 101,925 Uzumaki.Naruto.full.714894.jpg
10 个文件 821,477 字节D:\new_new\sound 的目录
2017/03/27 19:16 <DIR> .
2017/03/27 19:16 <DIR> ..
2017/03/23 11:57 24,116 jingle-bells-sms.mp3
1 个文件 24,116 字节所列文件总数: 270 个文件 5,929,202 字节 29 个目录 74,099,384,320 可用字节
-
@Masonsu Sorry I meant the directory for your application that you are distributing. The one that goes on the machine that isn't working.
I need to see if you have the right dlls/file names/dir structure, etc.
-
@ambershark @SGaist @hskoglund
I am sorry for that, it is nothing wrong with deployment but with my code.
I check my code again and found something wrong. I use illegal index of a QList after I login successfully, it crashes the deployment version, but it doesn't crash when I run it from QtCreator, here is the codeUseInfo::UseInfo(QWidget *parent) : QWidget(parent), ui(new Ui::UseInfo), sqldb(new DbManager()), username(Socket::username) { ui->setupUi(this); QStringList qlist; for (int i = 1960; i < 2016; ++i) qlist.append(QString::number(i)); ui->yearComboBox->addItems(qlist); qlist.clear(); for (int i = 1; i < 13; ++i) qlist.append(QString::number(i)); ui->monthComboBox->addItems(qlist); qlist.clear(); for (int i = 1; i < 32; ++i) qlist.append(QString::number(i)); ui->dayComboBox->addItems(qlist); sqldb->insertName(username); QList<QString> list = sqldb->readInfo(username); avatar = list[0]; gender = list[1]; year = list[2]; month = list[3]; day = list[4]; job = list[5]; phone = list[6]; email = list[7]; address = list[8]; hobby = list[9]; setIcon(avatar); setUseinfo(); }
so before assign the value to my class member variable, I need to check if the list is empty
thanks for all your reply -
Are you sure that
readInfo
returns 10 values ?By the way, why return a QStringList rather than an object that represent these info ?
-
@SGaist said in QT Windows deploy failure:
Are you sure that readInfo returns 10 values ?
By the way, why return a QStringList rather than an object that represent these info ?NO, so I said that I need to check that if list is empty, after I added if (!list.empty()), everything runs well
To the second quesion, maybe my design is not good, I didn't think too much, sorry for my poor English -
@Masonsu Good to hear this is fixed. And your english is great. :)