QLineEdit Qt in c++ removing QLineEdit -


i'm trying make adress book in qt , using following code:

#include "mainwindow.h" #include "ui_mainwindow.h"  int counter = 1;  mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) , ui(new ui::mainwindow) {     ui->setupui(this); }  mainwindow::~mainwindow() {     delete ui; }  void mainwindow::on_pushbutton_clicked() {     qlineedit* voornaam = new qlineedit(this);     voornaam->setobjectname(qstring::fromutf8("lineedit_4"));     voornaam->setgeometry(qrect(10, 65+ 33*counter, 113, 24));     voornaam->show();      qlineedit* achternaam = new qlineedit(this);     achternaam->setobjectname(qstring::fromutf8("lineedit_5"));     achternaam->setgeometry(qrect(140, 65+ 33*counter, 113, 24));     achternaam->show();      qlineedit* adres = new qlineedit(this);     adres->setobjectname(qstring::fromutf8("lineedit_6"));     adres->setgeometry(qrect(270, 65+ 33*counter, 113, 24));     adres->show();      counter+= 1; }  void mainwindow::on_pushbutton_2_clicked() { } 

as can see in second function pushbutton_2_clicked haven't put yet. program works this: adds qlineedit every time push button(the first function). displays on ui. make new qlineedit everytime , move bit down list of these. voornaam, achternaam , adress names information want type in these qlineedits in program.

what want delete these qlineedit don't know how, i've searched on internet can't find examples. want delete these made qlineedits. have use name ? lineedit_4 example. i've found widget function removewidget, use this?

is there way easier display these widgets? i'm making rectangles , placing them beneath eachother using counter.

why don't use example qtablewidget. can add/remove rows (and columns if like). , use setcellwidget function add qlineedits cells.

you have button add new line. , have button delete selected lines table.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -