How to extract widgets from QHBoxLayout in Qt -


i have tablewidget add widgets this:

qlabel *l = new qlabel("test"); qwidget *widget = new qwidget(); qhboxlayout *hbox = new qhboxlayout();  hbox->addwidget(l); hbox->setalignment(qt::aligncenter); hbox->setcontentsmargins(0,0,0,0); widget->setlayout(hbox);  ui->tablewidget->setcellwidget(0, 0, widget); 

when cell gets double clicked capture event , figure out qlabel is.

but how extract again or have to?

auto    widget = ui->tablewidget->cellwidget(ui->tablewidget->currentrow(), ui->tablewidget->currentcolumn()); // if mode singleselection auto    hbox = widget->layout(); auto    label = qobject_cast<qlabel *>(hbox->itemat(0)->widget()); 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -