qt4

Update Qt4 statusbar from glwidget

Hi, I've got a window containing a QGLWidget and a QStatusBar. I calculate the fps inside a timerEvent call, but I don't know the 'correct' way to update the statusbar on every frame. fps is a member variable of GLWidget: void GLWidget::timerEvent(QTimerEvent* event){ updateGL(); // Calculate FPS. prevTime = currentTime; ...

QTextEdit.insertHtml() is very slow.

I've given up on actually trying to make it go faster. My biggest problem is that when I'm inserting the html, the application slows down to a crawl. I have a progressbar, and I'm calling QCoreApplication.processEvents() (I'm using pyqt, by the way) Can I put insertHtml() into a different thread, so I don't have an unresponsive in...

Opening a file from a Qt String

I am making a Qt application and I have a button to open a file, which is connected to a custom slot. This is the slot code so far: void MainWindow::file_dialog() { const QFileDialog *fd; const QString filename = fd->getOpenFileName(); } How could I have it then convert the file name to a const char *, open the file, read it a...

Qt HTTP Server?

I'd like to write a small HTTP server application that receives HTTP GET requests, processes them and sends out a reply. Because of the history of the application I'd favor using Qt for this, but all I can find is the other (more common) direction: Send a request to a server and receive a reply using QNetworkAccessManager. What I need is...

How to Integrate Qt4 qm files into binary using cmake and QRC?

I have a Qt4 CMake project and I'd like to integrate the QM files for i18n into the output binary. These are the rules I have so far for generating the TS and QM files: set(myapp_TRANSLATIONS i18n/myapp_de.ts ) set(FILES_TO_TRANSLATE ${myapp_SRCS} ${myapp_MOC_HDRS} ) QT4_CREATE_TRANSLATION(QM_FILES ${FILES_TO_TRANSLATE} ${...

How to do QObject::moveToThread() when using QThreadPool?

I'm building a small multithreaded web server. The QTcpSockets are fetched in the main thread and then hand over by QtConcurrent to the QThreadPool, which eventually processes the data and sends out an answer. My problem is that the socket is created in the main thread and processed in another one. This causes errors when trying to writ...

How to use OpenGL functions on a QT OpenGL Widget?

I'm starting off QT 4.6's example "OpenGL - 2D painting" It uses a subclass of QGLWidget, and makes painting operations with the class QPainter. I'd like to know how to do drawing directly with OpenGL functions on the OpenGL Widget. ...

Embedded Windows Media Player loaded in QtWebKit: set volume does not work

hi, when loading this html (html is also here) in the Qt 4.6 Demo Browser, pressing "Set Volume = 80" fails without raising an exception. Notes: The same html works fine in Chrome and Firefox. Happens on Windows, but works fine on Mac. Fails also with Qt 4.7 Beta Demo, and in Arora browser. Any idea? ...

Contents of Qlistwidget based on selection of an item in another qlistwidget

Hi , I'm using QT Creator to develop an application. I have two QTListWidgets which are aligned side by side. I've populated the first qtlistwidget with some items using the 'Edit List Widget' dialogue box. Now based on which item is selected in the first qtkistwidget , I would like to have options in the second qtlistwidget. These ...

QT4 vs JavaFX. which is better?

which is better..??? qt4 of javafx..?? i work for a startup. we built the first version using javafx. now my superiors are suggesting me to shift to qt4. is it a good decision to shift..?? ...

When setting the WA_DeleteOnClose attribute on a Qt MainWindow, the program crashes when deleting the ui pointer.

I have set the WA_DeleteOnClose widget attribute in a MainWindow. setAttribute(Qt::WA_DeleteOnClose); However, whenever I close that main window, I get a segfault in its destructor, which only has delete ui; In a nutshell, created a Qt4 GUI Application in Creator, added the setAttribute(Qt::WA_DeleteOnClose); to constructor, program ...

Best way to make a QToolBar of "checkable" QToolButtons where only one of the buttons can be checked at a time?

I'm looking to make a QToolBar with a few actions in it, each of which is "checkable" (that is, I call setCheckable(true) on each action after creating it, which leaves the button in the down state after clicking it). The only way I can think of "unchecking" the other buttons is to hook into each button's triggered signal and uncheck th...

QGLWidget and hardware acceleration ?

Greetings all, Does simply subclassing QGLWidget and reimplementing paintEvent() make use of OpenGL and hardware acceleration? I create a QPainter and draw QImages in this paintEvent(). What happen inside the paintEvent() method of QGLWidget? Does it convert the images(QImage,QPixmap) into OpenGL textures? Does it use hardware acceler...

Visual Studio solutions in Qt Creator

Hi, I am using Qt 4.5 and having Qt Creator as the IDE. I am quite comfortable with it. I know we can open the .pro files (from the Qt Creator) in the Visual Studio IDE. But how about the reverse? i.e How can I open a visual studio Qt solution (.sln) in Qt Creator? Is it possible or I have to create a pro file again for the project? T...

How can I achieve layout similar to Google Image search in QT (PyQT)?

Hello, I'm new to QT. I'm using PyQT for GUI development in my project. I want to achieve this layout in my application. This application searches images from an image database. Google image search layout is ideal for my purpose. I'm following the book "Rapid GUI Programming with Python and Qt" and I'm familiar with layouts. I guess...

QGraphicsView/QGraphicsScene rendering question

I am using QGraphicsScene/QGraphicsView pair in my application. I had subclassed them for my purpose. The code snippet that generate the pair is below: itsScene = new QGraphicsScene; itsView = new QGraphicsView; itsView->setParent(itsCanvas); itsView->setGeometry(20,20,1700,720); itsView->setBackgroundBrush(Qt::black); itsView->setAlig...

What is the meaning of "size of an widget"?

I am learning UI programming using QT and i am bit confused by what size of an widget means. Is it the number of pixels? or does it literally mean size measured in inch, cm or something? If it is measured in pixels, then isn't the actual size depends on the pixel density? ...

How to set Application Icon in QT on Symbian?

Hi! How can I set an app icon in QT on Symbian? I read here http://doc.qt.nokia.com/4.6/appicon.html about hot to set it but it doesn't work for me. I created SVG-Tiny icon(file) and wrote ICON = Resource/ico.svg in the pro file. What is wrong? Thanks in advance ...

Making an app in Qt, under LGPL, Can I sell it?

Hi, I will be developing an application in Qt, using Qt under the LGPL license. Can I sell it to a client, without providing the source code for it? ...

How to use c++ std complex numbers in QtScript

Hello everyone, I try to find out how to use complex numbers in QtScripts such that slots defined with complex arguments can be called from a QtScript. Also basic algebra (+,-,exp, ... ) of complex-numbers should be accessible to the user from the script. Just for illustration want I want to call is: #include<complex> typedef complex<...