[Interest] How to get QMainWindow derived window to show
Konstantin Shegunov
kshegunov at gmail.com
Sat May 1 19:18:55 CEST 2021
On Sat, May 1, 2021 at 1:22 AM Nicholas Yue <yue.nicholas at gmail.com> wrote:
> but somehow, the MainWindow variety, I have not been able to
>
>
> https://github.com/nyue/QtQuestions/blob/main/Qt5/language_change/mainwindow/MainWindow.cpp
>
You're treating the main window that's instantiated as a `QWidget`.
Simply:
int main( ... )
{
...
QUiLoader loader;
QFile file(":/designer/mainwindow.ui");
if (file.open(QFile::ReadOnly))
{
QMainWindow *mainWindow = qobject_cast<QMainWindow
*>(loader.load(&file));
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210501/81d1629c/attachment.html>
More information about the Interest
mailing list