AttributeError: 'QWidget' object has no attribute 'setCentralWidget'
We can see setcentralwidget in QT help document that it belongs to the method of qmainwindow class and is defined separately in its class, so it cannot be called directly for its parent class QWidget.
void QMainWindow::setCentralWidget(QWidget *widget)
Write QtWidgets.QWidget() converts QtWidgets.QMainWindow().
- [Solved] Qt Vtk wglMakeCurrent failed in MakeCurrent(), error: The handle is invalid.
- How to Solve Error:cannot open source file “QtWidgets/QMainWindow”
- QT solves error: use of deleted function and is private within this context
- A mistake about implicitly providing default constructors
- [Solved] Vsync Error: this error in animationcontroller in fluent
- [Solved] Redis Error: Error creating bean with name stringRedisTemplate defined in class path resource
- Using elementui El-dialog as a subcomponent to close an error
- Qt error: no matching function for call to ‘MainWindow::connect(QAction*&, void (QAction::*)
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- Linux C++ Error: invalid use of incomplete type [How to Solve]
- Flash back problem when Android studio plays music in sdcard through intent
- [Go] Solve panic: runtime error: invalid memory address or nil pointer dereference in golang
- QT Error: use of undeclared identifier [How to Solve]
- [Solved] error LNK2038: Detected mismatch of “RuntimeLibrary”: The value “MDd_DynamicDebug” does not match the value “MTd_StaticDebug”
- [Rails 6] How to deal with ActiveRecord :: RecordInvalid: Validation failed:
- How to Solve Error inflating class android.support.design.widget.FloatingActionButton
- [Solved] Android Error: java.lang.IllegalStateException: Not allowed to start service Intent
- [Solved] Initialization error encountered by JUnit unit test: Method initialization error not found
- [Solved] Chrome submission error: Form submission canceled because the form is not connected
- The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”