Re: Hi all, some about lists and views
Code:
void MainWindow::FindLocalInterface()
{
ui->textEdit_2->append(( interface.humanReadableName()));
ui
->textEdit_2
->append
(( lookUpHost
( QHostInfo::fromName( QHostAddress( addressEntry.
ip() ).
toString() ) ) ));
ui
->textEdit_2
->append
(( QHostAddress( addressEntry.
ip() ).
toString() ));
ui->textEdit_2->append(( interface.hardwareAddress()));
ui
->textEdit_2
->append
(( QHostAddress( addressEntry.
broadcast() ).
toString()) );
ui
->textEdit_2
->append
(( QHostAddress( addressEntry.
netmask() ).
toString() ));
ui->textEdit_2->append("\n\n\n");
}
}
}
Hi all, i have code like this. i want to see on a selectable item and select... i read treeview and table view manuals on my local but i cant find any good example and i need help. ):
Added after 1 48 minutes:
thanks for all...!
Re: Hi all, some about lists and views
Hi,
You can use a QComboBox.
Then use addItem() to add an entry to it.
Afterwards use currentIndex() and/or currentText() to get the item that is selected.
Best regards,
Marc
Re: Hi all, some about lists and views
Thanks for reply :) Sorry for my bad english. I solved it, and here is my code..
Code:
void MainWindow::findLocal()
{
model
->setHorizontalHeaderLabels
( QStringList() <<
"Connection Name" <<
"Computer Name" <<"IP Address" <<"MAC Address" <<"BroadCast" <<"Netmask");
ui->tableView->setModel(model);
QList<QStandardItem *> itemList;
// interfaces
itemList.clear();
if (itemList.at(4)->text().isEmpty())
{
itemList.removeOne(itemList.at(itemList.count()));
}
model->appendRow( itemList );
}
}
}
{
return "";
}
return host.hostName();
}
I have a one problem too... I cant remove empty items from item list. Its giving runtime error
Re: Hi all, some about lists and views
hi,
Quote:
I have a one problem too... I cant remove empty items from item list. Its giving runtime error
what err u r getting?
check line 21: if (itemList.at(4)->text().isEmpty())
is at(4) is right?
and also check itemList.removeOne(itemList.at(itemList.count()));
hope it helpz
Bala
Re: Hi all, some about lists and views
Ok. i solved this too with delete some lines :)
Here is the code..
Code:
if (!itemList.at(4)->text().isEmpty())
model->appendRow( itemList );
Yes 4 is the true coloumn... When i looked up my interfaces, there is more then 10 interface is showing. But just one has a broadcast number. I just want only show the live interface and i did it....
Thanks a lot :)
Edit:
Only connected interface's has a broadcast number... If you have more than 1 connection it will be listed..