qapplication

creating QApplication in a different thread

我只是一个虾纸丫 提交于 2020-01-11 06:35:11
问题 I'm trying to create QApplication in a different thread, but found 2 main problems: 1- I can't interact with GUI 2- some warnings: WARNING: QApplication was not created in the main() thread. QObject::startTimer: timers cannot be started from another thread //happens when resizing widget QObject::killTimer: timers cannot be stopped from another thread here is the full code: (it may has some memory leaks but for testing purposes it fails) //main.cpp #include <QCoreApplication> #include "cthread

PyQt thread still running after window closed

空扰寡人 提交于 2019-12-24 13:33:31
问题 When I close an application window in PyQt the console is still left running in the background and python.exe process is present until I close the console. I think the sys.exit(app.exec_()) is not able to operate properly. Mainscript (which opens Firstwindow): if __name__ == '__main__': from firstwindow import main main() Firstwindow On button press: self.close() #close firstprogram Start() #function to open mainprogram Start(): def Start(): global MainWindow MainWindow = QtWidgets

Qt application with optional gui

北战南征 提交于 2019-12-23 09:36:39
问题 I am going to write program using Qt for some image processing and I want it to be able to run in non-gui mode (daemon mode?). I'm inspired by VLC player, which is "typically" GUI program, where you can configure it using GUI, but you can also run it in non-gui option when it runs without GUI. Then it uses some configuration file created in GUI mode. Question is how should be such a program design? Should be some program core, which is GUI independent and depending on options it is being

Qt QApplication framerate drop when maximizing window

让人想犯罪 __ 提交于 2019-12-22 14:54:08
问题 We are using Qt for a visualization engine viewer, and we are having issues with the QApplication::processEvents() method. Since we needed to control the framerate (in a game loop fashion), we overrided the QApplication to define our own and our game loop that looks like MainApplication app; // Some code here while (true) { app.processEvents(); app.doFrame(); // sync code, nothing for now } This works fine, timing are about 0.001s for the processEvents() call, while, for an empty scene, the

Sending signal to QApplication

血红的双手。 提交于 2019-12-14 04:11:15
问题 I'm sending a signal.CTRL_BREAK_EVENT to a QApplication subprocess and the subprocess's handler manages to catch the signal (and perform some magic before exiting). However, when the signal is sent, it is not processed until I interact with the QApplication window (causing it to somehow use CPU cycles LOL), only then will it handle the signal. E.g. I start QApplication as subprocess I send a signal.CTRL_BREAK_EVENT (from server that started the subprocess). Nothing happens. I click on any

How to register for ACTION_VIEW Intent on Android? Why doesn't my QApplication receive QEvent::FileOpen events?

和自甴很熟 提交于 2019-12-13 05:23:43
问题 I am trying to register a QtQuick Android application to open a certain class of files and handle them. From what I gather, when a file is opened with a QApplication it results in a QEvent::FileOpen being fired. The strongest (if inconclusive) evidence for this I have is this commit found in a production system, plus a number of blog posts and Google results. So, I first create a new empty QtQuick project. I then write an EventFilter, like this: #include <QtGui> #include <QApplication>

How to receive event whenever a QWidget is added to QApplication's widget tree?

[亡魂溺海] 提交于 2019-12-12 02:38:12
问题 I want to inspect something application wide. Specifically I'd like to inspect every widget that is added to the application. Similar thing can be done in JavaScript/HTML, where you can add DOM mutation listener which fires on DOM changes. Can I listen on added widgets upon QApplication ? Specifically, capture widgets added to QApplication object as children OR widgets added to any of the top level widgets or their children, subchildren, etc... If not possible, what is best workaround

QVideoWidget: Video is cut off

孤街醉人 提交于 2019-12-10 11:09:54
问题 I want to play a video in a Qt Application. This is my code so far: #include <QApplication> #include <QWidget> #include <QMediaPlayer> #include <QVideoWidget> #include <QUrl> #include <iostream> using namespace std; const int WIDTH = 1280; const int HEIGHT = 720; int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; window.resize(WIDTH, HEIGHT); window.setWindowTitle("Video Test"); window.show(); QMediaPlayer *player = new QMediaPlayer(); player->setMedia(QUrl:

QOpenGLWidget with QApplication?

喜夏-厌秋 提交于 2019-12-07 08:21:55
问题 We have a QWidget based application that was previously using a QWindow for OpenGL rendering. To fit that window in our application we had to use QWidget QWidget::createWindowContainer(QWindow); Previously we only used external to Qt OpenGL libraries for rendering. We have a desire to switch from using QWindow to some kind of QWidget for compatibility with touch gestures, and generally better overall compatibility with the rest of our application. The latest recommended OpenGL compatible

How to override QApplication::notify in Qt

纵饮孤独 提交于 2019-12-06 20:25:26
问题 I am trying to handle exception in my Qt application, I went through a couple of posts which indicated of overriding the QApplication::notify method to handle exceptions in a efficient way in Qt. I am not sure where should I add this overriden method. Is it the mainwindow.h or main.cpp? I added the following function in my MainWindow.h: bool notify(QObject * rec, QEvent * ev) { try { return QApplication::notify(rec,ev); } catch(Tango::DevFailed & e) { QMessageBox::warning(0, "error", "error")