qt

Why can't QFile read from the "~" directory?

I've tried the following short example to find out about a bug in a bigger program I am working on. It looks like QFile doesn't support unix (or the shell's) notation for the home directory: #include <QFile> #include <QDebug> int main() { QFile f("~/.vimrc"); if (f.open(QIODevice::ReadOnly)) { qD...

Getting values from pro files in Qt

Hi, I am using Qt 4.5 in Windows XP. My pro file has the variable VERSION = 1.0. Now i need to read this variable and get its value (1.0) from the source code. So that I don't have to maintain another variable for version inside my source code. I just read from the pro file and update it. So that the value remains consistent all over my...

Qt, unit testing and mock objects.

Hello. Qt framework has internal support for testing via QtTest package. Unfortunately, i didn't find any facilities in it that can assist in creating mock objects. Qt signals and slots offers a natural way to create a unit-testing friendly units with input (slots) and output (signals). But is it any easy way to test that calling specif...

I'm following Qt Tutorials and got a simple question

If I want to create my own class MyWidget which inherits from QWidget Tutorial tells me to write constructor like this... MyWidget::MyWidget(QWidget *parent) : QWidget(parent){....} I'm wondering what is the role of : QWidget(parent) Does it mean explicit call for QWidget's constructor? ...

Can't catch newConnection() signal from QTcpServer

I am trying to make a simple server thread in QT to accept a connection, however although the server is listening (I can connect with my test app) I can't get the newConnection() signal to be acted on. Any help as to what I'm missing here would be much appreciated! class CServerThread : public QThread { Q_OBJECT protected: void...

Qt/C++ regular expression library with unicode property support

I'm converting an application from the .Net framework to Qt using C++. The application makes extensive use of regular expression unicode properties, i.e. \p{L}, \p{M}, etc. I've just discovered that the QRegExp class lacks support for this among other things (lookbehinds, etc.) Can anyone recommend a C++ regular expression library that:...

[Qt] How to make another window pop up that extends QWidget as opposed to QDialog?

So far I've only had my main window pop up other windows that were QDialogs and I'm not getting it to work with a QWidget. The other window I want to display was designed with the Form Editor, then wrapped in a class called ResultViewer which extends QWidget (as opposed to QDialog). What I want is to have the ResultViewer show its ui in...

How to automate detection of out of order tab navigation in Qt dialogs?

Typically, a dialog wishes to have tab navigation proceed in an orderly fashion through a dialog that roughly corresponds to the order of reading a book. When new fields are added to a dialog by engineers on a team, the new widgets can often not be inserted in tab correct order. Can anyone think of a way to automate the detection of ou...

Background image not showing on Qwidget

HI, i am designing a window using QWidget and set a background image, when i run my code i am not getting background image but showing window with default background. Can anyone help me what may be the reason. ...

Ovveride, the paintevent of the Qwidget.

Hi, I want to put a background image in mt QWidget, can anyone help me on this. how to Ovveride, the paintevent of the Qwidget and draw a image there ...

Can Qt's QWebView display programatically generated XML?

Using Qt 4.6, I can dynamically add to an HTML page like this: ui->webView->page()->mainFrame()->documentElement().findFirst("body").appendInside("<i>some text</i>\n"); However, if I QWebView::load() an XML file, it displays it with the correct CSS styling (from an processing instruction), but doesn't show any changes when I do somet...

How to put an imageor icon over a pushButton

hi, Can anyone help me on putting an image or icon over a push button. I tried with style sheet but not working. Please help ...

Qt support for VNC

i want to test whether qt is supporting VNC or not. For that i have written a small layout program using Qt library. the source code for the layout program is as follows: layout.cpp #include <QApplication> #include <QHBoxLayout> #include <QSlider> #include <QSpinBox> int main(int argc, char *argv[]) { QApplication app(argc, ar...

VC++ / C++ High performance Multithreaded GUI considerations for trading

I'm interested in seeing what considerations experienced developers make when developing high performance multithreaded GUI's for a windows platform. I ask this question in the context of developing trading applications where GUI's are very dynamic and application latency is an issue. What architectures have you seen or would you recom...

Creating a new window that stays on top even when in full screen mode (Qt on Linux)

I'm using Qt 4.6.3, and ubuntu linux on an embedded target. I call dlg->setWindowState(Qt::WindowFullScreen); on my windows in my application (so I don't loose any real-estate on the touch screen to task bar and status panel on the top and bottom of the screen. This all works fine and as expected. The issue comes in when I want to pop...

How to invoke make install for one subdirectory of Qt project

I'm working on custom library and I wish users could just use it by adding: CONFIG += mylib to their pro files. This can be done by installing mylib.prf file to %QTDIR%/mkspec/features. I've checked out in Qt Mobility project how to create and install such file, but there is one thing I'd like to do differently. If I correctly under...

Can I get build warnings from a custom build step in Qt Creator?

I have the following script that I run as a custom build step in Qt Creator: git ls-files . | egrep "\.cpp$|\.h$" | xargs vera++ Which then gives output: foo/bar.cpp:1: no copyright notice found Another script I also use is: cppcheck . --template gcc -q --enable=style,unusedFunctions With the output: apple.h:8: style: The class...

QGLWidget::makecurrent(): GetDC() failed. Invalid Window handle

Hello, I have a requirement to get pictures saved off screen. I have used QGLwidget::grabframebuffer to get this done. While it works fine on MAC, it fails with an error "QGLWidget::makecurrent(): GetDC() failed. Invalid Window handle " on Windows 7. Only one opengl context gets created in the process. But i have observed that if I add ...

Calling QAxWidget method outside of the GUI thread

I'm beginning to wonder if this is impossible, but I thought I'd ask in case there's a clever way to get around the problems I'm having. I have a Qt application that uses an ActiveX control. The control is held by a QAxWidget, and the QAxWidget itself is contained within another QWidget (I needed to add additional signals/slots to the ...

How can I make a Qt widget ignore style sheets set on parent widgets?

When adding a QComboBox control in Qt Designer, I get a terrible looking, non-native control, see: http://curiouschap.com/wp-content/uploads/2010/05/stack_qcombobox_question.png [as a newbie, SO wouldn't let me insert the image] On digging further, it turns out that two of the parent controls, QParentWindow and QStackedWidget, have ...