Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] QList : how to get a handle to its contents

$
0
0
I have a class CustoWidget which subclasses QWidget I need multiple of it so I stored them inside QList: QList<CustomWidget*> manager; Inside “function1()”, I initialized each CustomWidget everytime I call this function and add them to the list CustomWidget *widget = new CustoWidget(); manager.append(widget); widget->show(); Within “function2()”, I need to retrieve all CustomWidget in the list to reposition them: CustomWidget *widget; foreach(widget,manager) { widget->move(x,y); // x and y were retrieved using QDesktopWidget and doesn't matter in the code } but after function2() is called the CustomWidgets disappears but they are still inside the QList. Note: The CustomWidgets are small non-modal sub-windows similar to QDialog but with specific purpose I can’t use signal and slot since they will stack up when there are multiple CustomWidgets and I think its impractical to track them when some were closed by the user;

Viewing all articles
Browse latest Browse all 18427

Trending Articles