Hi all,
Attachment 415
I am new to Qt programming. Can some body explain how to do it? It looks like tree with buttons as Items. Do I have to use QTreeWidget ?
Thanks in Advance,
Prasanna Bhat
Printable View
Hi all,
Attachment 415
I am new to Qt programming. Can some body explain how to do it? It looks like tree with buttons as Items. Do I have to use QTreeWidget ?
Thanks in Advance,
Prasanna Bhat
here is a sample QTreeWidget from a static sqlite3 my own sqlplug-in ... adapter...
Code:
/* Compose the tree to pick the item from adressess */ void Shop_Main::Compose_Addo() { /* addo_tree->clear(); QTreeView QMouseEvent #include <QTreeView><QTreeWidget> */ AddoLoad.clear(); bool attrib; QString daten; current_addo_item->setText(""); addo_tree->setMouseTracking(true); addo_tree->clear(); QStringList countrys = Query_List_Unique(QString( "SELECT DISTINCT land_code FROM %1 order by land_code" ).arg( TABLE_ADDO )); QStringListIterator i(countrys); while (i.hasNext()) { cou->setText(0,coustr); cou->setToolTip (0,tr("Open to Browse.")); addo_tree->expandItem(cou); QStringList paese = Query_List_Unique(QString( "SELECT DISTINCT ort FROM %1 WHERE land_code='%2' order by ort" ).arg( TABLE_ADDO , coustr)); QStringListIterator o(paese); while (o.hasNext()) { paeort->setText(0,pas); paeort->setToolTip (0,tr("Open to Browse.")); resultMap relist = Query_Qmap_Report(QString( "SELECT firma, name, id FROM %1 WHERE ort='%2' and land_code='%3' order by name" ).arg( TABLE_ADDO , pas , coustr)); resultMap::Iterator it; for ( it = relist.begin(); it != relist.end(); ++it ) { int dbid; if (is_numeric(inte)) { bool ok; dbid = inte.toInt(&ok); } else { dbid = 0; } int clientid = CLIENT_BASE + dbid; attrib = CheckAttributes(dbid); if (attrib) { } else { } AddoLoad.append(daten); sigle->setText(0,daten); } } } } /* this is a slot to get value ... */ /* Discovery actived item to grab on db */ void Shop_Main::Safari() { int xcol = addo_tree->currentColumn(); int total = AddoLoad.size(); if (total > 0) { QStringListIterator i(AddoLoad); while (i.hasNext()) { if (itemtext == findertree) { current_addo_item->setText(itemtext); } } } }
QTreeWidget won't look like this, you could write your own widget that will hold a number of QPushButtons and draw lines between them. It should be fairly easy to do.Quote:
Originally Posted by boss_bhat
Or use QCanvas (Q3Canvas or a port of QCanvas to Qt4 available from Trolltech ftp server) or even code it yourself. It should be quite easy too, especially if you don't need the rectangles to be actually buttons.
Why do you covert a QString to QByteArray, just to convert it back to QString?Quote:
Originally Posted by patrik08
Why don't you just write:Code:
while( i.hasNext() ) { if( itemtext == findertree ) { current_addo_item->setText( itemtext ); } }