Results 1 to 18 of 18

Thread: Application is fully functional ONLY on my laptop

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Application is fully functional ONLY on my laptop

    Application is fully functional only on my laptop, and on other computers it fails with part of its functionality.
    It starts on every computer (windows 64- and 32- bit), and some parts of it can be executed, but problem is the main part.
    I suspect problem is here, within sorting elements of QList.


    Qt Code:
    1. for(events_it = eventi.begin(); events_it!=eventi.end(); events_it++) {
    2. temp_event = *events_it;
    3. //if type==0, we access size of the event above, and set it to this event
    4. if(temp_event->getType() == 0) {
    5. Event *temp_event2;
    6. events_it2 = events_it;
    7. events_it2--;
    8. temp_event2 = *events_it2;
    9. long s = temp_event2->getSize();
    10. temp_event->setSize(s);
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 


    These are iterators i use:
    Qt Code:
    1. QList<Event*>::iterator events_it;
    2. QList<Event*>::iterator events_it2;
    To copy to clipboard, switch view to plain text mode 



    This is list i use:
    Qt Code:
    1. QList<Event*> eventi;
    To copy to clipboard, switch view to plain text mode 

    Object Event, which is inside QList:
    Qt Code:
    1. class Event
    2. {
    3. public:
    4. // Constructors
    5. Event(long a, long s, long t,short tip);
    6. Event(long a, long t, short tip);
    7.  
    8. private:
    9. long address;
    10. long size;
    11. long time;
    12. short type;
    13. };
    To copy to clipboard, switch view to plain text mode 


    Application is written under Windows 7 Professional (64-bit).

    Build settings:
    buildsettings.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application is fully functional ONLY on my laptop

    What kind of incorrect behaviour do you observe?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application is fully functional ONLY on my laptop

    If you want to summarize the work of my application..
    1) it reads xml, parse it and save into list of Events, then sort this list, calculate points from sorted events, save it to binary file and finally plots the graph from calculated points

    OR

    2) if there is already binary file created during case 1), points are read from binary file and drawn as graph.


    So, on my laptop, app works in both cases of use, but on other computers it can only read correct binary (case 2), but cannot perform case1.
    Some steps of case 1 are incorrect, in my opinion, it fails during sorting..

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application is fully functional ONLY on my laptop

    How did you implement sorting?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application is fully functional ONLY on my laptop

    1st code snippet from 1st post - here's problem, its ok on my laptop and on other computers it fails..

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application is fully functional ONLY on my laptop

    I don't see sorting in there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application is fully functional ONLY on my laptop

    sorry, firstly i use QStableSort to sort the list, and then this code snippet to access size property of Event (list element).
    Iteration through list is implemented with iterators and for loop, firstly it finds element with property type == 0, then with other iterator it goes up for one position and gets size property from above element and finally sets that size to first iterator (with type==0).

    I didn't mention usage of QStableSort - it goes well, i checked. But problems appear in code i pasted here.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application is fully functional ONLY on my laptop

    Quote Originally Posted by juracist View Post
    sorry, firstly i use QStableSort to sort the list,
    What comparison function are you using? Please show us the exact call to qStableSort along with the lessThan implementation you use with it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application is fully functional ONLY on my laptop

    Qt Code:
    1. qStableSort(eventi.begin(),eventi.end(),sortAddress);
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. bool sortAddress(Event *left, Event *right){
    2. return (left->getAddress() < right->getAddress());
    3. }
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Application is fully functional ONLY on my laptop

    And what your first code snippet is meant to do? Because it seems it searches for event of type 0 and then assigns it the value of "size" of a previous item. Which by the way will fail immediately if the first element in the list has type = 0.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application is fully functional ONLY on my laptop

    If you have patience and time, download exe file of my app, and try to run it (only for windows )
    Application

    Then, open xml file from same folder, and, if everything is ok, graph should be drawn..
    .bin file will be created in same folder, but not good file, only with couple of nulls..
    I also attached bin file that is created under my enviroment and if you try to open it, it should draw graph..

    So, you'll see there is a problem only with reading xml file, not bin file.
    Steps while drawing graph from xml is following:
    1. parsexml - OK
    2. sortAddress - OK
    3. getSize(code snippet from above) - FAIL (checked by printing elements from list into text file)
    4. sortTime
    5. correctOrder (something like getSize)
    6. calculatePoints (create points from CORRECT list of elements)
    7. drawGraph

Similar Threads

  1. installing and configuring Qt on a laptop running Ubuntu 12.04
    By modoMojo in forum Installation and Deployment
    Replies: 5
    Last Post: 20th June 2012, 09:29
  2. problem using qt mobility with my laptop camera
    By eyaler in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 27th May 2012, 18:40
  3. Replies: 0
    Last Post: 31st March 2011, 18:50
  4. Need to show a menu item with disabled look but functional
    By lalesculiviu in forum Qt Programming
    Replies: 4
    Last Post: 21st October 2009, 15:16
  5. Fully qualified X font name
    By piotrek in forum Qt Programming
    Replies: 0
    Last Post: 26th March 2009, 15:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.