Results 1 to 13 of 13

Thread: QDataTable problem

  1. #1
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default QDataTable problem

    Friends,

    I am again with problems in the "QDataTable". Now the problem is for
    commanding the things, in the truth I does not want that it commands
    the values, plus all time that is effected a modifies in the date and
    hour it commands itself, and I do not want this.

    I already tried

    dataTable->setSorting(false);

    they see here:

    http://200.193.29.195/qt3/table.png

    when I bring up to date the hour and dates it commands for top.

    edm.

  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: QDataTable problem

    Could you further explain the situation? You don't like the order of items or is it something different?

  3. #3
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDataTable problem

    This,

    "I do not want to make ordinances in the QDataTable", however when I have "2 ids" equal, as in link above, it effects the ordinance.

    In the truth I do not want that he makes no type of ordinance.

  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: QDataTable problem

    I'm sorry but I don't understand what you want.

  5. #5
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Red face Re: QDataTable problem

    wysota, excuses for my english.

    What it is occurring is that the "QDataTable" order the hour and date for top, then all time that I bring up to date a register, it is effecting the ordinance.

    I does not want that it makes this.

    http://200.193.29.195/qt3/qdatatable.png

    edm.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDataTable problem

    The rows will be always ordered in some way. If you want a different order, just sort then using other columns.

  7. #7
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDataTable problem

    Hi Jacek,

    But I don't understand what you it wanted to say. I simply want that the "QDataTable" does not effect sorting.

    edm

  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: QDataTable problem

    By default the datatable doesn't do any sorting. Maybe it's SQL that sorts your data?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDataTable problem

    Quote Originally Posted by ederbs View Post
    But I don't understand what you it wanted to say. I simply want that the "QDataTable" does not effect sorting.
    What I wanted to say it that if you won't sort your rows in QDataTable, they will have some random order which you can't control (actually it's the order in which database retrieves them).

  10. #10
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDataTable problem

    I am not making ORDER BY in Query SQL.

  11. #11
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDataTable problem

    Code:

    /***************************************/
    ....

    /* Execute Query from dataTable */
    QString sqlAcompanhamento = QString("SELECT ....");
    cur = new QSqlSelectCursor( sqlAcompanhamento );

    /* Show Fields */
    dataTable->addColumn("id_ocorrencia", tr("Nº Ocor"), 70);
    dataTable->addColumn("nm_bairro_prv", tr("Logradouro"), 190);
    dataTable->addColumn("id_viatura", tr("VTR"), 85);
    dataTable->addColumn("tm_ocorrencia", tr("HIO"), 90);
    dataTable->addColumn("dt_tm_empenho", tr("HEM"), 180);
    dataTable->addColumn("dt_tm_chg_ocor", tr("HCO"), 180);
    dataTable->addColumn("dt_tm_sai_ocor", tr("HSO"), 180);
    dataTable->addColumn("dt_tm_chg_inter", tr("HCLI"), 180);
    dataTable->addColumn("dt_tm_sai_inter", tr("HSLI"), 180);

    /* Ajust Columns */
    dataTable->adjustColumn(0);
    dataTable->adjustColumn(1);
    dataTable->adjustColumn(2);
    dataTable->adjustColumn(3);
    dataTable->adjustColumn(4);
    dataTable->adjustColumn(5);
    dataTable->adjustColumn(6);
    dataTable->adjustColumn(7);
    dataTable->adjustColumn(8);
    dataTable->adjustColumn(9);

    /* Mode DataTable */
    dataTable->setSqlCursor( cur, false, true );
    dataTable->setNullText( "" );
    dataTable->QTable::setColumnWidth( 3, 50 );
    dataTable->QTable::setSorting(false);

    dataTable->refresh(QDataTable::RefreshData);
    dataTable->show();

    /***************************************/

    edm.

  12. #12
    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: QDataTable problem

    Quote Originally Posted by ederbs View Post
    I am not making ORDER BY in Query SQL.
    Exactly. That's why the database returns the data in an order other than you want. It probably sorts by primary key.

  13. #13
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDataTable problem

    It does not have to be this. I tried to pass "Query SQL" passing "ORDER BY" more the problem continues, the date and hour continues jumping for top when they are brought update.

    http://200.193.29.195/qt3/AcompanhamentoForm.html

    edm.

Similar Threads

  1. QDataTable problem in the order
    By cristiano in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2007, 23:58
  2. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 13:54
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 13:45
  4. problem with QDataTable
    By zlatko in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2006, 16:31
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.