Results 1 to 2 of 2

Thread: QSqlTableModel verticak header connect

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QSqlTableModel verticak header connect

    How i can connect a

    vertikalheader = new QHeaderView(Qt::Vertical,this);

    inside a QSqlTableModel to append context menu to remove line and dns helps.... ?


    Qt Code:
    1. class DNS_model : public QSqlTableModel
    2. ..........
    3.  
    4. void DNS_model::refresh()
    5. {
    6. const QString hostqueryx = QString("SELECT id,name,type,alias,ttl,value,prior,comment FROM DNSEntry WHERE name ='%1'")
    7. .arg(host);
    8. QSqlQuery query2sur(hostqueryx,db);
    9. setQuery(query2sur);
    10. setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
    11. setHeaderData(1, Qt::Horizontal, QObject::tr("DOMAINE"));
    12. setHeaderData(2, Qt::Horizontal, QObject::tr("TYPE")); /* dnstype << "A" << "CNAME" << "NS" << "MX" << "TXT"; */
    13. setHeaderData(3, Qt::Horizontal, QObject::tr("ALIAS"));
    14. setHeaderData(4, Qt::Horizontal, QObject::tr("TTL")); /* tooltip Time to Live domain on dns server */
    15. setHeaderData(5, Qt::Horizontal, QObject::tr("VALUE"));
    16. setHeaderData(6, Qt::Horizontal, QObject::tr("MX_PRIORITY"));
    17. setHeaderData(7, Qt::Horizontal, QObject::tr("COMMENT"));
    18. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlTableModel verticak header connect

    I found a way but vertikalheader not emit signal . is a bug?


    Qt Code:
    1. void DB_dual::Paint_Table( const QString host , QTableView * tabi )
    2. {
    3.  
    4. QStringList ips = UniqueList("select value from DNSEntry where type ='A'");
    5. QStringList hosts = UniqueList("select value from DNSEntry where type ='MX' or type ='CNAME' or type ='NS'");
    6. TabDelegate *dele = new TabDelegate(tabi);
    7. dele->SetLists(ips,hosts);
    8. model = new DNS_model(db,host);
    9. connect(model, SIGNAL(UpdatePlay()), this , SLOT(DBUpdatePlay()));
    10. vertikalheader = new QHeaderView(Qt::Vertical,tabi);
    11. vertikalheader->setClickable(true);
    12. connect (vertikalheader,SIGNAL( sectionClicked(int)),model,SLOT(VertikalRow(int)));
    13. tabi->setModel(model);
    14. tabi->setItemDelegate(dele);
    15. tabi->setAlternatingRowColors(true);
    16. //////tabi->resizeColumnsToContents();
    17. }
    To copy to clipboard, switch view to plain text mode 

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.