Posts

Showing posts with the label qt

QT QLabel setPixmap from QAbstractVideoSurface

QT QLabel setPixmap from QAbstractVideoSurface I'm implementing my own class for probing video frames from QCamera under windows. It's a subclass of QAbstractVideoSurface. So, my probe generates QPixmap which I tried to draw on QLabel (as viewfinder). And I've got segmentation fault on QLabel setPixmap call. I'm sure my Qpixmap is well made, because I can save it on the disk with a save(). My QLabel is inititalized and works well, because I can load QPixmap from the disk and set it to QLabel. I guess there is problem with a format of a pixmap, but can't clue how to correct it :( My code frameprobe.h #ifndef FRAMEPROBE_H #define FRAMEPROBE_H #include <QAbstractVideoSurface> #include <QList> #include <QPixmap> class FrameProbe : public QAbstractVideoSurface { Q_OBJECT public: explicit FrameProbe(QObject *parent = 0); QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;...

C++ QThread and connect causing crashes

C++ QThread and connect causing crashes My QThread counter crashes giving odd results for what the number should be as the Thread counts properly but in the SetLabel function I get a different number to whats in the QThread ands it then crashes after 3 seconds and the label doesnt seem to update. QThread* CountThread = new QThread; Counter* Count = new Counter(); Count->moveToThread(CountThread); connect(CountThread, SIGNAL(started()), Count, SLOT(Process())); connect(Count, &Counter::SecondsUpdate, this, [=]{ SetLabel(Count->Seconds) ;}); connect(Count, SIGNAL(finished()), CountThread, SLOT(quit())); CountThread->start(); void Counter::Process() { int secs = 0; while (secs < 1000) { qDebug() << "hello" << secs; secs += 1; Sleep(1000); emit SecondsUpdate(); } emit finished(); } void BaseWindow::SetLabel(int Seconds) { qDebug() << Seconds; this->Test->setText(QString("Seconds: " + QString::number(Seconds))); } c...

Qt C++ “new” operation may cause unexpected errors?

Image
Qt C++ “new” operation may cause unexpected errors? There are two UIs in my project, namely, Login and MainWindow. Now I use signal-slot method to transfer some data of Login to some MainWindow class member variables,and here is some key code: Login::Login(QWidget *parent) : QDialog(parent) { setupUi(this); MainWindow *w = new MainWindow; connect(this,SIGNAL(sendData(QList<QString>)),w,SLOT(receiveData(QList<QString>))); } //get data from Login void MainWindow::receiveData(QList<QString> userList){ userName = userList.at(0); password = userList.at(1); QSqlQuery query; bool b = query.exec(QString("SELECT * FROM user WHERE user_id = '%1' AND password = '%2'").arg(userName).arg(password)); if(b){ query.first(); userType = query.value(1).toString(); qDebug()<<"user_type:"<<userType; //always has value in userType qDebug()<<"user_id:"<<userN...

Translating a C++ line to Python 3

Translating a C++ line to Python 3 I'm trying to translate a Qt plugin from C++ to python, however my knowledge on C++ is minimal, can you please help me to confirm if my translation is Ok? (the plugin is not working as expected). C++ code: /*************************************************************************** * Copyright (C) 2006-2008 by Tomasz Ziobrowski * * http://www.3electrons.com * * e-mail: t.ziobrowski@3electrons.com * * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. ...

Deploy Qt application on MAC with Qt framework

Deploy Qt application on MAC with Qt framework I developed one Qt application in Mac using Qt creator,Its working fine on my development machine.Then I copied the project output from my build directory to a new machine without Qt framework,but its not working in that machine, Do I need to install any frame work for running Qt application in Mac. How I can include qt framework in my application when deploying the project output? This question appears to be off-topic because it doesn't have SSCCE; doesn't demonstrate a minimal understanding of the problem being solved; and it's asking us to asking us to recommend or find a tool, library or favorite off-site resource. – FakeRainBrigand Jul 28 '13 at 21:45 I solved it by using the "macdeployqt" tool blog.inventic.eu/2012/08/… ...

Compiling OpenCV opencv_world with Qt - unresolved externals

Compiling OpenCV opencv_world with Qt - unresolved externals I want to compile OpenCV (3.4) with Qt (5.11) (with setting CMake-option WITH_QT and setting Qt5*_DIR paths). The source codes were freshly downloaded from github or Qt-Website. The Solution folder for VC14 is created with the latest CMake. If I compile it with VC14 (Visual Studio 2015 C++) it perfectly compiles and links the single modules. But if I also choose the CMake-option BUILD_opencv_world I get unendless (226) linking errors: "unresolved external symbol ...". All of them related to the project opencv_world. If I remove the CMake-option "WITH_QT" I also can create the opencv_world files. What do I make wrong? Below just a the first entries of the error list: Severity Code Description Project File Line Suppression State Error LNK1120 226 unresolved externals opencv_world D:LIBSopencv-make-VC14binDebugopencv_world341d.dll 1 Error LNK2001 unresolved external symbol "public: stat...

Qt application running with `-platform offscreen` argument cannot establish websocket connection

Qt application running with `-platform offscreen` argument cannot establish websocket connection I have a GUI application which contains a websocket server QWebSocketServer . I also have a python script which sends messages and the application processes them. Everything works well. During testing I wanted to run the application in headless mode using -platform offscreen command line argument added to the app executable name (I changed nothing else). But the problem is that when the application runs off-screen, the client script cannot establish connection with the web socket server. I tested this on localhost only. I do not understand how this two things, visibility of GUI and websockets, can interfere. Any ideas what could go wrong? QWebSocketServer -platform offscreen Note: I am using Qt 5.11.1 64-bit with VS 2017 on Windows 10 Pro. I further exploring the issue. I tried the same with another application and it seems to work well even for -platform offscr...