Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Installation and getting started with first app
Forum Updated to NodeBB v4.3 + New Features

Installation and getting started with first app

Scheduled Pinned Locked Moved Installation and Deployment
71 Posts 6 Posters 38.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    giesbert
    wrote on last edited by
    #35

    I said Afaik, not that I did it before ;-)

    I never used QtMobility

    Nokia Certified Qt Specialist.
    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #36

      [quote author="Thomas Kennedy" date="1301490967"]ok...then which class should i use to get the system storage info if it is for desktop application ?[/quote]

      I don't know what info you want to get from QSystemStorageInfo, but maybe "QDesktopServices::storageLocation() ":http://doc.qt.nokia.com/4.7/qdesktopservices.html#storageLocation provides what you need.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #37

        In order to use the QSystemStorageInfo class from Mobility, be sure that in your .pro file you have included the lines

        @
        CONFIG += mobility
        MOBILITY += systeminfo
        @

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KennedyDayala
          wrote on last edited by
          #38

          Thanks a lot...

          without changing .pro file I am trying with QDir::Drives()..I will update you soon about my results..before that I have another query...

          I have placed my controls on the main window by opening 'mainwindow.ui' in design mode..how would I create control variables for those controls in my code using QTCreator ?

          Never Ever Give Up

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #39

            "control variables"? You mean you need a pointer to them?

            @
            m_ui->myCoolLineEdit->setText("I'm so cool!");
            @

            works for me. myCoolLineEdit is of course the name you gave the widget in Designer, and m_ui is the member variable that holds the UI class you created.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              KennedyDayala
              wrote on last edited by
              #40

              excellent..now i understood this part Andre..I have creaed a QTreeWidget on my MainWindow and coded like tihs..

              @
              ui->treeWidgetDrives = new QTreeWidget();
              ui->treeWidgetDrives->setColumnCount(1);
              QStringList strlstHeaders;
              strlstHeaders<<tr("Storage Drives");
              ui->treeWidgetDrives->setHeaderLabels(strlstHeaders);
              @

              ...when i run my code nothing is happened to my TreeWidget(no header is assigned)..instead it is showing the properties which i set from 'Edit Tree Widget' dialog !!!

              [EDIT: code formatting, please use @-tags, Volker]

              Never Ever Give Up

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #41

                The tree widget is automatically created for you. Just remove the first line of your snippet.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  KennedyDayala
                  wrote on last edited by
                  #42

                  if i remove that line and run the code I am not getting my Window displayed and here is the ouput..

                  Starting E:\Bose\Qt playground\IDT_Demo_UI-build-desktop\debug\IDT_Demo_UI.exe...
                  E:\Bose\Qt playground\IDT_Demo_UI-build-desktop\debug\IDT_Demo_UI.exe exited with code -1073741819

                  Never Ever Give Up

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #43

                    code -1073741819 = 0xC0000005. On windows this means an access violation. Seems like your UI is not initialized properly or messed up in some way....

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      KennedyDayala
                      wrote on last edited by
                      #44

                      perfect analysis..

                      I have moved this line to bottom of the code like this..

                      @
                      IDT_MainWindow::IDT_MainWindow(QWidget *parent) :
                      QMainWindow(parent),
                      ui(new Ui::IDT_MainWindow)

                      {
                      // my code here...

                          ui->setupUi(this);
                      

                      }
                      @

                      now i moved it to top and works fine..thanks a ton

                      [EDIT: code formatting, please use @-tags or the editor button, Volker]

                      Never Ever Give Up

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        KennedyDayala
                        wrote on last edited by
                        #45

                        only one child item is being shown to my TreeWidget..please look into my code and lemme know where I went wrong !!

                        @IDT_MainWindow::IDT_MainWindow(QWidget *parent) :
                        QMainWindow(parent),
                        ui(new Ui::IDT_MainWindow)

                        {
                        ui->setupUi(this);

                        ui->treeWidgetDrives->setColumnCount(1);
                        QStringList strlstHeaders;
                        strlstHeaders<<tr("Storage Drives");
                        ui->treeWidgetDrives->setHeaderLabels(strlstHeaders);
                        
                        SetupTreeItems();
                        

                        }
                        void IDT_MainWindow::SetupTreeItems()
                        {
                        QTreeWidgetItem *treeItems = new QTreeWidgetItem(ui->treeWidgetDrives);
                        treeItems->setText(0,tr("SystemDrives"));
                        QTreeWidgetItem *treeChildItems = new QTreeWidgetItem(treeItems);
                        QDir dir;
                        dir.setFilter(QDir::Drives);

                        QFileInfoList roots = dir.drives();
                        
                        for(int i=0 ; i<roots.count() ; ++i)
                        {
                            QFileInfo fiDrives = roots.at(i);
                            QString strDrive = fiDrives.absoluteFilePath();
                            treeChildItems->setText(i,strDrive);
                        }
                        

                        }@

                        Never Ever Give Up

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          goetz
                          wrote on last edited by
                          #46

                          You must create a new item in your loop. You just overwrite the on you have in each iteration.

                          http://www.catb.org/~esr/faqs/smart-questions.html

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andre
                            wrote on last edited by
                            #47

                            Your loop keeps on updating the text of the same tree item. Do you really expect to see more of them then?

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              KennedyDayala
                              wrote on last edited by
                              #48

                              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);
                              }@

                              Never Ever Give Up

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                goetz
                                wrote on last edited by
                                #49

                                [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 :-)

                                http://www.catb.org/~esr/faqs/smart-questions.html

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  KennedyDayala
                                  wrote on last edited by
                                  #50

                                  tried...it added an 'empty item' at 0th position,and 'c:' at 1st..and no more :-(

                                  Never Ever Give Up

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    andre
                                    wrote on last edited by
                                    #51

                                    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;
                                    @

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      KennedyDayala
                                      wrote on last edited by
                                      #52

                                      :-)) ok..will do that..

                                      Never Ever Give Up

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        goetz
                                        wrote on last edited by
                                        #53

                                        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());
                                        }
                                        

                                        }
                                        @

                                        http://www.catb.org/~esr/faqs/smart-questions.html

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          andre
                                          wrote on last edited by
                                          #54

                                          /me is thinking that instead of building a tree like that himself, he would use a QFileSystemModel instead...

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved