Installation and getting started with first app
-
wrote on 31 Mar 2011, 15:13 last edited by
you mean like this ??
@for(int i=0 ; i<roots.count() ; ++i)
{
treeChildItems = new QTreeWidgetItem(treeItems);
QFileInfo fiDrives = roots.at(i);
QString strDrive = fiDrives.absoluteFilePath();
treeChildItems->setText(i,strDrive);
}@ -
wrote on 31 Mar 2011, 15:15 last edited by
[quote author="Thomas Kennedy" date="1301584395"]you mean like this ??
@for(int i=0 ; i<roots.count() ; ++i)
{
treeChildItems = new QTreeWidgetItem(treeItems);
QFileInfo fiDrives = roots.at(i);
QString strDrive = fiDrives.absoluteFilePath();
treeChildItems->setText(i,strDrive);
}@
[/quote]You can try it to get the answer :-)
-
wrote on 31 Mar 2011, 15:17 last edited by
tried...it added an 'empty item' at 0th position,and 'c:' at 1st..and no more :-(
-
wrote on 31 Mar 2011, 15:23 last edited by
So... you need to aquire some debugging skills... Just try to follow what happens in your code. Don't guess: measure instead. Try for instance to insert statements like this at every relevant point in your function, and look at the output:
@
qDebug() << LINE;
@ -
wrote on 31 Mar 2011, 15:24 last edited by
:-)) ok..will do that..
-
wrote on 31 Mar 2011, 15:36 last edited by
Of course you must have an empty first entry, because you create this one outside your loop (line 21 in your original code snippet).
This is the compactified working version:
@
void FancyClass::populate() {
ui->treeWidget->setColumnCount(1);
QStringList headers;
headers << "Storage Device";
ui->treeWidget->setHeaderLabels(headers);QTreeWidgetItem *rootItem = new QTreeWidgetItem(ui->treeWidget); rootItem->setText(0, "SystemDevice"); foreach(QFileInfo drive, QDir::drives()) { QTreeWidgetItem *driveItem = new QTreeWidgetItem(rootItem); driveItem->setText(0, drive.absoluteFilePath()); }
}
@ -
wrote on 31 Mar 2011, 15:39 last edited by
/me is thinking that instead of building a tree like that himself, he would use a QFileSystemModel instead...
-
wrote on 1 Apr 2011, 05:17 last edited by
thanks a lot...I will try with QFileSystemModel too..
-
wrote on 1 Apr 2011, 06:41 last edited by
"The program can't start because mingwm10.dll is missing from your computer.Try reinstalling the program to fix this problem."
..i am getting this error when i tried running my application in stand alone mode...any help ??
-
wrote on 1 Apr 2011, 07:12 last edited by
YOu are startin g without QtCreator, right?
Did you try to search the forum for answers?
see this "post":http://developer.qt.nokia.com/forums/viewthread/4869
-
wrote on 1 Apr 2011, 07:34 last edited by
yes Gerolf..I searched..everybody says that we need to set the invironment varioables..I did that too but of no use..
-
wrote on 1 Apr 2011, 07:49 last edited by
put the needed dlls beside your exe or set the PATH environment variable to contain the path to mingw10.dll.
-
wrote on 1 Apr 2011, 08:53 last edited by
I have set the PATH environment variable..but it says QtCode4.dll is missing !!
-
wrote on 1 Apr 2011, 08:58 last edited by
QtCode4? what's this? or do you mean QtCore4.dll?
Then the path to this dll is miossinmg :-)
You have to add it also. -
wrote on 1 Apr 2011, 09:00 last edited by
sorry..that was typo..QtCore4.dll is correct..but where will this DLL reside ?
-
wrote on 1 Apr 2011, 09:05 last edited by
you find it inside your Qt installation
depends which version you installed
In Qt SDK with Qt 4.7.2, look here:<QtSDK Dir>\Desktop\Qt\4.7.2\mingw\bin
-
wrote on 1 Apr 2011, 09:27 last edited by
excellent Gerolf..it is working now..but my icons on buttons and Toolbar are missing in standalone application..
-
wrote on 1 Apr 2011, 09:29 last edited by
How did you add them?
using from the file system or add them to a qrc file? -
wrote on 1 Apr 2011, 09:58 last edited by
[quote author="Thomas Kennedy" date="1301650049"]excellent Gerolf..it is working now..but my icons on buttons and Toolbar are missing in standalone application..[/quote]
Could be some missing image format plugins. Please look in the forum search for "imageformats plugins", it was discussed recently with some hints about how to resolve this issue.
-
wrote on 5 Apr 2011, 11:37 last edited by
yep...now I understood how to create .qrc file..many thanks..
57/71