I need to display a hierarchical set of data in a qt view. I\'m using QColumnView to display the model. However, there is a feature such that the last column in the view will
This will hide the button when it is clicked.
#include
#include
#include
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QColumnView view;
QFileSystemModel model;
QPushButton button(&view);
button.setText("Click me");
QObject::connect(&button, SIGNAL(clicked()), &button, SLOT(hide()));
model.setRootPath("/");
view.setModel(&model);
view.setPreviewWidget(&button);
view.show();
return a.exec();
}
Notice that it will become hidden forever. You have to call show()
if you want it to be displayed again.