qt

What advantages does C++ have over other languages for Qt development?

As well-known, C++ has steeper learning curve than most of the mainstream languages, which results in better performance . But, does using C++ over other languages[like Java,Ruby,Python] for Qt development have still (major) advantages,let's say about Qtopia? If any, what are they? ...

Vector graphics clipboard format for Qt.

I want my Qt application to be able to save simple vector graphics to clipboard in a compatible way. On windows I want to be able to paste the graphics into Microsoft Word or Powerpoint. On Linux I want to be compatible with the Open Office. Which format would you recommend? Can Qt generate EMF in an easy way? Is SVG an option? Update...

Approaches to creating the View for "Humble Dialogs"

I have a bunch of questions to post regarding the issue of separating the view from logic when creating a GUI. The following is a minimal example of what I would do for a simple dialog that has a label and a button using the "Humble Dialog" approach. Pressing the button should show some text on the label. I have used C++ an Qt that I am ...

How to set an initial size of a QScrollArea?

I know that this is a very specific C++ and Qt related question, but maybe someone can help me, anyway ... See the code below: I want to display an image within a scroll area. The view port of the scroll area shall have a defined initial size. That means, if the image's size is bigger than the initial size of the view port, scroll bars ...

QT: Fast way to measure time?

I'm looking for the equivalent in QT to GetTickCount() Something that will allow me to measure the time it takes for a segment of code to run as in: uint start = GetTickCount(); // do something.. uint timeItTook = GetTickCount() - start; any suggestions? ...

Blocking a Qt application during downloading a short file

I'm writing an application using Qt4. I need to download a very short text file from a given http address. The file is short and is needed for my app to be able to continue, so I would like to make sure the download is blocking (or will timeout after a few seconds if the file in not found/not available). I wanted to use QHttp::get(), ...

Using QSortFilterProxyModel with a tree model

I have a QDirModel whose current directory is set. Then I have a QListView which is supposed to show the files in that directory. This works fine. Now I want to limit the files shown, so it only shows png files (the filename ends with .png). The problem is that using a QSortFilterProxyModel and setting the filter regexp will try to match...

Qt: how to make a shadow to main window widget?

How to make a shadow to main window widget on windows using Qt? ...

Native Windows API link problem on Qt + win32 + mingw.

I am trying to use native windows API with Qt using mingw toolset. There are link problems with some functions. What happens? Is this a bug with mingw name mangling? #ifdef Q_WS_WIN HWND hwnd = QWidget::winId(); HDC hdcEMF = CreateEnhMetaFile(NULL, NULL, NULL, NULL ) ; Rectangle(hdcEMF,100,100,200,200); HENHMETAFILE hem...

Qt QGraphicsScene copy

I have a QGraphicsScene that I want to copy and append to the start of a list. What is the best method of doing this? QGraphicsScene* m_scene = new QGraphicsScene(); QGraphicsScene* m_DuplicateScene; QList<QGraphicsScene *>m_list; ...

On QCoreApplication and QProcess...

I'm on the path to write a QCoreApplication supposed to create an external process via Qprocess. I've just noticed that even if the waitForStarted() is called and the process state is Running before the event handler is executing, the external process does not start until the exec() method is invoked on the QCoreApplication. That sai...

OpenGL background transparency?

I'm using QT's QGLFramebufferObject for off-screen rendering. After rendering to the buffer I read the result using glReadPixels() The problem is that sometimes the background color I read is just 0 (transparent black) and sometimes it is 0xFF000000 (opaque black) This seem to be related to the time the buffer is initialized. If the buff...

Translating Qt applications

I need to have my application translated into many different languages, I have the translators and know that I can use Qt Linguist. However as far as I can tell I have to package up Linguist myself and ship it out to the translators. Is there a web-based solution or do other package Qt Linguist with the ts files? ...

QT: show result of Color selection?

What is the best way to give the user feedback for a color selection? I have a dialog with a "Select Color" push button which pops a QColorDialog. After the selection is made I want to show the user the color selected. Usually I do this using a QLabel and changing it's background color in the palette. This method is cumbersome and I thin...

In a QTableWidget, changing the text color of the selected row

I'm using a QTableWidget to display several rows. Some of these rows should reflect an error and their text color is changed : Rows reflecting that there is no error are displayed with a default color (black text on white background on my computer). Rows reflecting that there is an error are displayed with a red text color (which is red...

How to create a QWidget with a HWND as parent?

With wxWidgets I use the following code: HWND main_window = ... ... wxWindow *w = new wxWindow(); wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) main_window); How do I do the same thing in Qt? The HWND is the handle of the window I want as the parent window for the new QtWidget. ...

Read (and write) RTF files with C++ / Qt

Hello, I am looking for a simple C++ library for tokenizing and parsing RTF (Rich Text Format) files. I am planning to edit them with Qt's QTextEdit. More the Formatting preserved the better -- but actually I am planning to use Bold and Italics only. In perl I would use RTF::Tokenizer. It would be nice if the module had some sort of ...

Do I get a finished slot if a start QProcess using startDetached

Do I get a finished signal if I start a QProcess using startDetached()? I'm trying to start a process, but I need to be able to get an event when the process has terminated. ...

Ruby's subclassing and Qt's signals/slots don't work together as expected

When trying to work with Qt's signal/slot mechanisms over more than one level of inheritance, I ran into a problem: When my class does not directly inherit from QObject, signals and slots don't seem to work any more. The output of the following program illustrates the case: require 'Qt' class A < Qt::Object signals 'mySignal()' sl...

Printing the stack trace in C++ (MSVC)?

In my C++ application (developed with Visual Studio 2003) and Qt4, I'd like to print the stack trace from a specific line of code, either to the console output or into a file. What would it take ? Is Qt of any help to do this ? ...