Here very strange situation.
Fresh install Debian Sid, XFCE4, nvidia proprietary driver 340.108 from Sid repo(maybe this proprietary driver have bug?)
c2d, gf9800gtx, 4gb ram, hdd
Now when i try start [b]any Qt software almost all[/b] give here Segmentation fault
Example Doomseeker, it crashes at start, BUT! working good through
gdb ./doomseeker
strace ./doomseeker
Same is with Qbittorrent
https://imgur.com/a/SYgqHZD
and 2048-Qt
https://imgur.com/SUefK7P
Only one Qt application starting normally - CMake GUI
Segmentation fault
#include <QApplication>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
return 0;
}
Please, can you give answer why it happens?
And if its possible solve this?
Related
I want to use WebGL in QtWebEngineWidgets.QWebEngineView under Windows with my Qt 5.9.2.
But when I try to load webglreport.com, in QWebEngineView it tells me, that "This browser supports WebGL 2, but it is disabled or unavailable."
How can I fix it?
Here's my code:
PyQt:
import os, sys
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
# app.setAttribute(QtCore.Qt.AA_UseOpenGLES) # nothing happens, you can comment it out
view = QtWebEngineWidgets.QWebEngineView()
# view.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.WebGLEnabled, True) # does not help too = (((
view.load(QtCore.QUrl("http://webglreport.com/?v=2"))
view.show()
sys.exit(app.exec_())
# And here WebGL Report will tell me: "This browser supports WebGL 2, but it is disabled or unavailable."
# How can I cope with it???
C++ Qt:
#include <QApplication>
#include <QtWebEngineWidgets/QWebEngineView>
#include <QUrl>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView view;
view.load(QUrl("http://webglreport.com/"));
view.show();
return a.exec();
}
Binary Packages
Wheels are provided for Python v3.5 and later for 64-bit Linux, macOS and 32-bit and 64-bit Windows. These include copies of the corresponding Qt libraries.
Note that the minimum version of macOS supported is determined by the version of Qt included in the wheel.
Note that for v5.11 and later the 32-bit Windows wheels do not contain the WebEngine modules.
pyqt download
Windows 10 and Qt Creator MSVC2015_64,I compile and run an example of QWebEngineView. just like this:
#include "mainwindow.h"
#include <QApplication>
#include <QWebEngineView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView *view = new QWebEngineView();
view->load(QUrl("http://qt-project.org/"));
view->show();
return a.exec();
}
but this code can not show the view,it give some message:
[2460:3120:0718/170222.823:INFO:dxva_video_decode_accelerator_win.cc(1120)] mf.dll is required for hardware video decoding
[2460:3120:0718/170222.823:INFO:dxva_video_decode_accelerator_win.cc(1120)] mf.dll is required for hardware video decoding
[2460:3120:0718/170223.229:ERROR:gl_context_wgl.cc(78)] Could not share GL contexts.
[2460:3120:0718/170223.229:ERROR:gl_context_wgl.cc(78)] Could not share GL contexts.
How to solve it?
Which Windows Version are you running?
The mf.dll is part of Windows 6/7/8/10 (and therefore not run on Windows XP). If you are running Windows XP, you have to confile Qt with the configure option "-target xp" for option "-no-wmf-backend" to be compatible with Windows XP.
If you are running a modern version,then try it by installing Windows Live Essentials and the Media Feature Package
i'm trying to create a simple QT program that allows me to launch avrdude without using command line operations.
I saw that with Qprocess it's easy to launch any kind of program and I tried succesfully with simple programs like Explorer Word and Others.
The problem is that when i try to open cmd.exe nothing happens, even if i try to pass a batch file containing all the information to launch correctly avrdude.
Here's the code
QProcess *process = new QProcess(this);
process->startDetached("cmd.exe",QStringList()<<"C:/avrdude/avr.bat");
I wrote a minimal sample application which shows how to start cmd with a command using QProcess::startDetached() (on button click):
// standard C++ header:
#include <iostream>
// Qt header:
#include <QApplication>
#include <QMainWindow>
#include <QPushButton>
#include <QProcess>
int main(int argc, char **argv)
{
// main application
#undef qApp // undef macro qApp out of the way
QApplication qApp(argc, argv);
QMainWindow qWin;
QPushButton qBtn(QString::fromLatin1("Start cmd"));
QObject::connect(&qBtn, &QPushButton::clicked,
[](bool) {
bool ret = QProcess::startDetached(
#if 1 // let Windows search for cmd.exe in %PATH%
QString::fromLatin1("cmd.exe"),
#else // define exact path of cmd.exe
QString::fromLatin1("C:\\Windows\\system32\\cmd.exe"),
#endif // 1
QStringList()
<< QString::fromLatin1("/K")
<< QString::fromLatin1("echo Hello"));
std::cout << "QProcess::startDetached():"
<< (ret ? "OK." : "Failed!") << std::endl;
});
qWin.setCentralWidget(&qBtn);
qWin.show();
return qApp.exec();
}
The Qt project file is left as exercise. (Sorry, I used CMake for this.)
Please, note the #if 1. If 1 is replaced by 0 the alternative code with full path is used. (During chat session we examined special problems with starting the cmd.exe.) On my system, both alternatives did as well.
(My system: Windows 10, VS2013, Qt 5.7)
I too have been working on a Qt program where there are a couple calls to AVRDUDE. This is what worked for me. Here's the code I made for a read of the AVR device through AVRDUDE, followed by a couple of comments.
void MainWindow::call_AVRDUDE_read() //AVR READ
{
QProcess CommandPrompt;
QStringList Arguments;
QString COMPortUsed = (ui->COM_Port_Used->text()); // get the COM port from the user off UI
Arguments << "/C avrdude -c arduino -P "+ COMPortUsed +" -b 115200 -p ATmega328P -e -U eeprom:r:fromEEPROM.bin:r";
CommandPrompt.start("cmd",Arguments);
CommandPrompt.waitForFinished();
}
Here's something else which may well influence things in your application. In my case, I am reading the AVR's EEPROM. There is another routine that writes the EEPROM, but it is essentially the same as above, but a different script is sent.
In BOTH these cases, the AVRDUDE operation takes a few seconds to perform its task. When you use the QProcess::startDetached(), it has the disadvantage that control will return IMMEDIATELY after the AVRDUDE script is called through the QProcess. This can cause problems, if for instance you wanted to (as in my case) read the contents of the EEPROM and try to do so before the read actually completes.
An alternative to startDetached() you might consider trying is shown below. This will retain control until the process is finished, which may be pretty important to you. Use these two lines to replace the startDetached() call you are currently using.
CommandPrompt.start("cmd",Arguments);
CommandPrompt.waitForFinished();
This will wait for the AVRDUDE process to finish before control is returned.
The take away here though is that QProces::startDetached() may return prematurely in your application. Just beware of that.
I'm attempting a QSqlDatabase hello world application using PostgreSQL. My environment is as follows: Windows 7 64-bit, Qt 4.8.2, PostgreSQL 9.0.13. The following code compiles, but will not debug, i.e. when I place a break on the QSqlDatabase::drivers() line, but the code exits with an exception. The application runs as expected when I comment out this line. Any suggestions?
#include <QApplication>
#include <QMainWindow>
#include <QtSql/QtSql>
#include <QtSql/QSqlDatabase>
int main(int argc, char *argv[])
{
QApplication prog(argc, argv);
QMainWindow *mainWin = new QMainWindow;
QStringList drvlst = QSqlDatabase::drivers(); // <-- problem!
mainWin->show();
return prog.exec();
}
Another example of DLL hell and how Dependency Walker can be a great tool for diagnosing potential bugs of this nature. Again, in this case, the linker was traversing the PATH environment variable to find QTSQLD4.DLL library dependencies. The linker found the openVPN SSLEAY32.DLL (which is actually 64 bit) instead of the postgreSQL version of SSLEAY32.DLL. Moving the openVPN url to the end of the PATH environment variable resolved this problem.
I run a Qt application, what I want to know is this running binary file name.
I must (partially) disagree with the other comments that it is not a Qt question: There is a Qt method QCoreApplication::applicationFilePath() which gives the directory+filename of the executable.
On Linux this will try to use /proc, and on Windows perhaps GetModuleFileName(). According to the docs it will fall back to argv[0].
You could then use QFileInfo to split it into an executable name and a directory.
QFileInfo(QCoreApplication::applicationFilePath()).fileName()
The Qapplication parses the commandline arguemnts, the first entry is the name of the executable - this is roughly the same as argv[0] in standard C but has a few extra complexities on windows if you have a Unicode build or if the application is started as a service
See http://doc.qt.io/qt-5/qcoreapplication.html#arguments
Again not really a Qt question. To find the name of the binary file executed it would be something like.
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
cout << argv[0] << endl;
return 0;
}