qt5.4

How to enable antialiasing for QOpenGLWidget in QGraphicsView?

拈花ヽ惹草 提交于 2019-12-07 02:39:46
问题 I have added QOpenGLWidget to QGraphicsView (don't use setviewport) via QGraphicsProxyWidget: QSurfaceFormat format= QSurfaceFormat(); format->setSamples(4); //<== widget show black screen if samples =4, 1 is ok but not antialiasing m_glWidget->setFormat(format); MyGraphicsProxyWidget* proxy= new MyGraphicsProxyWidget(); proxy->setWidget(m_glWidget); //add to scene scene->addItem(proxy); I've tried some ways but not work: glwidget show black screen if samples =4, but samples = 1 is ok but not

Transparent Background in QWebEnginePage

假如想象 提交于 2019-12-06 01:01:02
问题 We are trying to port some application from Qt 4 to Qt 5.4. The Qt 5.4 has a new web engine. We used to make the background of QWebView and QWebPage to be transparent: view = new QWebView(this); QPalette palette = view->palette(); palette.setBrush(QPalette::Base, Qt::transparent); view->page()->setPalette(palette); view->setAttribute(Qt::WA_OpaquePaintEvent, false); But this code doesn't work for QWebEngineView and QWebEnginePage . The point is that QWebEnginePage doesn't have such an API

Render web content offscreen using QtWebEngine

白昼怎懂夜的黑 提交于 2019-12-05 14:15:05
I am trying to port an application that uses QtWebKit to render web content over to one that uses QtWebEngine. I am limited what I can change architecturally so I have to stick with the current approach of rendering the page, capturing to a memory buffer and then moving that across to a different process where the buffer is used as a texture in OpenGL. I've tried porting the code over (broadly speaking) by replacing WebKit with WebEngine, but the APIs are different. Can anyone tell me if this is possible? If so, please point me in the right direction to illustrates how to hook everything up.

How to set QNetworkCookieJar in QWebEngine?

百般思念 提交于 2019-12-05 05:24:37
问题 In QWebView it was possible to set a QNetworkCookieJar via QNetworkAccessManager. QNetworkAccessManager *nam = new QNetworkAccessManager(); nam->setCookieJar(cookieJar); webView->page()->setNetworkAccessManager(nam); This was working like a charm. How can I set a QNetworkCookieJar in new QWebEngine class introduced in Qt5.4? 回答1: I found a solution, to share Cookies with QWebEngine and QNetworkAccesManager by using QWebEngineCookieStore. Subclass QNetworkCookieJar: class CookieWebEngine :

QtDbus is not working in Qt5.4.1 on Windows 7

血红的双手。 提交于 2019-12-04 18:21:23
When I run the Qt Creator dbus examples, they couldn't run, is there any settings or stuff for working QtDbus module or any prerequistics? for example in chat project: if (!QDBusConnection::sessionBus().isConnected()) { qWarning("Cannot connect to the D-Bus session bus.\n" "Please check your system settings and try again.\n"); return 1; } returns 1 and program terminated. Finally I found the solution: For QtDbus module get working, The 3rd party Dbus module must be installed in Windows: Dbus Windows Installer Download After downloading and installing Dbus, it gets working without any

How to assign SQL query output model from Qt to QML's TableView?

别等时光非礼了梦想. 提交于 2019-12-04 16:32:34
From C++ (Qt): int main(int argc, char *argv[]) { QApplication app(argc, argv); /* * I have omitted the code about connection with the database and all for ease of * viewing the code. */ // My own function for filling in the data in the `QSqlQueryModel` QSqlQueryModel* model = new QSqlQueryModel; QString binid = "B1"; QString query = "SELECT t1.BinId, t1.PartitionId, t2.UnitId, t2.ItemCount FROM Bin_Partitions AS t1 " "INNER JOIN Partition_Units AS t2 ON t1.PartitionId = t2.PartitionId " "WHERE t1.BinId ='" + binid + "'"; model->setQuery(query); /* * I can see that the query runs successfully

Cleanly closing a QSerialPort in Qt

瘦欲@ 提交于 2019-12-04 06:32:12
问题 I am trying to close a serial port opened using the QSerialPort library but it hangs more than half the time. I am developing a multi-threaded app, with one thread responsible for UI and the other for serial communication. I am using the QThread wrapper class. void CommThread::run() { serial = new QSerialPort(); serial->setPortName(portname); serial->setBaudRate(QSerialPort::Baud115200); if(!serial->open(QIODevice::ReadWrite)){ qDebug() << "Error opening Serial port within thread"; quit =

Transparent Background in QWebEnginePage

大城市里の小女人 提交于 2019-12-04 05:59:49
We are trying to port some application from Qt 4 to Qt 5.4. The Qt 5.4 has a new web engine. We used to make the background of QWebView and QWebPage to be transparent: view = new QWebView(this); QPalette palette = view->palette(); palette.setBrush(QPalette::Base, Qt::transparent); view->page()->setPalette(palette); view->setAttribute(Qt::WA_OpaquePaintEvent, false); But this code doesn't work for QWebEngineView and QWebEnginePage . The point is that QWebEnginePage doesn't have such an API like setPalette . Can anyone find a way to solve this? As mentioned in https://bugreports.qt.io/browse

Qt 5.4/Qml: Prevent binding loop

假如想象 提交于 2019-12-04 03:38:03
I have a global singleton "Settings" which holds application settings. When I try to run the following code I get a QML CheckBox: Binding loop detected for property "checked" : CheckBox { checked: Settings.someSetting onCheckedChanged: { Settings.someSetting = checked; } } It is obvious why this error occurs, but how can I correctly implement this functionality without a binding loop? E.g. I want to save the current checked state of the checkbox in the settings singleton. I am using Qt 5.4 and Qml Quick 2. Regards, mcchu Don't bind it. Because the check box does not fully depend on Setting

How can QOpenGLWidget update not result in paintGL events?

自古美人都是妖i 提交于 2019-12-03 22:11:10
问题 I'm logging calls to update() and paintGL() , but somehow, only update happens. paintGL is called a couple of times and then never again! How is this possible? The window is visible and isVisible() returns True every time update() is called. Specifically, I converted from QGLWidget to QOpenGLWidget . I replaced my calls to updateGL() with calls to update() , and I replaced passing the format to the constructor with calling setFormat() . I added various calls to makeCurrent() where appropriate