[英]Qt application launch but does not show
I have a strange problem, I had developed 2 months ago a small project and I started to work on it again. 我有一个奇怪的问题,我在2个月前开发了一个小项目,然后又开始进行研究。
The problem is that the application starts (as I can click on the stop button in the IDE to kill it). 问题在于应用程序启动了(因为我可以在IDE中单击“停止”按钮将其杀死)。 But the windows does not show.
但是窗口不显示。 No error messages are shown, I tried to launch it outside of the IDE (with all DLLs and platform plugins).
没有显示错误消息,我尝试在IDE之外(带有所有DLL和平台插件)启动它。 But this is the same.
但这是一样的。
Here is my MainWindow constructor : 这是我的MainWindow构造函数:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow) {
qDebug() << "R";
ui->setupUi(this);
ui->statusbar->setSizeGripEnabled(false);
recorder = new QAudioRecorder(this);
createTempDir();
this->canProcessData = false;
this->state = WAITING;
this->mode = NONE;
connect(this->recorder, SIGNAL(durationChanged(qint64)),
this, SLOT(updateDuration(qint64)));
connect(this->recorder, SIGNAL(statusChanged(QMediaRecorder::Status)),
this, SLOT(updateStatus(QMediaRecorder::Status)));
connect(this->recorder, SIGNAL(stateChanged(QMediaRecorder::State)),
this, SLOT(onStateChanged(QMediaRecorder::State)));
connect(this->recorder, SIGNAL(error(QMediaRecorder::Error)),
this, SLOT(showError()));
// list settings
foreach(const QString &device, recorder->audioInputs()) {
ui->input_device->addItem(device, QVariant(device));
}
foreach(const QString &codec, recorder->supportedAudioCodecs()) {
ui->codec->addItem(codec, QVariant(codec));
}
foreach(int sample_rate, recorder->supportedAudioSampleRates()) {
ui->sample_rate->addItem(QString::number(sample_rate), QVariant(sample_rate));
}
this->log("Ready :)");
}
Here is main.cpp code: 这是main.cpp代码:
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
qDebug() << "A";
MainWindow w;
w.setFixedSize(720,455);
w.setWindowFlags(w.windowFlags() |= Qt::MSWindowsFixedSizeDialogHint);
w.show();
return a.exec();
}
As i you can see, I have a qDebug() << "R";
如我所见,我有一个
qDebug() << "R";
at the first line but it does not even show. 在第一行,但它甚至没有显示。
I googled it but obviously all that I could find was topics where it was a DLL problem. 我用谷歌搜索,但显然我能找到的只是关于DLL问题的主题。
I think its worth mentionning that when I dropped the project 2 months ago I was on the same PC and all the paths (compiler, libraries and Qt) are the same. 我认为值得一提的是,两个月前我放弃该项目时,我使用的是同一台PC,并且所有路径(编译器,库和Qt)都相同。
I you know something I would be grateful to you. 我知道我会感激你。
也许您使用的库定义了另一个main
入口点,但是您的那个不会被调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.