QWidget::grab() is not a static method. (Think about it - if it were a static method, that means it doesn't need a QWidget instance in order to be called. If that were the case, then which QWidget's content would it grab?)
That's not what this code is doing. It's saying, call the static method grab() of the class named "myWidget". So, this is basic C++. If you want to call a non-static member function, you need to call it through an instance of the object:If I replace the class "ArticleDialog" with the instance myWidget: QPixmap pm = myWidget::grab();
Qt Code:
To copy to clipboard, switch view to plain text mode
But your code, even if you do get it to compile, will not work. Your dialog will not be shown until the Qt event loop starts running, and a.exec() is what does that. You can't grab the dialog's contents until the event loop is running because there's nothing there to grab.




Reply With Quote

Bookmarks